Exemple #1
0
    public void EnablePanel(string panelName)
    {
        foreach (GameObject go in panels)
        {
            if (go.activeSelf)
            {
                go.GetComponent <PanelBounce>().Close();
                go.SetActive(false);
                if (go.transform.Find("Info Button/Info Panel") != null && go.transform.Find("Info Button/Info Panel").gameObject.activeSelf)
                {
                    go.transform.Find("Info Button/Info Panel").gameObject.SetActive(false);
                }
            }
        }

        if (panelName == "Stats Panel")
        {
            UpdateBars();
            ageText.GetComponent <TextMeshProUGUI>().text = GetAgeOfDoug();
        }

        if (panelName == "Store Panel")
        {
            WallpaperNum currentWallpaper = PersistentGameManager.instance.playerData.playerData.unlockedWallpaper;
            float        nextCost         = (currentWallpaper < WallpaperNumMethods.getMaxPurchasableWallpaperNum()) ? GlobalConfig.wallpaperCosts[currentWallpaper + 1] : 0;

            buyText.GetComponent <TextMeshProUGUI>().color =
                (PersistentGameManager.instance.playerData.playerData.coinz >= ((currentWallpaper < WallpaperNumMethods.getMaxPurchasableWallpaperNum()) ? GlobalConfig.wallpaperCosts[currentWallpaper + 1] : 0))
                ? GlobalConfig.textColor : GlobalConfig.disabledTextColor;

            string t = "buy {0}:\n{1} coinz";

            if ((int)currentWallpaper < (int)WallpaperNumMethods.getMaxPurchasableWallpaperNum())
            {
                t = t.Replace("{0}", GlobalConfig.wallpaperNames[(int)currentWallpaper + 1]);
            }
            else
            {
                t = "all wallpapers have been bought!";
            }
            t = t.Replace("{1}", ClickerManager.ConvertToShortNumber(nextCost));

            buyText.GetComponent <TextMeshProUGUI>().text = t;
        }

        foreach (GameObject go in panels)
        {
            if (go.name == panelName)
            {
                go.SetActive(true);
            }
        }
    }
Exemple #2
0
    public void unlockWallpaper()
    {
        WallpaperNum currentWallpaper = PersistentGameManager.instance.playerData.playerData.unlockedWallpaper;
        float        nextCost         = (currentWallpaper < WallpaperNumMethods.getMaxPurchasableWallpaperNum()) ? GlobalConfig.wallpaperCosts[currentWallpaper + 1] : 0;

        if (currentWallpaper != WallpaperNumMethods.getMaxPurchasableWallpaperNum() && PersistentGameManager.instance.playerData.playerData.coinz >= nextCost)
        {
            PersistentGameManager.instance.playerData.playerData.unlockedWallpaper++;
            PersistentGameManager.instance.playerData.playerData.coinz -= nextCost;
            PersistentGameManager.instance.SaveGame();
            PersistentGameManager.instance.playerData.playerData.currentWallpaper = PersistentGameManager.instance.playerData.playerData.unlockedWallpaper;
            PersistentGameManager.instance.ChangeWallpaper((int)PersistentGameManager.instance.playerData.playerData.currentWallpaper);
            MakePopup("wallpaper unlocked!");
            DisablePanel("Store Panel");
            UpdateWallpaperButtons();
        }
    }