Example #1
0
        public static void Draw(Rect rect)
        {
            var row = rect.LeftPartPixels(25f);

            if (Widgets.ButtonImage(row, TexButton.SpeedButtonTextures[Analyzer.CurrentlyPaused ? 1 : 0]))
            {
                Analyzer.CurrentlyPaused = !Analyzer.CurrentlyPaused;
                GUIController.CurrentEntry.SetActive(!Analyzer.CurrentlyPaused);
            }

            TooltipHandler.TipRegion(row, Strings.top_pause_analyzer);
            rect.AdjustHorizonallyBy(25f);

            row = rect.LeftPartPixels(25);
            if (Widgets.ButtonImage(row, Textures.refresh))
            {
                GUIController.ResetProfilers();
            }

            TooltipHandler.TipRegion(row, Strings.top_refresh);

            var searchbox = rect.LeftPartPixels(rect.width - 300f);

            searchbox.x += 25f;

            DubGUI.InputField(searchbox, Strings.top_search, ref TimesFilter, DubGUI.MintSearch);

            rect.AdjustHorizonallyBy(rect.width - 250f);

            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Tiny;

            var cat = GUIController.CurrentCategory == Category.Tick ? "tick" : "update";
            var str = $"{ProfileController.updateAverage:F3}ms/{cat}";

            var strLen = str.GetWidthCached();

            var periodLen = rect.LeftPartPixels(130);

            rect.AdjustHorizonallyBy(130);

            Widgets.Label(periodLen, str);


            var tpsFpsRect = rect;

            tpsFpsRect.width = 50f;
            Widgets.Label(tpsFpsRect, $"FPS: {GUIElement_TPS.FPS}");
            TooltipHandler.TipRegion(tpsFpsRect, Strings.top_fps_tip);
            tpsFpsRect.x     = tpsFpsRect.xMax + 5;
            tpsFpsRect.width = 90f;
            Widgets.Label(tpsFpsRect, $"TPS: {GUIElement_TPS.TPS}({GUIElement_TPS.TPSTarget})");
            TooltipHandler.TipRegion(tpsFpsRect, Strings.top_tps_tip);
            tpsFpsRect.x     = tpsFpsRect.xMax + 5;
            tpsFpsRect.width = 30f;
            Text.Font        = GameFont.Medium;
        }
        public static void Draw(Rect rect)
        {
            var row = rect.LeftPartPixels(25f);

            if (Widgets.ButtonImage(row, TexButton.SpeedButtonTextures[Analyzer.CurrentlyPaused ? 1 : 0]))
            {
                Analyzer.CurrentlyPaused = !Analyzer.CurrentlyPaused;
                GUIController.CurrentEntry.SetActive(!Analyzer.CurrentlyPaused);
            }

            TooltipHandler.TipRegion(row, Strings.top_pause_analyzer);
            rect.AdjustHorizonallyBy(25f);

            row = rect.LeftPartPixels(25);
            if (Widgets.ButtonImage(row, Textures.refresh))
            {
                GUIController.ResetProfilers();
            }

            TooltipHandler.TipRegion(row, Strings.top_refresh);

            var searchbox = rect.LeftPartPixels(rect.width - 220f);

            searchbox.x += 25f;

            DubGUI.InputField(searchbox, Strings.top_search, ref TimesFilter, DubGUI.MintSearch);
            //    searchbox.x = searchbox.xMax;
            //    searchbox.width = 150;
            //   GUI.color = Color.grey;
            //   Widgets.Label(searchbox, MatchType);
            //   GUI.color = Color.white;


            // bit shitty and distracting, replace with a mini graph and or an entire page dedicated to garbage if it even matters realistically now which it probably doesn't so why bother aye just keep it clean
            //row.x = searchbox.xMax + 5;
            // row.width = 130f;
            //Text.Anchor = TextAnchor.MiddleCenter;
            //Widgets.FillableBar(row, Mathf.Clamp01(Mathf.InverseLerp(H_RootUpdate.LastMinGC, H_RootUpdate.LastMaxGC, H_RootUpdate.totalBytesOfMemoryUsed)), Textures.darkgrey);
            //Widgets.Label(row, H_RootUpdate.GarbageCollectionInfo);
            //TooltipHandler.TipRegion(row, Strings.top_gc_tip);

            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Tiny;

            row.width = 50f;
            row.x     = searchbox.xMax + 10;
            Widgets.Label(row, $"FPS: {GUIElement_TPS.FPS}");
            TooltipHandler.TipRegion(row, Strings.top_fps_tip);
            row.x     = row.xMax + 5;
            row.width = 90f;
            Widgets.Label(row, $"TPS: {GUIElement_TPS.TPS}({GUIElement_TPS.TPSTarget})");
            TooltipHandler.TipRegion(row, Strings.top_tps_tip);
            row.x     = row.xMax + 5;
            row.width = 30f;
            Text.Font = GameFont.Medium;
        }
