示例#1
0
        public static void setupUI()
        {
            hasListChanged = true;
            Transform gmb = GuiManager.instance.resetGuildWindow.transform.GetChild(1).Find("CurrentMaster");

            gmb.GetChild(0).GetComponent <Text>().text = "";
            gmb.GetChild(1).GetComponent <Text>().text = Main.instance.player.currentGuildmaster.getDisplay();
            for (int i = 0; i < availableMasters.Length; i++)
            {
                gmb = GuiManager.instance.resetGuildWindow.transform.GetChild(1).Find("Guildmaster" + (i + 1));
                gmb.GetChild(0).GetComponent <Text>().text = "";
                gmb.GetChild(1).GetComponent <Text>().text = availableMasters[i].getDisplay();
            }
            GuiManager.instance.guildmasterArea.transform.Find("BuyOne").GetComponent <Button>().interactable = Main.instance.player.totalRenown >= 100000;
            GuiManager.instance.guildmasterArea.transform.Find("OwnedTxt").GetComponent <Text>().text         = Main.instance.player.currentGuildmaster.getDisplay();
            GuiManager.instance.guildArea.transform.Find("SkillPanel").Find("Skills").gameObject.SetActive(Main.instance.player.totalSkillPoints > 0);
            skillDisp.transform.parent.gameObject.SetActive(Main.instance.player.totalSkillPoints > 0);
            skillDisp.text = Main.AsCurrency(Main.instance.player.skillPoints);

            IEnumerator <Skill> list            = SkillList.getSkillList();
            Transform           skillListParent = GuiManager.instance.skillPanel.transform;

            while (list.MoveNext())
            {
                Skill      sk = list.Current;
                GameObject go = sk.guiItem;
                go.transform.Find("Ranks").GetComponent <Text>().text = "" + sk.getRanks();
            }
            if (hasBeenSetup)
            {
                List <Upgrade> upgrades = PremiumUpgrades.AllPremiumUps;
                foreach (Upgrade item in upgrades)
                {
                    Transform t1 = item.upgradListGui.transform.Find("BuyOne");
                    item.upgradListGui.transform.Find("Label").GetComponent <Text>().text = (item.getIsPurchased() ? "Purchased!" : "");
                    t1.gameObject.SetActive(!item.getIsPurchased());
                }
            }
            else
            {
                PremiumSetup(100, "$", "", false);
            }
        }
示例#2
0
        public static void OneTimeSetup()
        {
            moneyDisp  = GuiManager.instance.guildHeader.transform.Find("MoneyArea").GetChild(0).GetComponent <Text>();
            renownDisp = GuiManager.instance.guildHeader.transform.Find("GuildRenownArea").GetChild(0).GetComponent <Text>();
            Transform t = GuiManager.instance.guildHeader.transform.Find("RenownOnReset");

            newRenownDisp = t.GetChild(0).GetComponent <Text>();
            t.GetComponent <Button>().AddHover(delegate(Vector3 p) {
                /*BigInteger spentRenown = Main.instance.player.totalRenown - Main.instance.player.renown;
                 * BigInteger totalRenown = BigInteger.CubeRoot(Main.instance.player.lifetimeMoney);
                 * totalRenown /= 10000;
                 * BigInteger renown = totalRenown - spentRenown;*/
                BigInteger renown = Main.instance.getCachedNewRenown();

                GuiManager.ShowTooltip(p, "Renown from cash earned: " + Main.AsCurrency(renown) + RENOWN_SYMBOL + "\nRenown from completed quests: " + Main.AsCurrency(Main.instance.player.questsCompletedRenown) + RENOWN_SYMBOL, 5f);
            });
            skillDisp  = GuiManager.instance.guildHeader.transform.Find("SkillPts").GetChild(0).GetComponent <Text>();
            cashList   = GuiManager.instance.guildArea.transform.Find("CashUpgrades").GetChild(0).GetChild(0);
            renownList = GuiManager.instance.guildArea.transform.Find("RenownUpgrades").GetChild(0).GetChild(0);
            Transform tr = GuiManager.instance.guildArea.transform.Find("PremiumOpenAera");

            tr.gameObject.AddComponent <Button>().onClick.AddListener(delegate { HidePremium(); });
            premiumList = tr.GetChild(0).GetChild(1).GetChild(0).GetChild(0);
            GuiManager.instance.guildArea.transform.Find("PremiumBtn").GetComponent <Button>().onClick.AddListener(delegate { ShowPremium(); });
            buyVendTxt = GuiManager.instance.buyVendorsArea.transform.Find("BuyOne").GetChild(0).GetComponent <Text>();
            buyAppTxt  = GuiManager.instance.buyApprenticesArea.transform.Find("BuyOne").GetChild(0).GetComponent <Text>();
            buyJourTxt = GuiManager.instance.buyJourneymenArea.transform.Find("BuyOne").GetChild(0).GetComponent <Text>();

            numVend1 = GuiManager.instance.buyVendorsArea.transform.Find("OwnedTxt").GetComponent <Text>();
            numVend2 = GuiManager.instance.buyVendorsArea.transform.Find("AvailableTxt").GetComponent <Text>();
            numApp1  = GuiManager.instance.buyApprenticesArea.transform.Find("OwnedTxt").GetComponent <Text>();
            numApp2  = GuiManager.instance.buyApprenticesArea.transform.Find("AvailableTxt").GetComponent <Text>();
            numJour1 = GuiManager.instance.buyJourneymenArea.transform.Find("OwnedTxt").GetComponent <Text>();
            //numJour2 = GuiManager.instance.buyJourneymenArea.transform.FindChild("AvailableTxt").GetComponent<Text>();

            vendeffTxt = GuiManager.instance.buyVendorsArea.transform.Find("EffectivenessTxt").GetComponent <Text>();           //.text = Mathf.RoundToInt(Main.instance.player.GetVendorValue()*100) + "%";
            appeffTxt  = GuiManager.instance.buyApprenticesArea.transform.Find("EffectivenessTxt").GetComponent <Text>();       //.text = Main.instance.GetClickRate() + "sec / sec";
            joureffTxt = GuiManager.instance.buyJourneymenArea.transform.Find("EffectivenessTxt").GetComponent <Text>();        //.text = Main.instance.GetClickRate() + "sec / sec";

            int            i        = 0;
            List <Upgrade> upgrades = Upgrades.AllCashUps;

            cashList.transform.hierarchyCapacity = (upgrades.Count + 1) * 5 + 1350;
            foreach (Upgrade item in upgrades)
            {
                GameObject it = Main.Instantiate(PrefabManager.instance.UPGRADE_GUI_LISTITEM, cashList) as GameObject;
                item.upgradListGui = it;
                cashUpgradeList.Add(item);
                it.name = item.displayName;
                it.transform.localPosition = new Vector3(6, i * -100 - 5, 0);

                it.transform.Find("Title").GetComponent <Text>().text  = Main.ToTitleCase(item.displayName);
                it.transform.Find("Cost").GetComponent <Text>().text   = "$" + Main.AsCurrency(item.cost);
                it.transform.Find("Img").GetComponent <Image>().sprite = SpriteLoader.getSpriteForResource("items/" + item.getIconName());
                Upgrade _item = item;
                Button  btn   = it.GetComponent <Button>();
                btn.onClick.AddListener(delegate { buyUpgrade(_item); });
                if (item.cost > Main.instance.player.money)
                {
                    btn.interactable = false;
                }
                Upgrade up = item;
                btn.AddHover(delegate(Vector3 p) { GuiManager.ShowTooltip(btn.transform.position + Vector3.right * 90 + Vector3.down * 45, up.getTooltip(), 4f); }, false);

                i++;
            }
            ((RectTransform)cashList).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (i * 100 + 10));
            cashList.localPosition = Vector3.zero;

            i        = 0;
            upgrades = Upgrades.AllRenownUps;
            renownList.transform.hierarchyCapacity = (upgrades.Count + 1) * 5 + 1375;
            foreach (Upgrade item in upgrades)
            {
                GameObject it = Main.Instantiate(PrefabManager.instance.UPGRADE_GUI_LISTITEM, renownList) as GameObject;
                item.upgradListGui = it;
                renownUpgradeList.Add(item);
                it.name = item.displayName;
                it.transform.localPosition = new Vector3(6, i * -100 - 5, 0);

                it.transform.Find("Title").GetComponent <Text>().text  = Main.ToTitleCase(item.displayName);
                it.transform.Find("Cost").GetComponent <Text>().text   = Main.AsCurrency(item.cost) + RENOWN_SYMBOL;
                it.transform.Find("Img").GetComponent <Image>().sprite = SpriteLoader.getSpriteForResource("items/" + item.getIconName());
                Upgrade _item = item;
                Button  btn   = it.GetComponent <Button>();
                btn.onClick.AddListener(delegate { buyUpgradeRenown(_item); });
                if (item.cost > Main.instance.player.renown)
                {
                    btn.interactable = false;
                }
                Upgrade up = item;
                btn.AddHover(delegate(Vector3 p) { GuiManager.ShowTooltip(btn.transform.position + Vector3.right * 90 + Vector3.down * 45, up.getTooltip(), 4f); }, false);

                i++;
            }
            ((RectTransform)renownList).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (i * 100 + 10));
            renownList.localPosition = Vector3.zero;

            lastMoney = Main.instance.player.money;

            Button btn2 = GuiManager.instance.guildmasterArea.transform.Find("BuyOne").GetComponent <Button>();

            btn2.onClick.AddListener(delegate {
                if (Main.instance.player.totalRenown >= 100000)
                {
                    NewGuildmaster();
                }
            });
            btn2.AddHover(delegate(Vector3 p) {
                if (Main.instance.player.totalRenown < 100000)
                {
                    GuiManager.ShowTooltip(btn2.transform.position + Vector3.up * 60, "You need to have earned at least 100,000 renown to attract a new guildmaster.", 2.3f);
                }
            });

            int pts = 15 + SkillList.GuildmasterRating.getMultiplier();

            availableMasters[0] = Master.createRandomMaster(pts);
            availableMasters[1] = Master.createRandomMaster(pts);
            availableMasters[2] = Master.createRandomMaster(pts);

            for (int j = 1; j < availableMasters.Length + 1; j++)
            {
                Transform gmb = GuiManager.instance.resetGuildWindow.transform.GetChild(1).Find("Guildmaster" + j);
                int       q   = j - 1;
                gmb.GetComponent <Button>().onClick.AddListener(delegate { electGuildmaster(availableMasters[q]); });
            }

            i = 0;
            IEnumerator <Skill> list            = SkillList.getSkillList();
            Transform           skillListParent = GuiManager.instance.skillPanel.transform;

            while (list.MoveNext())
            {
                Skill      sk = list.Current;
                GameObject go = Main.Instantiate(PrefabManager.instance.SKILL_LISTITEM, skillListParent) as GameObject;
                sk.guiItem = go;
                go.transform.localPosition = new Vector3(5, i * -110 - 5, 5);
                ((RectTransform)go.transform).anchorMax = new Vector2(1, 1);
                ((RectTransform)go.transform).offsetMax = new Vector2(-3, ((RectTransform)go.transform).offsetMax.y);
                go.transform.Find("Name").GetComponent <Text>().text        = Localization.translateToLocal(sk.name);
                go.transform.Find("Description").GetComponent <Text>().text = string.Format(Localization.translateToLocal(sk.description), sk.getMultiplierForDisplay());
                go.transform.Find("Ranks").GetComponent <Text>().text       = "" + sk.getRanks();
                Transform t1 = go.transform.Find("BuyOne");
                t1.GetComponent <Button>().onClick.AddListener(delegate {
                    doBuySkill(sk);
                });
                t1.GetChild(0).GetComponent <Text>().text = Main.AsCurrency(sk.getCost(1)) + " pts";
                i++;
            }
            ((RectTransform)skillListParent).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (i * 110 + 10));
            renownList.localPosition = Vector3.zero;
            GuiManager.instance.resetGuildWindow.transform.GetChild(1).Find("CloseBtn").GetComponent <Button>().onClick.AddListener(closeNewGuildmaster);
            GuiManager.instance.resetGuildWindow.transform.GetChild(1).Find("CurrentMaster").GetComponent <Button>().onClick.AddListener(closeNewGuildmaster);
        }