예제 #1
0
        public static object Deserialize(byte[] data)
        {
            int          index       = 0;
            int          accountId   = SerializeUtils.ReadInt(data, ref index);
            string       accountName = SerializeUtils.ReadString(data, ref index);
            bool         isReady     = SerializeUtils.ReadBool(data, ref index);
            RpPlayerData rpData      = new RpPlayerData(accountId, accountName, isReady);

            return(rpData);
        }
        public static RpBattleInstructionList Deserialization(Dictionary <byte, object> parameters)
        {
            byte[] byteArray = parameters[1] as byte[];
            if (byteArray == null || byteArray.Length < 7)
            {
                return(null);
            }

            List <BattleInstructionBase> instructionList = new List <BattleInstructionBase>();

            int   index            = 0;
            int   frameCount       = SerializeUtils.ReadInt(byteArray, ref index);
            short instructionCount = SerializeUtils.ReadShort(byteArray, ref index);
            bool  isFrameFinish    = SerializeUtils.ReadBool(byteArray, ref index);

            RpBattleInstructionList retBattleInstruction = new RpBattleInstructionList(frameCount, instructionList, isFrameFinish);

            for (int i = 0; i < instructionCount; ++i)
            {
                BattleInstructionBase instruction = BattleInstructionBase.Deserializetion(byteArray, ref index);
                instructionList.Add(instruction);
            }
            return(retBattleInstruction);
        }