Example #3
0
        public static void Draw(Rect rect)
        {
            Rect row = rect.LeftPartPixels(25f);

            if (Widgets.ButtonImage(row, TexButton.SpeedButtonTextures[Analyzer.CurrentlyPaused ? 1 : 0]))
            {
                Analyzer.CurrentlyPaused = !Analyzer.CurrentlyPaused;
                GUIController.CurrentEntry.SetActive(!Analyzer.CurrentlyPaused);
            }

            TooltipHandler.TipRegion(row, ResourceCache.Strings.top_pause_analyzer);
            rect.AdjustHorizonallyBy(25f);

            row = rect.LeftPartPixels(25);
            if (Widgets.ButtonImage(row, ResourceCache.GUI.refresh))
            {
                GUIController.ResetProfilers();
            }

            TooltipHandler.TipRegion(row, ResourceCache.Strings.top_refresh);

            Rect searchbox = rect.LeftPartPixels(rect.width - 350f);

            searchbox.x += 25f;
            DubGUI.InputField(searchbox, ResourceCache.Strings.top_search, ref TimesFilter, DubGUI.MintSearch);
            row.x       = searchbox.xMax + 5;
            row.width   = 130f;
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Tiny;
            Widgets.FillableBar(row, Mathf.Clamp01(Mathf.InverseLerp(H_RootUpdate.LastMinGC, H_RootUpdate.LastMaxGC, H_RootUpdate.totalBytesOfMemoryUsed)), ResourceCache.GUI.darkgrey);
            Widgets.Label(row, H_RootUpdate.GarbageCollectionInfo);
            Text.Anchor = TextAnchor.UpperLeft;
            TooltipHandler.TipRegion(row, ResourceCache.Strings.top_gc_tip);

            row.x     = row.xMax + 5;
            row.width = 50f;
            Widgets.Label(row, "FPS: " + GUIElement_TPS.FPS.ToString());
            TooltipHandler.TipRegion(row, ResourceCache.Strings.top_fps_tip);
            row.x     = row.xMax + 5;
            row.width = 90f;
            Widgets.Label(row, "TPS: " + GUIElement_TPS.TPS.ToString() + "(" + GUIElement_TPS.TPSTarget.ToString() + ")");
            TooltipHandler.TipRegion(row, ResourceCache.Strings.top_tps_tip);
            row.x     = row.xMax + 5;
            row.width = 30f;
            Text.Font = GameFont.Medium;
        }
Example #4
0
        private static void DrawEntry(ref Rect row, KeyValuePair <Entry, Type> entry)
        {
            row = listing.GetRect(30f);
            Widgets.DrawHighlightIfMouseover(row);

            if (GUIController.CurrentEntry == entry.Key)
            {
                Widgets.DrawOptionSelected(row);
            }

            row.x   += 20f;
            yOffset += 30f;

            Widgets.Label(row, entry.Key.name);

            if (Widgets.ButtonInvisible(row))
            {
                GUIController.SwapToEntry(entry.Key.name);
            }

            if (entry.Key.isClosable)
            {
                if (Input.GetMouseButtonDown(1) && row.Contains(Event.current.mousePosition))
                {
                    List <FloatMenuOption> options = new List <FloatMenuOption>()
                    {
                        new FloatMenuOption("Close", () => GUIController.RemoveEntry(entry.Key.name))
                    };
                    Find.WindowStack.Add(new FloatMenu(options));
                }
            }

            TooltipHandler.TipRegion(row, entry.Key.tip);

            if (GUIController.CurrentEntry == entry.Key)
            {
                bool firstEntry = true;
                foreach (KeyValuePair <FieldInfo, Setting> keySetting in entry.Key.Settings)
                {
                    if (keySetting.Key.FieldType == typeof(bool))
                    {
                        row       = listing.GetRect(30f);
                        row.x    += 20f;
                        GUI.color = Widgets.OptionSelectedBGBorderColor;
                        Widgets.DrawLineVertical(row.x, row.y, 15f);

                        if (!firstEntry)
                        {
                            Widgets.DrawLineVertical(row.x, row.y - 15f, 15f);
                        }

                        row.x += 10f;
                        Widgets.DrawLineHorizontal(row.x - 10f, row.y + 15f, 10f);
                        GUI.color = Color.white;
                        yOffset  += 30f;

                        bool cur = (bool)keySetting.Key.GetValue(null);

                        if (DubGUI.Checkbox(row, keySetting.Value.name, ref cur))
                        {
                            keySetting.Key.SetValue(null, cur);

                            GUIController.ResetProfilers();
                        }
                    }

                    if (keySetting.Value.tip != null)
                    {
                        TooltipHandler.TipRegion(row, keySetting.Value.tip);
                    }

                    firstEntry = false;
                }
            }
        }