public static BattleUnitTargetSkill Deserialize(byte[] data, ref int index) { short skillId = SerializeUtils.ReadShort(data, ref index); int targetUnitId = SerializeUtils.ReadInt(data, ref index); return(new BattleUnitTargetSkill(targetUnitId, skillId)); }
public static RpEnterScene Deserialization(Dictionary <byte, object> parameters) { object byteArrayObj = null; if (!parameters.TryGetValue(1, out byteArrayObj)) { return(null); } if (byteArrayObj.GetType() != typeof(byte[])) { return(null); } byte[] byteArray = byteArrayObj as byte[]; if (byteArray.Length < 2) { return(null); } int index = 0; short count = SerializeUtils.ReadShort(byteArray, ref index); if (count * 4 + index != byteArray.Length) { return(null); } int[] sceneUnits = new int[count]; for (int i = 0; i < count; ++i) { sceneUnits[i] = SerializeUtils.ReadInt(byteArray, ref index); } return(new RpEnterScene(sceneUnits)); }
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 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); }
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); }