Esempio n. 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;
        }
Esempio n. 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;
        }
Esempio n. 4
0
        public static Rect DisplayInputField(Listing_Standard listing)
        {
            string FieldDescription = null;

            switch (input)
            {
            case CurrentInput.Method:
                FieldDescription = "Type:Method";
                break;

            case CurrentInput.Type:
                FieldDescription = "Type";
                break;

            case CurrentInput.MethodHarmony:
                FieldDescription = "Type:Method";
                break;

            case CurrentInput.TypeHarmony:
                FieldDescription = "Type";
                break;

            case CurrentInput.InternalMethod:
                FieldDescription = "Type:Method";
                break;

            case CurrentInput.SubClasses:
                FieldDescription = "Type";
                break;

            case CurrentInput.Assembly:
                FieldDescription = "Mod or PackageId";
                break;
            }

            var descWidth = FieldDescription.GetWidthCached() + 20f;
            var rect      = listing.GetRect(Text.LineHeight + 8);
            var modeButt  = rect.LeftPartPixels(descWidth);
            var patchButt = rect.RightPartPixels(100f);
            var inputRect = rect;

            inputRect.width -= modeButt.width + patchButt.width;
            inputRect.x      = modeButt.xMax;

            if (Widgets.ButtonText(modeButt, FieldDescription))
            {
                var list = new List <FloatMenuOption>
                {
                    new FloatMenuOption(Strings.devoptions_input_method, () => input         = CurrentInput.Method),
                    new FloatMenuOption(Strings.devoptions_input_methodinternal, () => input = CurrentInput.InternalMethod),
                    new FloatMenuOption(Strings.devoptions_input_methodharmony, () => input  = CurrentInput.MethodHarmony),
                    new FloatMenuOption(Strings.devoptions_input_type, () => input           = CurrentInput.Type),
                    new FloatMenuOption(Strings.devoptions_input_subclasses, () => input     = CurrentInput.SubClasses),
                    new FloatMenuOption(Strings.devoptions_input_typeharmony, () => input    = CurrentInput.TypeHarmony),
                    new FloatMenuOption(Strings.devoptions_input_assembly, () => input       = CurrentInput.Assembly)
                };
                Find.WindowStack.Add(new FloatMenu(list));
            }

            DubGUI.InputField(inputRect, "profileinput", ref currentInput);

            if (input == CurrentInput.Method)
            {
                if (Widgets.ButtonText(patchButt.LeftHalf(), "Patch"))
                {
                    if (!string.IsNullOrEmpty(currentInput))
                    {
                        ExecutePatch(input, currentInput, patchType);
                    }
                }
                if (Widgets.ButtonText(patchButt.RightHalf(), "Save"))
                {
                    if (!string.IsNullOrEmpty(currentInput))
                    {
                        if (patchType == Category.Tick)
                        {
                            Settings.SavedPatches_Tick.Add(currentInput);
                        }
                        else
                        {
                            Settings.SavedPatches_Update.Add(currentInput);
                        }
                        Modbase.Settings.Write();
                        ExecutePatch(input, currentInput, patchType);
                    }
                }
            }
            else
            {
                if (Widgets.ButtonText(patchButt, "Patch"))
                {
                    if (!string.IsNullOrEmpty(currentInput))
                    {
                        ExecutePatch(input, currentInput, patchType);
                    }
                }
            }


            return(inputRect);
        }