private void ShowBuyCreations()
        {
            GUIStyle style  = GUI.skin.GetStyle("TextField");
            GUIStyle style2 = GUI.skin.GetStyle("Label");
            GUIStyle style3 = GUI.skin.GetStyle("Button");

            style.fontSize  = GuiBase.FontSize(16);
            style3.fontSize = GuiBase.FontSize(16);
            style.alignment = TextAnchor.MiddleCenter;
            Rect rect = new Rect(GuiBase.Width(365f), GuiBase.Height(360f), GuiBase.Width(500f), GuiBase.Height(150f));

            GUI.Box(new Rect(GuiBase.Width(290f), GuiBase.Height(110f), GuiBase.Width(660f), GuiBase.Height(480f)), string.Empty);
            style2.fontSize  = GuiBase.FontSize(16);
            style2.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(rect.xMin, rect.yMin + GuiBase.Height(10f), GuiBase.Width(450f), GuiBase.Height(30f)), new GUIContent(string.Empty, "Hello my dear god. Please click twice on the white box and then put a big number into it.\nOnly numbers though! Then finalize with the 'Buy' button. You can ignore the 'Cancel' button"));
            if (string.IsNullOrEmpty(this.countToBuy))
            {
                this.countToBuy = string.Empty;
            }
            this.countToBuy = GUI.TextField(new Rect(rect.xMin + GuiBase.Width(30f), rect.yMin + GuiBase.Height(45f), GuiBase.Width(270f), GuiBase.Height(30f)), this.countToBuy);
            if (GUI.Button(new Rect(rect.xMin + GuiBase.Width(400f), rect.yMin + GuiBase.Height(45f), GuiBase.Width(75f), GuiBase.Height(30f)), "Cancel"))
            {
                this.creationToShow = null;
                return;
            }
            try
            {
                if (!string.IsNullOrEmpty(this.countToBuy) && this.countToBuy.StartsWith("-"))
                {
                    GuiBase.ShowToast("I only sell my creations to you. I won't buy them.");
                    this.countToBuy = string.Empty;
                    return;
                }
                CDouble cDouble = new CDouble(this.countToBuy);
                cDouble.Round();
                this.countToBuy  = cDouble.ToString();
                style2.alignment = TextAnchor.UpperLeft;
                GUI.Label(new Rect(rect.xMin + GuiBase.Width(35f), rect.yMin + GuiBase.Height(85f), GuiBase.Width(450f), GuiBase.Height(30f)), "Divinity cost: " + (this.creationToShow.BuyCost * cDouble).ToGuiText(true));
                GUI.Label(new Rect(rect.xMin + GuiBase.Width(35f), rect.yMin + GuiBase.Height(115f), GuiBase.Width(450f), GuiBase.Height(30f)), "You have: " + App.State.Money.ToGuiText(true) + " divinity");
                GUI.Label(new Rect(rect.xMin + GuiBase.Width(35f), rect.yMin + GuiBase.Height(145f), GuiBase.Width(450f), GuiBase.Height(30f)), "You have: " + this.creationToShow.Count.ToGuiText(true) + " " + this.creationToShow.Name.ToLower());
                style2.alignment = TextAnchor.MiddleCenter;
                if (GUI.Button(new Rect(rect.xMin + GuiBase.Width(315f), rect.yMin + GuiBase.Height(45f), GuiBase.Width(75f), GuiBase.Height(30f)), "Buy"))
                {
                    CDouble cDouble2 = this.creationToShow.BuyCost * cDouble;
                    App.State.Money.Round();
                    cDouble2.Round();
                    if (App.State.Money >= cDouble2)
                    {
                        App.State.Money                     -= cDouble2;
                        this.creationToShow.Count           += cDouble;
                        this.creationToShow                  = null;
                        App.State.Statistic.TotalMoneySpent += cDouble2;
                    }
                    else
                    {
                        GuiBase.ShowToast("Sorry you are way too poor to afford that.\nPlease save up a little more and then come back.");
                    }
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                this.countToBuy = string.Empty;
                GuiBase.ShowToast("Only numbers are allowed! Don't ask why. It's just hard to count money with letters or some weird characters.");
            }
            GUI.BeginGroup(new Rect(GuiBase.Width(280f), GuiBase.Height(120f), GuiBase.Width(670f), GuiBase.Height(480f)));
            if (this.creationToShow != null)
            {
                style2.fontStyle = FontStyle.Bold;
                GUI.Label(new Rect(GuiBase.Width(10f), GuiBase.Height(10f), GuiBase.Width(660f), GuiBase.Height(50f)), "I can sell you a " + this.creationToShow.Name + ". How many do you want to buy? \nPress a button or input a number.");
                style2.fontStyle = FontStyle.Normal;
            }
            this.toggleNumber = GUI.Toolbar(new Rect(GuiBase.Width(55f), GuiBase.Height(70f), GuiBase.Width(245f), GuiBase.Height(35f)), this.toggleNumber, this.toolbarLeftStrings);
            int value = 1;

            if (this.toggleNumber == 1)
            {
                value = 2;
            }
            else if (this.toggleNumber == 2)
            {
                value = 5;
            }
            else if (this.toggleNumber == 3)
            {
                value = 25;
            }
            else if (this.toggleNumber == 4)
            {
                value = 75;
            }
            CDouble cDouble3 = new CDouble("1") * value;

            if (GUI.Button(new Rect(GuiBase.Width(55f), GuiBase.Height(120f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble3.ToGuiText(true)))
            {
                this.BuyCount(cDouble3);
            }
            CDouble cDouble4 = new CDouble("10") * value;

            if (GUI.Button(new Rect(GuiBase.Width(200f), GuiBase.Height(120f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble4.ToGuiText(true)))
            {
                this.BuyCount(cDouble4);
            }
            CDouble cDouble5 = new CDouble("100") * value;

            if (GUI.Button(new Rect(GuiBase.Width(345f), GuiBase.Height(120f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble5.ToGuiText(true)))
            {
                this.BuyCount(cDouble5);
            }
            CDouble cDouble6 = new CDouble("1000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(490f), GuiBase.Height(120f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble6.ToGuiText(true)))
            {
                this.BuyCount(cDouble6);
            }
            CDouble cDouble7 = new CDouble("10000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(55f), GuiBase.Height(155f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble7.ToGuiText(true)))
            {
                this.BuyCount(cDouble7);
            }
            CDouble cDouble8 = new CDouble("100000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(200f), GuiBase.Height(155f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble8.ToGuiText(true)))
            {
                this.BuyCount(cDouble8);
            }
            CDouble cDouble9 = new CDouble("1000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(345f), GuiBase.Height(155f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble9.ToGuiText(true)))
            {
                this.BuyCount(cDouble9);
            }
            CDouble cDouble10 = new CDouble("10000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(490f), GuiBase.Height(155f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble10.ToGuiText(true)))
            {
                this.BuyCount(cDouble10);
            }
            CDouble cDouble11 = new CDouble("100000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(55f), GuiBase.Height(190f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble11.ToGuiText(true)))
            {
                this.BuyCount(cDouble11);
            }
            CDouble cDouble12 = new CDouble("1000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(200f), GuiBase.Height(190f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble12.ToGuiText(true)))
            {
                this.BuyCount(cDouble12);
            }
            CDouble cDouble13 = new CDouble("10000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(345f), GuiBase.Height(190f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble13.ToGuiText(true)))
            {
                this.BuyCount(cDouble13);
            }
            CDouble cDouble14 = new CDouble("100000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(490f), GuiBase.Height(190f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble14.ToGuiText(true)))
            {
                this.BuyCount(cDouble14);
            }
            CDouble cDouble15 = new CDouble("1000000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(55f), GuiBase.Height(225f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble15.ToGuiText(true)))
            {
                this.BuyCount(cDouble15);
            }
            CDouble cDouble16 = new CDouble("10000000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(200f), GuiBase.Height(225f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble16.ToGuiText(true)))
            {
                this.BuyCount(cDouble16);
            }
            CDouble cDouble17 = new CDouble("100000000000000") * value;

            if (GUI.Button(new Rect(GuiBase.Width(345f), GuiBase.Height(225f), GuiBase.Width(140f), GuiBase.Height(25f)), cDouble17.ToGuiText(true)))
            {
                this.BuyCount(cDouble17);
            }
            if (GUI.Button(new Rect(GuiBase.Width(490f), GuiBase.Height(225f), GuiBase.Width(140f), GuiBase.Height(25f)), "MAX"))
            {
                CDouble buyCost = this.creationToShow.BuyCost;
                if (buyCost == 0)
                {
                    return;
                }
                CDouble cDouble18 = App.State.Money / this.creationToShow.BuyCost;
                cDouble18.Value = Math.Floor(cDouble18.Value);
                this.BuyCount(cDouble18);
            }
            GUI.EndGroup();
        }
Beispiel #2
0
        private static void addTextField(ref CDouble value, int godPowerleft)
        {
            int    num  = value.ToInt();
            string s    = GUI.TextField(new Rect(GuiBase.Width(180f), GuiBase.Height((float)GodPowerUi.marginTop), GuiBase.Width(60f), GuiBase.Height(25f)), value.ToString());
            int    num2 = 0;

            int.TryParse(s, out num2);
            if (num2 >= 0 && num2 <= godPowerleft + num)
            {
                value = num2;
            }
        }