public void SetFriendData(HeroPropInfo h0, int type) { IsFriend = true; TheType = type; FriendHeroData = h0; Attrack = 0; Hp = 0; Recover = 0; Mp = 0; if (FriendHeroData != null) { HeroTemp = HeroModelLocator.Instance.GetHeroByTemplateId(FriendHeroData.HeroTemplateId); if (FriendHeroData.Prop.ContainsKey(RoleProperties.ROLE_ATK)) { Attrack += FriendHeroData.Prop[RoleProperties.ROLE_ATK]; } if (FriendHeroData.Prop.ContainsKey(RoleProperties.ROLE_HP)) { Hp += FriendHeroData.Prop[RoleProperties.ROLE_HP]; } if (FriendHeroData.Prop.ContainsKey(RoleProperties.ROLE_RECOVER)) { Recover += FriendHeroData.Prop[RoleProperties.ROLE_RECOVER]; } if (FriendHeroData.Prop.ContainsKey(RoleProperties.ROLE_MP)) { Mp += FriendHeroData.Prop[RoleProperties.ROLE_MP]; } } SetContent(); }
/// <summary> /// Read this whole class from string. /// </summary> /// <param name="value"></param> public void ReadClass(string value) { string[] splitStrings = new string[] { BasicName, HeroPropListName, ISSetName }; string[] outStrings = value.Split(splitStrings,StringSplitOptions.RemoveEmptyEntries); PersistenceFileIOHandler.CheckCount(outStrings,FieldCount); string[] splitedBasic = outStrings[0].Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); PersistenceFileIOHandler.CheckCount(splitedBasic, BasicFieldCount); FriendUuid = long.Parse(splitedBasic[0]); FriendName = splitedBasic[1]; FriendLvl = int.Parse(splitedBasic[2]); FriendFamous = int.Parse(splitedBasic[3]); LastLoginTime = long.Parse(splitedBasic[4]); GiveEnergyTime = long.Parse(splitedBasic[5]); Status = sbyte.Parse(splitedBasic[6]); RaidStageId = int.Parse(splitedBasic[7]); MaxDamage = int.Parse(splitedBasic[8]); string[] splitedHeroProp = outStrings[1].Split(new string[] { "HePr:" }, StringSplitOptions.RemoveEmptyEntries); HeroProp=new List<HeroPropInfo>(); for (int i = 0; i < splitedHeroProp.Length; i++) { var temp = new HeroPropInfo(); temp.ReadClass(splitedHeroProp[i]); HeroProp.Add(temp); } string[] splitedISet = outStrings[2].Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); PersistenceFileIOHandler.CheckCount(splitedISet, IsSetCount); __isset.friendUuid = bool.Parse(splitedISet[0]); __isset.friendName = bool.Parse(splitedISet[1]); __isset.friendLvl = bool.Parse(splitedISet[2]); __isset.friendFamous = bool.Parse(splitedISet[3]); __isset.heroProp = bool.Parse(splitedISet[4]); __isset.lastLoginTime = bool.Parse(splitedISet[5]); __isset.giveEnergyTime = bool.Parse(splitedISet[6]); __isset.status = bool.Parse(splitedISet[7]); __isset.raidStageId = bool.Parse(splitedISet[8]); __isset.maxDamage = bool.Parse(splitedISet[9]); }
public void Read(TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I64) { FriendUuid = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { FriendName = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { FriendLvl = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { FriendFamous = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.List) { { HeroProp = new List<HeroPropInfo>(); TList _list5 = iprot.ReadListBegin(); for (int _i6 = 0; _i6 < _list5.Count; ++_i6) { HeroPropInfo _elem7 = new HeroPropInfo(); _elem7 = new HeroPropInfo(); _elem7.Read(iprot); HeroProp.Add(_elem7); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.I64) { LastLoginTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.I64) { GiveEnergyTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Byte) { Status = iprot.ReadByte(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.I32) { RaidStageId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.I32) { MaxDamage = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }