public override void Parse(BinaryReader reader) { _uid = reader.ReadInt32(); _nickname = NetResponse.ReadString(reader); _role = (EnumRole)reader.ReadByte(); byte propNum = reader.ReadByte(); for (int key = 0; key < propNum; ++key) { int value = reader.ReadInt32(); float floatvalue = value / (FCConst.PropFactor((PlayerPropKey)key) * 1.0f); _props.Add((PlayerPropKey)key, floatvalue); } byte propBattleNum = reader.ReadByte(); for (int key = 32; key < 32 + propBattleNum; ++key) { int value = reader.ReadInt32(); float floatValue = value / (FCConst.PropFactor((PlayerPropKey)key) * 1.0f); _props.Add((PlayerPropKey)key, floatValue); } _equippedInventory = new PlayerInventory(); _equippedInventory.Parse(reader); }
public void ApplyPlayerPropChanges(PlayerProp[] props) { foreach (PlayerProp prop in props) { float floatvalue = prop.Value / (FCConst.PropFactor((PlayerPropKey)prop.Key) * 1.0f); _props[prop.Key] = floatvalue; if (prop.Key == PlayerPropKey.HardCurrency && onHardCurrencyChanged != null) { onHardCurrencyChanged(HardCurrency); } else if (prop.Key == PlayerPropKey.SoftCurrency && onSoftCurrencyChanged != null) { onSoftCurrencyChanged(SoftCurrency); } else if (prop.Key == PlayerPropKey.Vitality && onVitalityChanged != null) { onVitalityChanged(); } } }