Skip to content

Commit fb58071

Browse files
Fix inomptimal menu reloading
1 parent 73e4e7c commit fb58071

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

Menu/Main.cs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ private static void AddButton(float offset, int buttonIndex, ButtonInfo method)
19511951
targetButtonText = targetButtonText.Replace(" <color=grey>[</color><color=green>", $" <color=grey>[</color><color={inputTextColor}>");
19521952

19531953
targetButtonText = FixTMProTags(targetButtonText);
1954-
targetButtonText = FollowMenuSettings(targetButtonText);
1954+
targetButtonText = FollowMenuSettings(targetButtonText, true);
19551955

19561956
buttonText.spriteAsset = ButtonSpriteSheet;
19571957

@@ -2648,7 +2648,7 @@ public static GameObject CreateMenu()
26482648
title.text = randomMenuNames[Random.Range(0, randomMenuNames.Length)] + " v" + Random.Range(8, 159);
26492649
}
26502650

2651-
title.text = FollowMenuSettings(title.text, !doCustomName);
2651+
title.text = FollowMenuSettings(title.text, !doCustomName, true);
26522652

26532653
if (!noPageNumber)
26542654
title.text += $" <color=grey>[</color><color=white>{(pageScrolling ? pageOffset : pageNumber) + 1}</color><color=grey>]</color>";
@@ -2863,7 +2863,7 @@ public static GameObject CreateMenu()
28632863
}.AddComponent<TextMeshPro>();
28642864

28652865
keyboardInputObject.font = activeFont;
2866-
keyboardInputObject.text = FollowMenuSettings(keyboardInput) + ((Time.time % 1f) > 0.5f ? "|" : "");
2866+
keyboardInputObject.text = FollowMenuSettings(keyboardInput, false) + ((Time.time % 1f) > 0.5f ? "|" : "");
28672867

28682868
keyboardInputObject.richText = true;
28692869
keyboardInputObject.fontSize = 1;
@@ -3550,7 +3550,7 @@ private static void RenderPrompt()
35503550
if (promptImageUrl != null)
35513551
promptText.text = promptText.text.Replace($"<{promptImageUrl}>", "");
35523552

3553-
promptText.text = FollowMenuSettings(promptText.text);
3553+
promptText.text = FollowMenuSettings(promptText.text, true);
35543554

35553555
promptText.fontSize = 1;
35563556
promptText.lineSpacing = 0.8f;
@@ -3672,7 +3672,7 @@ private static void RenderPrompt()
36723672
TextMeshPro text = new GameObject { transform = { parent = canvasObj.transform } }.AddComponent<TextMeshPro>();
36733673
text.font = activeFont;
36743674
text.fontStyle = activeFontStyle;
3675-
text.text = FollowMenuSettings(CurrentPrompt.AcceptText);
3675+
text.text = FollowMenuSettings(CurrentPrompt.AcceptText, true);
36763676
text.fontSize = 1;
36773677
text.alignment = TextAlignmentOptions.Center;
36783678
text.enableAutoSizing = true;
@@ -3732,7 +3732,7 @@ private static void RenderPrompt()
37323732
TextMeshPro text = new GameObject { transform = { parent = canvasObj.transform } }.AddComponent<TextMeshPro>();
37333733
text.font = activeFont;
37343734
text.fontStyle = activeFontStyle;
3735-
text.text = FollowMenuSettings(CurrentPrompt.DeclineText);
3735+
text.text = FollowMenuSettings(CurrentPrompt.DeclineText, true);
37363736
text.fontSize = 1;
37373737
text.alignment = TextAlignmentOptions.Center;
37383738
text.enableAutoSizing = true;
@@ -5304,10 +5304,14 @@ public static string ToTitleCase(string text) =>
53045304
/// true.</param>
53055305
/// <returns>A string containing the transformed input, with translation and case modifications applied as specified by
53065306
/// the current settings.</returns>
5307-
public static string FollowMenuSettings(string input, bool translateText = true)
5307+
public static string FollowMenuSettings(string input, bool translateText = true, bool reloadOnTranslate = false)
53085308
{
5309+
Action<string> onTranslate = null;
5310+
if (reloadOnTranslate)
5311+
onTranslate = (_) => TranslationReloadDelay();
5312+
53095313
if (translateText && translate)
5310-
input = TranslationManager.TranslateText(input);
5314+
input = TranslationManager.TranslateText(input, onTranslate);
53115315

53125316
if (lowercaseMode)
53135317
input = input.ToLower();
@@ -5326,6 +5330,24 @@ public static string FollowMenuSettings(string input, bool translateText = true)
53265330
return input;
53275331
}
53285332

5333+
private static Coroutine translationCoroutine;
5334+
public static void TranslationReloadDelay()
5335+
{
5336+
if (translationCoroutine != null)
5337+
{
5338+
CoroutineManager.instance.StopCoroutine(translationCoroutine);
5339+
translationCoroutine = null;
5340+
}
5341+
5342+
translationCoroutine = CoroutineManager.instance.StartCoroutine(TranslationReloadCoroutine());
5343+
}
5344+
5345+
public static IEnumerator TranslationReloadCoroutine()
5346+
{
5347+
yield return new WaitForSeconds(0.5f);
5348+
ReloadMenu();
5349+
}
5350+
53295351
/// <summary>
53305352
/// Applies menu appearance settings to the specified game object, such as outlining and rounding, based on
53315353
/// current configuration.

PluginInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class PluginInfo
2626
public const string GUID = "org.iidk.gorillatag.iimenu";
2727
public const string Name = "ii's Stupid Menu";
2828
public const string Description = "Created by @crimsoncauldron with love <3";
29-
public const string BuildTimestamp = "2026-02-11T03:03:02Z";
29+
public const string BuildTimestamp = "2026-02-13T17:46:17Z";
3030
public const string Version = "8.2.4";
3131

3232
public const string BaseDirectory = "iisStupidMenu";
0 Bytes
Binary file not shown.
-24 KB
Binary file not shown.

References/Managed/LIV.LCKCore.dll

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)