Exemplo n.º 1
0
        public static void Draw(Rect rect, bool settingsPage = false)
        {
            if (settingsPage)
            {
                currentTab = 0;
            }
            else
            {
                rect.y += 35;
                List <TabRecord> list = new List <TabRecord>();
                list.Add(new TabRecord("settings.performance".Translate(), delegate
                {
                    currentTab = 0;
                    Modbase.Settings.Write();
                }, currentTab == 0));
                list.Add(new TabRecord("settings.developer".Translate(), delegate
                {
                    currentTab = 1;
                    Modbase.Settings.Write();
                }, currentTab == 1));

                TabDrawer.DrawTabs(rect, list, 500f);
            }


            Rect view = rect.AtZero();

            view.height = rect.height;

            Widgets.BeginScrollView(rect, ref scrollPos, view, false);
            GUI.BeginGroup(view);
            view.height = 9999;
            listing.Begin(view.ContractedBy(10f));

            // Draw the github and discord textures / Icons

            Rect rec  = listing.GetRect(24f);
            Rect lrec = rec.LeftHalf();

            rec = rec.RightHalf();
            Widgets.DrawTextureFitted(lrec.LeftPartPixels(40f), ResourceCache.GUI.Support, 1f);
            lrec.x += 40;
            if (Widgets.ButtonText(lrec.LeftPartPixels(ResourceCache.Strings.settings_wiki.GetWidthCached()), ResourceCache.Strings.settings_wiki, false, true))
            {
                Application.OpenURL("https://github.com/Dubwise56/Dubs-Performance-Analyzer/wiki");
            }

            Widgets.DrawTextureFitted(rec.RightPartPixels(40f), ResourceCache.GUI.disco, 1f);
            rec.width -= 40;
            if (Widgets.ButtonText(rec.RightPartPixels(ResourceCache.Strings.settings_discord.GetWidthCached()), ResourceCache.Strings.settings_discord, false, true))
            {
                Application.OpenURL("https://discord.gg/Az5CnDW");
            }


            listing.GapLine(6f);

            switch (currentTab)
            {
            case 0:
                PerformancePatches.Draw(ref listing);
                FixPatches.Draw(listing);
                break;

            case 1:
                DrawDevOptions(rect.height);
                break;
            }

            listing.End();
            GUI.EndGroup();
            Widgets.EndScrollView();
        }
        public static void Draw(Rect rect, bool settingsPage = false)
        {
            rect         = rect.Rounded();
            rect.height -= 32;
            rect.y      += 32;
            Widgets.DrawMenuSection(rect);

            var list = new List <TabRecord>();

            list.Add(new TabRecord("settings.performance".Translate(), delegate
            {
                currentTab = 0;
                Modbase.Settings.Write();
            }, currentTab == 0));
            list.Add(new TabRecord("settings.developer".Translate(), delegate
            {
                currentTab = 1;
                Modbase.Settings.Write();
            }, currentTab == 1));

            TabDrawer.DrawTabs(rect, list);

            rect = rect.ContractedBy(10);

            listing.maxOneColumn = true;
            var innyrek = new Rect(0, 0, rect.width - 16f, listheight);

            if (innyrek.width < 400)
            {
                innyrek.width = 400;
            }
            Widgets.BeginScrollView(rect, ref scrollPos, innyrek);

            listing.Begin(innyrek);

            var rec  = listing.GetRect(24f);
            var lrec = rec.LeftHalf();

            rec = rec.RightHalf();
            Widgets.DrawTextureFitted(lrec.LeftPartPixels(40f), Textures.Support, 1f);
            lrec.x += 40;
            if (Widgets.ButtonText(lrec.LeftPartPixels(Strings.settings_wiki.GetWidthCached()),
                                   Strings.settings_wiki, false))
            {
                Application.OpenURL("https://github.com/simplyWiri/Dubs-Performance-Analyzer/blob/master/README.md");
            }

            Widgets.DrawTextureFitted(rec.RightPartPixels(40f), Textures.disco, 1f);
            rec.width -= 40;
            if (Widgets.ButtonText(rec.RightPartPixels(Strings.settings_discord.GetWidthCached()),
                                   Strings.settings_discord, false))
            {
                Application.OpenURL("https://discord.gg/Az5CnDW");
            }

            listing.GapLine();

            if (currentTab == 0)
            {
                PerformancePatches.Draw(listing);
            }
            else
            {
                Panel_DevOptions.Draw(listing, rect, settingsPage);
            }

            listheight = listing.curY;
            listing.End();
            Widgets.EndScrollView();
        }