From c6e53fd6b73f49408b4889cf959dfb25f7a9e585 Mon Sep 17 00:00:00 2001 From: DemoJameson Date: Mon, 17 Apr 2023 17:31:22 +0800 Subject: [PATCH] Fix TextMenu.Option right side is too wide TextMenu.Option render the right side with font size of 80%, but uses 100% when calculating the width, so the more characters, the bigger the error. This pr fixes the issue. --- Celeste.Mod.mm/Patches/TextMenu.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Celeste.Mod.mm/Patches/TextMenu.cs b/Celeste.Mod.mm/Patches/TextMenu.cs index 305c7aa86..105a1f742 100644 --- a/Celeste.Mod.mm/Patches/TextMenu.cs +++ b/Celeste.Mod.mm/Patches/TextMenu.cs @@ -382,7 +382,7 @@ public override float RightWidth() { List currentContent = Values.Select(val => val.Item1).ToList(); if (!cachedRightWidthContent.SequenceEqual(currentContent)) { // contents changed, or the width wasn't computed yet. - cachedRightWidth = orig_RightWidth(); + cachedRightWidth = orig_RightWidth() * 0.8f + 44f; cachedRightWidthContent = currentContent; } return cachedRightWidth; @@ -558,7 +558,7 @@ public static void PatchTextMenuOptionColor(ILContext context, CustomAttribute a cursor.Next.OpCode = OpCodes.Ldfld; cursor.Next.Operand = f_UnselectedColor; } - + public static void PatchTextMenuSettingUpdate(ILContext il, CustomAttribute _) { MethodReference m_MouseButtonsHash = il.Method.DeclaringType.FindMethod("_MouseButtonsHash"); FieldReference f_Binding_Mouse = MonoModRule.Modder.FindType("Monocle.Binding").Resolve().FindField("Mouse");