Skip to content

Commit

Permalink
fix options stuff not working ingame
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Feb 28, 2024
1 parent 9937e80 commit 1e775ac
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public OptionsMenuManager(IModConsole console, IModUnityEvents unityEvents, IPop

var tabButton = CreateTabButton(name, menu);

var optionsMenu = GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();
var optionsMenu = LoadManager.GetCurrentScene() == OWScene.TitleScreen
? GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>()
: GameObject.Find("PauseMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();

optionsMenu._subMenus = optionsMenu._subMenus.Add(menu);
optionsMenu._menuTabs = optionsMenu._menuTabs.Add(tabButton);
optionsMenu._tabSelectablePairs = optionsMenu._tabSelectablePairs.Add(
Expand Down Expand Up @@ -89,7 +92,10 @@ public OptionsMenuManager(IModConsole console, IModUnityEvents unityEvents, IPop

var tabButton = CreateTabButton(name, tabbedSubMenu);

var optionsMenu = GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();
var optionsMenu = LoadManager.GetCurrentScene() == OWScene.TitleScreen
? GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>()
: GameObject.Find("PauseMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();

optionsMenu._subMenus = optionsMenu._subMenus.Add(tabbedSubMenu);
optionsMenu._menuTabs = optionsMenu._menuTabs.Add(tabButton);
optionsMenu._tabSelectablePairs = optionsMenu._tabSelectablePairs.Add(
Expand Down Expand Up @@ -119,7 +125,9 @@ public OptionsMenuManager(IModConsole console, IModUnityEvents unityEvents, IPop

public void RemoveTab(Menu tab)
{
var optionsMenu = GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();
var optionsMenu = LoadManager.GetCurrentScene() == OWScene.TitleScreen
? GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>()
: GameObject.Find("PauseMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();

var tabButton = optionsMenu._menuTabs.SingleOrDefault(x => x._tabbedMenu == tab);

Expand Down Expand Up @@ -203,7 +211,10 @@ public void RemoveTab(Menu tab)

public void OpenOptionsAtTab(TabButton button)
{
var optionsMenu = GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();
var optionsMenu = LoadManager.GetCurrentScene() == OWScene.TitleScreen
? GameObject.Find("TitleMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>()
: GameObject.Find("PauseMenu").transform.Find("OptionsCanvas").Find("OptionsMenu-Panel").GetComponent<TabbedMenu>();

optionsMenu.EnableMenu(true);
optionsMenu.SelectTabButton(button);
}
Expand Down

0 comments on commit 1e775ac

Please sign in to comment.