Esempio n. 1
0
        private void RefreshUI()
        {
            foreach (Transform child in listRoot)
            {
                Destroy(child.gameObject);
            }

            foreach (ShopItem item in currentShop.GetFilteredItems())
            {
                RowUI row = Instantiate <RowUI>(rowPrefab, listRoot);
                row.Setup(currentShop, item);
            }

            totalField.text            = $"Total: ${currentShop.TransactionTotal():N2}";
            totalField.color           = currentShop.HasSufficientFunds() ? originalTotalTextColor : Color.red;
            confirmButton.interactable = currentShop.CanTransact();
            TextMeshProUGUI switchText  = switchButton.GetComponentInChildren <TextMeshProUGUI>();
            TextMeshProUGUI confirmText = confirmButton.GetComponentInChildren <TextMeshProUGUI>();

            if (currentShop.IsBuyingMode())
            {
                switchText.text  = "Switch To Selling";
                confirmText.text = "Buy";
            }
            else
            {
                switchText.text  = "Switch To Buying";
                confirmText.text = "Sell";
            }

            foreach (FilterButtonUI button in GetComponentsInChildren <FilterButtonUI>())
            {
                button.RefreshUI();
            }
        }
Esempio n. 2
0
        private void RefreshUI()
        {
            foreach (Transform child in listRoot)
            {
                Destroy(child.gameObject);
            }

            foreach (ShopItem item in currentShop.GetFilteredItems())
            {
                RowUI row = Instantiate <RowUI>(rowPrefab, listRoot);
                row.Setup(currentShop, item);
            }

            totalField.text = $"Total: ${currentShop.TransactionTotal():N2}";
        }