Merge branch 'Cross_Server' of http://192.168.0.87:10010/r/snxxz_scripts into Cross_Server
| | |
| | |
|
| | | if (package.socketType == GameNetSystem.SocketType.Main)
|
| | | {
|
| | | CrossServerLogin.Instance.UpdateCrossServerOneVsOneData(package.PlayerName, package.TagPlayerName, package.TagJob);
|
| | | CrossServerLogin.Instance.UpdateCrossServerOneVsOneData(package.PlayerName);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public class HC001_tagGCCrossRealmPKMatchOK : GameNetPackBasic
|
| | | {
|
| | | public ushort RoomID; // 房间ID
|
| | | public byte NameLen;
|
| | | public string PlayerName; // 跨服名字
|
| | | public byte TagNameLen;
|
| | | public string TagPlayerName; // 对手名字
|
| | | public byte TagJob; // 对手职业
|
| | | public byte MatchPlayerCount;
|
| | | public tagGCCrossRealmPKMatchPlayer[] MatchPlayer = null; // 匹配到的玩家
|
| | |
|
| | | public HC001_tagGCCrossRealmPKMatchOK()
|
| | | {
|
| | |
| | |
|
| | | public override void ReadFromBytes(byte[] vBytes)
|
| | | {
|
| | | TransBytes(out RoomID, vBytes, NetDataType.WORD);
|
| | | TransBytes(out NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes(out PlayerName, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes(out TagNameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes(out TagPlayerName, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes(out TagJob, vBytes, NetDataType.BYTE);
|
| | | TransBytes(out MatchPlayerCount, vBytes, NetDataType.BYTE);
|
| | | MatchPlayer = new tagGCCrossRealmPKMatchPlayer[MatchPlayerCount];
|
| | | for (int i = 0; i < MatchPlayerCount; i++)
|
| | | {
|
| | | MatchPlayer[i] = new tagGCCrossRealmPKMatchPlayer();
|
| | | TransBytes(out MatchPlayer[i].PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes(out MatchPlayer[i].NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes(out MatchPlayer[i].PlayerName, vBytes, NetDataType.Chars, MatchPlayer[i].NameLen);
|
| | | TransBytes(out MatchPlayer[i].Job, vBytes, NetDataType.BYTE);
|
| | | TransBytes(out MatchPlayer[i].LV, vBytes, NetDataType.WORD);
|
| | | TransBytes(out MatchPlayer[i].MaxHP, vBytes, NetDataType.DWORD);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagGCCrossRealmPKMatchPlayer
|
| | | {
|
| | | public uint PlayerID;
|
| | | public byte NameLen;
|
| | | public string PlayerName; // 跨服名字
|
| | | public byte Job;
|
| | | public ushort LV;
|
| | | public uint MaxHP; // 默认满血
|
| | | }
|
| | |
|
| | | } |
| | |
| | | public string accountBuf { get; private set; } |
| | | public string passwordBuf { get; private set; } |
| | | |
| | | public void UpdateCrossServerOneVsOneData(string myName, string opponentName, int opponentJob) |
| | | public void UpdateCrossServerOneVsOneData(HC001_tagGCCrossRealmPKMatchOK matchOK) |
| | | { |
| | | oneVsOnePlayerData = new CrossServerOneVsOne() |
| | | { |
| | | roomId = matchOK.RoomID, |
| | | alreadyLogin = false, |
| | | validTimeLimited = Time.time + 30f, |
| | | autoEnsureTime = Time.time + 5f, |
| | | myName = myName, |
| | | myName = matchOK.PlayerName, |
| | | myJob = PlayerDatas.Instance.baseData.Job, |
| | | opponentName = opponentName, |
| | | opponentJob = opponentJob, |
| | | opponentName = matchOK.MatchPlayer[0].PlayerName, |
| | | opponentJob = matchOK.MatchPlayer[0].Job, |
| | | opponentMaxHp = (int)matchOK.MatchPlayer[0].MaxHP, |
| | | }; |
| | | |
| | | Clock.Create(DateTime.Now + new TimeSpan(5 * TimeSpan.TicksPerSecond), () => |
| | |
| | | |
| | | public struct CrossServerOneVsOne |
| | | { |
| | | public int roomId; |
| | | public bool alreadyLogin; |
| | | public float autoEnsureTime; |
| | | public float validTimeLimited; |
| | | public string myName; |
| | | public int myJob; |
| | | public int opponentPlayerId; |
| | | public string opponentName; |
| | | public int opponentJob; |
| | | public int opponentLevel; |
| | | public int opponentMaxHp; |
| | | |
| | | public CrossServerOneVsOne SetLoginState(bool alreadyLogin) |
| | | { |