/// <summary>
    ///
    /// Initialise the upgrade list object. Updates the text properties of the object
    ///
    /// </summary>
    public void InitUpgradeListObject(UpgradeData _upgradeData, UpgradeUI _upgradeUI, DeckData _currentDeck, bool _isToAdd, int completedScenarios = 0)
    {
        upgradeData = _upgradeData;
        upgradeUI   = _upgradeUI;
        currentDeck = _currentDeck;
        isToAdd     = _isToAdd;

        upgradeNameText.text  = _upgradeData.Name;
        honourPointsText.text = _upgradeData.GetHonourPointsCost(completedScenarios).ToString();
        if (completedScenarios > 0)
        {
            honourPointsText.color = GameManager.instance.colourManager.GetStatModColour(StatisticStatuses.Buffed);
        }
    }
    /// <summary>
    ///
    /// Initialise the display. This is for properties which should not reset during the game
    ///
    /// </summary>
    public void InitDisplay(UpgradeData _upgradeData, DeckData _currentDeck)
    {
        upgradeData = _upgradeData;
        currentDeck = _currentDeck;

        upgradeName.text          = upgradeData.Name;
        upgradePrerequisites.text = $"Prerequisites: {upgradeData.PrerequisiteString()}";
        var honourPointMod = currentDeck != null && currentDeck.IsCampaign && upgradeData.IsTierLevel ? currentDeck.CampaignTracker.CompletedSinceTierUpgrade : 0;
        var colourTag      = honourPointMod > 0 ? GameManager.instance.colourManager.GetStatModColour(StatisticStatuses.Buffed, true).ConvertToHexadecimal() : "";

        honourPoints.text = $"Honour: {colourTag}{upgradeData.GetHonourPointsCost(honourPointMod)}";
        isRepeatable.text = $"Repeatable: {upgradeData.IsRepeatableString()}";
        upgradeText.text  = upgradeData.Text;

        upgradeImage.sprite = GameManager.instance.imageManager.GetUpgradeImage(upgradeData.ImageTag);
    }
Example #3
0
    /// <summary>
    ///
    /// Adds an upgrade to the deck
    ///
    /// </summary>
    public void AddUpgrade(UpgradeData upgradeData, bool trackAddition = true)
    {
        UpgradeList.Add(upgradeData);
        UpgradeIdList.Add(upgradeData.Id.Value);
        GameManager.instance.upgradeManager.UpdateUpgradeEffect(upgradeData, this);

        if (IsCampaign)
        {
            if (trackAddition)
            {
                CampaignTracker.HonourPoints -= upgradeData.GetHonourPointsCost(CampaignTracker.CompletedSinceTierUpgrade);
                if (upgradeData.IsTierLevel)
                {
                    CampaignTracker.CompletedSinceTierUpgrade = 0;
                }
            }
        }
    }
Example #4
0
    private void RemoveUpgradeFromAddList(UpgradeData upgrade)
    {
        upgradesToAdd.Remove(upgrade);
        newDeck.RemoveUpgrade(upgrade);

        RemoveUpgradePrerequisites(upgrade);

        if (campaignManagerUI != null)
        {
            if (upgradesToAdd.Any(x => x.Id == upgrade.Id))
            {
                upgradeCostTracker[upgrade] -= upgrade.GetHonourPointsCost(newDeck.CampaignTracker.CompletedSinceTierUpgrade);
            }
            else
            {
                upgradeCostTracker.Remove(upgrade);
            }

            RefreshHonourPoints();
        }
    }
Example #5
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();
    }