// PRIVATE METHODS WeaponSettings ChooseWeapon(PlayerPersistantInfo ppi, out PPIWeaponData weaponData) { PPIInventoryList inventory = ppi.InventoryList; PPIEquipList equipList = ppi.EquipList; weaponData = GetFavourite <PPIWeaponData>(inventory.Weapons, (left, right) => { if (left.StatsFire > right.StatsFire) { return(-1); } if (left.StatsFire < right.StatsFire) { return(+1); } int leftIdx = equipList.Weapons.FindIndex((other) => { return(other.ID == left.ID); }); int rightIdx = equipList.Weapons.FindIndex((other) => { return(other.ID == right.ID); }); if (rightIdx != -1 && leftIdx > rightIdx || leftIdx != -1 && rightIdx == -1) { return(-1); } if (leftIdx != -1 && leftIdx < rightIdx || leftIdx == -1 && rightIdx != -1) { return(+1); } return(0); }); return(weaponData.ID != E_WeaponID.None ? WeaponSettingsManager.Instance.Get(weaponData.ID) : null); }
ItemSettings ChooseItem(PlayerPersistantInfo ppi) { PPIInventoryList inventory = ppi.InventoryList; PPIEquipList equipList = ppi.EquipList; PPIItemData favouriteItem = GetFavourite <PPIItemData>(inventory.Items, (left, right) => { if (left.StatsUseCount > right.StatsUseCount) { return(-1); } if (left.StatsUseCount < right.StatsUseCount) { return(+1); } int leftIdx = equipList.Items.FindIndex((other) => { return(other.ID == left.ID); }); int rightIdx = equipList.Items.FindIndex((other) => { return(other.ID == right.ID); }); if (rightIdx != -1 && leftIdx > rightIdx || leftIdx != -1 && rightIdx == -1) { return(-1); } if (leftIdx != -1 && leftIdx < rightIdx || leftIdx == -1 && rightIdx != -1) { return(+1); } return(0); }); return(favouriteItem.ID != E_ItemID.None ? ItemSettingsManager.Instance.Get(favouriteItem.ID) : null); }
public static object Deserialize(BitStream stream, params object[] args) { PPIInventoryList ppi = new PPIInventoryList(); ppi.Read(stream); return(ppi); }
public void Read(BitStream stream) { // Name = stream.Read<string>(); Params.Experience = stream.ReadInt32(); // Params.Rank = stream.ReadByte(); Params.Money = stream.ReadInt32(); Params.Gold = stream.ReadInt32(); InventoryList = stream.Read <PPIInventoryList>(); EquipList = stream.Read <PPIEquipList>(); Upgrades = stream.Read <PPIUpgradeList>(); // Statistic = stream.Read<PPIStatistic>(); // Score = stream.Read<PPIRoundScore>(); }
public static void Serialize(BitStream stream, object value, params object[] args) { PPIInventoryList ppi = (PPIInventoryList)value; ppi.Write(stream); }