コード例 #1
0
ファイル: GameManager.cs プロジェクト: Maareks/Endless-Cat
        public void SelectCharacter(int character)
        {
            int characterCost = dataManager.GetCharacterCost(character);

            if (characterCost == -1)   // can only select a character if it has been purchased
            {
                if (dataManager.GetSelectedCharacter() != character)
                {
                    dataManager.SetSelectedCharacter(character);
                }
            }
        }
コード例 #2
0
ファイル: GUIManager.cs プロジェクト: jedisongoku/SpaceRunner
        // something has changed (item change, purchase, etc). Need to refresh the gui text
        public void RefreshStoreGUI()
        {
            int cost = -1;

            if (storeSelectingPowerUp)
            {
                PowerUpTypes powerUp = (PowerUpTypes)storeItemIndex;
                cost = dataManager.GetPowerUpCost(powerUp);
                storeBuyButton.SetActive(cost != -1);

                if (useuGUI)
                {
                    storeTitleText.text                  = dataManager.GetPowerUpTitle(powerUp);
                    storeDescriptionText.text            = dataManager.GetPowerUpDescription(powerUp);
                    storePowerUpSelectionButtonText.text = "Characters";
                }
                else
                {
#if COMPILE_NGUI
                    storeTitle.text                  = dataManager.GetPowerUpTitle(powerUp);
                    storeDescription.text            = dataManager.GetPowerUpDescription(powerUp);
                    storePowerUpSelectionButton.text = "Characters";
#endif
                }
            }
            else     // characters
            {
                cost = dataManager.GetCharacterCost(storeItemIndex);
                storeBuyButton.SetActive(cost != -1);

                if (useuGUI)
                {
                    storeTitleText.text                  = dataManager.GetCharacterTitle(storeItemIndex);
                    storeDescriptionText.text            = dataManager.GetCharacterDescription(storeItemIndex);
                    storePowerUpSelectionButtonText.text = "Power Ups";
                }
                else
                {
#if COMPILE_NGUI
                    storeTitle.text                  = dataManager.GetCharacterTitle(storeItemIndex);
                    storeDescription.text            = dataManager.GetCharacterDescription(storeItemIndex);
                    storePowerUpSelectionButton.text = "Power Ups";
#endif
                }
            }

            if (useuGUI)
            {
                storeCoinsText.text = string.Format("{0}  ({1} Coins Available)", (cost == -1 ? "Purchased" : string.Format("Cost: {0}", cost.ToString())), dataManager.GetTotalCoins(true));
            }
            else
            {
#if COMPILE_NGUI
                storeCoins.text = string.Format("{0}  ({1} Coins Available)", (cost == -1 ? "Purchased" : string.Format("Cost: {0}", cost.ToString())), dataManager.GetTotalCoins(true));
#endif
            }
        }