Merge branch 'dev' into mira-events-dev

This commit is contained in:
David Higueros authored and GitHub committed 2026-11-06 17:16:56 -07:00
commit b44fac886b
1 file changed
+17 -1
+17 -1
View File
@@ -50,7 +50,8 @@ public class MenuState(IntPtr cppPtr) : MonoBehaviour(cppPtr)
private readonly Dictionary<MenuButton, PassiveButton> _smallButtons = [];
private readonly Dictionary<MenuButton, PassiveButton> _largeButtons = [];
private Vector3 _gameSettingsButtonOrig;
private Vector3 _roleSettingsButtonOrig;
[HideFromIl2Cpp]
public Dictionary<MenuCategory, Dictionary<int, GameObject>> Containers { get; } = new()
{
@@ -145,6 +146,10 @@ public class MenuState(IntPtr cppPtr) : MonoBehaviour(cppPtr)
// Create menu buttons
_largeButtons[(int)MenuButton.Roles] = Gsm.RoleSettingsButton;
// cache
_gameSettingsButtonOrig = Gsm.GameSettingsButton.transform.localPosition;
_roleSettingsButtonOrig = Gsm.RoleSettingsButton.transform.localPosition;
// modifiers button
var mBtn = Instantiate(Gsm.RoleSettingsButton, Gsm.RoleSettingsButton.transform.parent);
_largeButtons[MenuButton.Modifiers] = mBtn;
@@ -409,6 +414,11 @@ public class MenuState(IntPtr cppPtr) : MonoBehaviour(cppPtr)
btn.gameObject.SetActive(false);
}
// The mod options page moves RoleSettingsButton as needed.
// But when hasOptions == false, it leaves the button at the GameSettingsButton spot.
// So before each re-layout, always put the original button back into the prefab slot first.
RestoreButtonLayout();
if (CurrentModIdx == 0)
{
Gsm.GameSettingsButton.gameObject.SetActive(true);
@@ -532,6 +542,12 @@ public class MenuState(IntPtr cppPtr) : MonoBehaviour(cppPtr)
}
}
private void RestoreButtonLayout()
{
Gsm.GameSettingsButton.transform.localPosition = _gameSettingsButtonOrig;
Gsm.RoleSettingsButton.transform.localPosition = _roleSettingsButtonOrig;
}
internal void ChangeTabPatch(GameSettingMenu menu, int tabNum, bool previewOnly)
{
Info($"Changed tab to {(MenuCategory)tabNum} (previewOnly: {previewOnly}) for mod {CurrentModIdx}");