Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.10.1 #568

Merged
merged 7 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OWML.Launcher/OWML.Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Alek",
"name": "OWML",
"uniqueName": "Alek.OWML",
"version": "2.10.0",
"version": "2.10.1",
"minGameVersion": "1.1.14.768",
"maxGameVersion": "1.1.14.768"
}
19 changes: 9 additions & 10 deletions src/OWML.ModHelper.Menus/NewMenuSystem/MenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public MenuManager(
_owmlConfig = owmlConfig;
_unityEvents = unityEvents;
TitleMenuManager = new TitleMenuManager();
PopupMenuManager = new PopupMenuManager(console, harmony);
PopupMenuManager = new PopupMenuManager(console, harmony, this);
OptionsMenuManager = new OptionsMenuManager(console, unityEvents, PopupMenuManager);
PauseMenuManager = new PauseMenuManager(console);

Expand All @@ -58,18 +58,14 @@ public MenuManager(

LoadManager.OnCompleteSceneLoad += (_, newScene) =>
{
if (newScene is OWScene.TitleScreen or OWScene.SolarSystem or OWScene.EyeOfTheUniverse)
if (newScene is OWScene.SolarSystem or OWScene.EyeOfTheUniverse)
{
SetupMenus(((IMenuManager)this).ModList);
}
};

modUnityEvents.RunWhen(
PlayerData.IsLoaded,
() => SetupMenus(((IMenuManager)this).ModList));
}

private void SetupMenus(IList<IModBehaviour> modList)
internal void SetupMenus(IList<IModBehaviour> modList)
{
void SaveConfig()
{
Expand Down Expand Up @@ -221,6 +217,7 @@ void SaveConfig()
{
mod.ModHelper.Config.SetSettingsValue(name, newValue);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
case SettingType.TOGGLE:
Expand All @@ -233,6 +230,7 @@ void SaveConfig()
{
mod.ModHelper.Config.SetSettingsValue(name, newValue);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
case SettingType.SELECTOR:
Expand All @@ -245,6 +243,7 @@ void SaveConfig()
{
mod.ModHelper.Config.SetSettingsValue(name, newSelection);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
case SettingType.SEPARATOR:
Expand All @@ -258,9 +257,9 @@ void SaveConfig()
settingSlider.ModSettingKey = name;
settingSlider.OnValueChanged += (float newValue) =>
{
_console.WriteLine($"changed to {newValue}");
mod.ModHelper.Config.SetSettingsValue(name, newValue);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
case SettingType.TEXT:
Expand All @@ -270,9 +269,9 @@ void SaveConfig()
textInput.OnConfirmEntry += () =>
{
var newValue = textInput.GetInputText();
_console.WriteLine($"changed to {newValue}");
mod.ModHelper.Config.SetSettingsValue(name, newValue);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
case SettingType.NUMBER:
Expand All @@ -282,9 +281,9 @@ void SaveConfig()
numberInput.OnConfirmEntry += () =>
{
var newValue = double.Parse(numberInput.GetInputText());
_console.WriteLine($"changed to {newValue}");
mod.ModHelper.Config.SetSettingsValue(name, newValue);
mod.ModHelper.Storage.Save(mod.ModHelper.Config, Constants.ModConfigFileName);
mod.Configure(mod.ModHelper.Config);
};
break;
default:
Expand Down
14 changes: 12 additions & 2 deletions src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public class PopupMenuManager : IPopupMenuManager
private GameObject _twoChoicePopupBase;
private GameObject _inputPopupBase;

public PopupMenuManager(IModConsole console, IHarmonyHelper harmony)
public PopupMenuManager(IModConsole console, IHarmonyHelper harmony, IMenuManager menuManager)
{
_console = console;
StartupPopupPatches.menuManager = menuManager as MenuManager;

LoadManager.OnCompleteSceneLoad += LoadManager_OnCompleteSceneLoad;

Expand Down Expand Up @@ -323,6 +324,8 @@ public IOWMLFourChoicePopupMenu CreateFourChoicePopup(string message, string con

public static class StartupPopupPatches
{
public static MenuManager menuManager;

public static bool DetermineStartupPopups(TitleScreenManager __instance)
{
if (__instance._profileManager.currentProfileGameSave.version == "NONE")
Expand Down Expand Up @@ -363,7 +366,7 @@ public static bool TryShowStartupPopupsAndShowMenu(TitleScreenManager __instance
return false;
}

if (PopupMenuManager.PopupsToShow.Count == 0)
if (PopupMenuManager.PopupsToShow == null || PopupMenuManager.PopupsToShow.Count == 0)
{
__instance._okCancelPopup.ResetPopup();
__instance.SetUpMainMenu();
Expand All @@ -375,6 +378,7 @@ public static bool TryShowStartupPopupsAndShowMenu(TitleScreenManager __instance

if (firstTimeRun)
{
menuManager.SetupMenus((menuManager as IMenuManager).ModList);
__instance.FadeInMenuOptions();
return false;
}
Expand All @@ -391,6 +395,12 @@ public static bool TryShowStartupPopups(TitleScreenManager __instance)
{
string text = "AAAAGGGGGHH";

if (PopupMenuManager.PopupsToShow == null || PopupMenuManager.PopupsToShow.Count == 0)
{
__instance.TryShowStartupPopupsAndShowMenu(true);
return false;
}

PopupMenuManager.ActivePopup = PopupMenuManager.PopupsToShow.First();

if (PopupMenuManager.ActivePopup <= 2)
Expand Down
2 changes: 2 additions & 0 deletions src/OWML.ModHelper.Menus/NewMenuSystem/TitleMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public SubmitAction CreateTitleButton(string text, int index, bool fromTop)

titleScreenManager._mainMenuTextFields = titleScreenManager._mainMenuTextFields.Append(submitAction.GetComponentInChildren<Text>()).ToArray();

newButton.SetActive(true);

return submitAction;
}

Expand Down
Loading