public void RPC_UpdateRoleComValue(ulong roleId, string name, RPC.DataReader value) { var role = GetRole(roleId); if (role == null) { return; } switch (name) { case "RoleLevel": { role.RoleData.Level = value.ReadUInt16(); } break; case "Camp": { role.RoleData.Camp = value.ReadByte(); } break; case "Profession": { role.RoleData.Profession = value.ReadByte(); } break; case "PlanesId": { role.RoleData.PlanesId = value.ReadUInt16(); } break; } }
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; } } }
//--------------------------------------数据存取--------------------------------------------------------- //初始化数据库数据 public void MartialUnSerialize(PlayerInstance role, byte[] buffer) { mRole = role; 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++) { byte type = dr.ReadByte(); BuildOutPut output = new BuildOutPut(type); output.mStartTime = dr.ReadDateTime(); output.mOutCount = dr.ReadByte(); output.mUpOutIndex = dr.ReadSByte(); output.mUpStartTime = dr.ReadDateTime(); output.mOutPutTotalNum = dr.ReadInt32(); AddOutPut(output, false); } InitOutData(); }
//初始化数据库数据 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); } }
public void AchieveUnSerialize(byte[] buffer) { AcceptAchieveDict.Clear(); if (buffer == null || buffer.Length <= 0) { return; } RPC.DataReader dr = new RPC.DataReader(buffer, 0, buffer.Length, buffer.Length); int count = dr.ReadInt32(); for (int i = 0; i < count; i++) { AcceptAchieveData data = new AcceptAchieveData(); data.id = dr.ReadInt32(); data.targetNum = dr.ReadInt32(); data.getReward = dr.ReadByte(); AcceptAchieveDict[data.id] = data; } }
public void RPC_UpdateRankDataValue(ulong roleId, string name, RPC.DataReader value) { RankData rank = GetRank(roleId); if (rank == null) { return; } switch (name) { case "RoleLevel": rank.Level = value.ReadUInt16(); break; case "Fighting": rank.Fighting = value.ReadInt32(); break; case "Exploit": rank.Exploit = value.ReadInt32(); break; case "ExploitBox": rank.ExploitBox = value.ReadByte(); break; case "KillEnemy": rank.KillEnemy = value.ReadInt32(); break; case "Challenge": rank.Challenge = value.ReadInt32(); break; } UPdateRankData(rank); }