Esempio n. 1
0
    public void updateUI()
    {
        // Set upgrade text
        upgradeNameText.text = Defs.Instance.engineUpgradesNames[upgrade];

        // Set buy text and button state
        buyText.text = "$" + buyPrice;
        if (activeNodeScript.getActive() && !PlayerCargo.Instance.PlayerHasUpgrade(upgrade) && !TimeCounter.Instance.gameOver)
        {
            buyButton.interactable = true;
        }
        else
        {
            buyButton.interactable = false;
        }
    }
Esempio n. 2
0
    public void updateUI()
    {
        goodText.text = Defs.Instance.goodNames[myGood];
        buyText.text  = buyQuantity + " - B - $" + buyPrice;
        sellText.text = sellQuantity + " - S - $" + sellPrice;

        //Only activate trade UI on active node
        if (activeNodeScript.getActive())
        {
            int playerCash = PlayerMoney.Instance.GetPlayerCash();

            // Set buy button state
            if (buyQuantity > 0 && !PlayerCargo.Instance.IsCargoFull() && playerCash >= buyPrice && !TimeCounter.Instance.gameOver)
            {
                buyButton.interactable = true;
            }
            else
            {
                buyButton.interactable = false;
            }

            // Set sell button state
            if (sellQuantity > 0 && PlayerCargo.Instance.HasGood(myGood) && !TimeCounter.Instance.gameOver)
            {
                sellButton.interactable = true;
            }
            else
            {
                sellButton.interactable = false;
            }
        }
        else
        {
            buyButton.interactable  = false;
            sellButton.interactable = false;
        }
    }