Ejemplo n.º 1
0
    /// <summary>
    ///
    /// Button click event for when the add/remove button. Checks whether the selected upgrade is added or removed from the upgrades to add list
    ///
    /// </summary>
    public void UpdateSelectedUpgradeState()
    {
        var hideTierUpgrades = false;

        //Adds or removes the upgrade from the upgrade to add list depending on where the upgrade came from
        if (selectedUpgradeToAdd)
        {
            upgradesToAdd.Add(selectedUpgrade);
            newDeck.AddUpgrade(selectedUpgrade, false);

            if (campaignManagerUI != null)
            {
                var honourPoints = selectedUpgrade.GetHonourPointsCost(newDeck.CampaignTracker.CompletedSinceTierUpgrade);
                if (upgradeCostTracker.ContainsKey(selectedUpgrade))
                {
                    upgradeCostTracker[selectedUpgrade] += honourPoints;
                }
                else
                {
                    upgradeCostTracker.Add(selectedUpgrade, honourPoints);
                }
                RefreshHonourPoints();
            }
        }
        else
        {
            RemoveUpgradeFromAddList(selectedUpgrade);
        }

        hideTierUpgrades = campaignManagerUI != null && upgradesToAdd.Any(x => x.IsTierLevel);

        //Refresh the upgrade lists
        RefreshAvailableUpgrades(hideTierUpgrades);
        RefreshUpgradeList(upgradesToAddArea, false, new List <UpgradeData>(upgradesToAdd));

        //Empties the selected ugprade fields
        RefreshSelectedUpgrade();
    }