少年修仙传客户端代码仓库
client_Zxw
2018-12-20 f1fb0cf26fedf89f3b36af8725b55c8d8782e3f0
Merge branch 'Cross_Server' of http://192.168.0.87:10010/r/snxxz_scripts into Cross_Server
3个文件已修改
48 ■■■■ 已修改文件
Core/NetworkPackage/DTCFile/ServerPack/HC0_CrossRealm/DTCC001_tagGCCrossRealmPKMatchOK.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/ServerPack/HC0_CrossRealm/HC001_tagGCCrossRealmPKMatchOK.cs 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Login/CrossServerLogin.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/NetworkPackage/DTCFile/ServerPack/HC0_CrossRealm/DTCC001_tagGCCrossRealmPKMatchOK.cs
@@ -12,7 +12,7 @@
        if (package.socketType == GameNetSystem.SocketType.Main)
        {
            CrossServerLogin.Instance.UpdateCrossServerOneVsOneData(package.PlayerName, package.TagPlayerName, package.TagJob);
            CrossServerLogin.Instance.UpdateCrossServerOneVsOneData(package.PlayerName);
        }
    }
Core/NetworkPackage/ServerPack/HC0_CrossRealm/HC001_tagGCCrossRealmPKMatchOK.cs
@@ -5,11 +5,11 @@
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()
    {
@@ -18,11 +18,31 @@
    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;        // 默认满血
    }
}
System/Login/CrossServerLogin.cs
@@ -39,17 +39,19 @@
        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), () =>
@@ -300,13 +302,17 @@
    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)
        {