コード例 #1
0
        public static BattleInstructionBase Deserializetion(byte[] byteArray, ref int index)
        {
            if (byteArray.Length < SelfSerializationByteLength)
            {
                return(null);
            }
            int sceneUnitId = SerializeUtils.ReadInt(byteArray, ref index);
            BattleInstructionType instructionType = (BattleInstructionType)SerializeUtils.ReadByte(byteArray, ref index);
            BattleInstructionBase ret             = null;

            switch (instructionType)
            {
            case BattleInstructionType.Move:
                ret = BattleMove.Deserialize(byteArray, ref index);
                break;

            case BattleInstructionType.StopMove:
                ret = BattleStopMove.Deserialize(byteArray, ref index);
                break;

            case BattleInstructionType.NoTargetSkill:
                ret = BattleNoTargetSkill.Deserialize(byteArray, ref index);
                break;

            case BattleInstructionType.UnitTargetSkill:
                ret = BattleUnitTargetSkill.Deserialize(byteArray, ref index);
                break;

            case BattleInstructionType.AreaTargetSkill:
                ret = BattleAreaTargetSkill.Deserialize(byteArray, ref index);
                break;

            default:

                break;
            }
            if (null != ret)
            {
                ret.SceneUnitId = sceneUnitId;
            }
            return(ret);
        }