/// <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 #2
0
    /// <summary>
    ///
    /// Refreshes the selected upgrade with a specific upgrade information
    ///
    /// </summary>
    public void RefreshSelectedUpgrade(UpgradeData _selectedUpgrade, bool isToAdd)
    {
        //If the upgrade has no id, then fills the selected upgrade with empty fields
        if (!_selectedUpgrade.Id.HasValue)
        {
            RefreshSelectedUpgrade();
        }
        else
        {
            //Set the fields speciifc to the selected upgrade
            selectedUpgrade      = _selectedUpgrade;
            selectedUpgradeToAdd = isToAdd;

            GameManager.DestroyAllChildren(upgradeDisplay);

            nameText.text         = selectedUpgrade.Name;
            honourPointsText.text = selectedUpgrade.HonourPoints.ToString();
            isRepeatableText.text = selectedUpgrade.IsRepeatableString();
            prerequisiteText.text = selectedUpgrade.PrerequisiteString();

            addButton.interactable    = true;
            cancelButton.interactable = true;

            //The text on the button will adapt depending on where the upgrade was selected from
            if (isToAdd)
            {
                UpdateSelectedUpgradeButtonText("Add");
            }
            else
            {
                UpdateSelectedUpgradeButtonText("Remove");
            }

            //Creates the upgrade display in the upgrade display area
            GameManager.instance.upgradeManager.CreateUpgrade(selectedUpgrade, upgradeDisplay.transform, selectedDeck);
        }
    }