コード例 #1
0
ファイル: WorldManager.cs プロジェクト: 372285834/GServer
        public void DeserializeArms(byte[] buffer)
        {
            HoldPoints.Clear();

            RPC.DataReader dr    = new RPC.DataReader(buffer, 0, buffer.Length, buffer.Length);
            var            count = dr.ReadByte();

            for (int i = 0; i < count; i++)
            {
                var hold = new HoldPoint();
                HoldPoints.Add(hold);
                hold.ArmsCount = dr.ReadUInt32();
                hold.Camp      = (CSCommon.eCamp)dr.ReadByte();
            }
            count = dr.ReadByte();
            for (int i = 0; i < count; i++)
            {
                var val = dr.ReadUInt64();
                if (i < Defender.Length)
                {
                    Defender[i] = val;
                }
            }
            count = dr.ReadByte();
            for (int i = 0; i < count; i++)
            {
                var val = dr.ReadUInt32();
                if (i < AdvanceArms.Length)
                {
                    AdvanceArms[i] = val;
                }
            }
        }
コード例 #2
0
        //初始化数据库数据
        public void VisitDataUnSerialize()
        {
            byte[] buffer = RoleData.VisitPlayers;
            VisitTopList.Clear();
            VisitFriendList.Clear();
            if (buffer == null || buffer.Length <= 0)
            {
                return;
            }
            RPC.DataReader dr    = new RPC.DataReader(buffer, 0, buffer.Length, buffer.Length);
            byte           count = dr.ReadByte();

            for (byte i = 0; i < count; i++)
            {
                ulong id = dr.ReadUInt64();
                VisitTopList.Add(id);
            }
            count = dr.ReadByte();
            for (byte i = 0; i < count; i++)
            {
                ulong id = dr.ReadUInt64();
                VisitFriendList.Add(id);
            }
        }