mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Remove MF dependency (waiting on next owml update for missing hooks)
This commit is contained in:
parent
962a6f778b
commit
1930882a03
@ -263,7 +263,6 @@ namespace NewHorizons
|
||||
// Call this from the menu since we hadn't hooked onto the event yet
|
||||
Delay.FireOnNextUpdate(() => OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single));
|
||||
Delay.FireOnNextUpdate(() => _firstLoad = false);
|
||||
Instance.ModHelper.Menus.PauseMenu.OnInit += DebugReload.InitializePauseMenu;
|
||||
|
||||
MenuHandler.Init();
|
||||
AchievementHandler.Init();
|
||||
@ -275,6 +274,13 @@ namespace NewHorizons
|
||||
LoadAddonManifest("Assets/addon-manifest.json", this);
|
||||
}
|
||||
|
||||
public override void SetupPauseMenu()
|
||||
{
|
||||
base.SetupPauseMenu();
|
||||
DebugReload.InitializePauseMenu();
|
||||
DebugMenu.InitializePauseMenu();
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
NHLogger.Log($"Destroying NewHorizons");
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.14.768" />
|
||||
<PackageReference Include="OWML" Version="2.9.8" />
|
||||
<PackageReference Include="OWML" Version="2.10.3" />
|
||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace NewHorizons.OtherMods.MenuFramework
|
||||
{
|
||||
public interface IMenuAPI
|
||||
{
|
||||
GameObject TitleScreen_MakeMenuOpenButton(string name, int index, Menu menuToOpen);
|
||||
GameObject TitleScreen_MakeSceneLoadButton(string name, int index, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null);
|
||||
Button TitleScreen_MakeSimpleButton(string name, int index);
|
||||
GameObject PauseMenu_MakeMenuOpenButton(string name, Menu menuToOpen, Menu customMenu = null);
|
||||
GameObject PauseMenu_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null, Menu customMenu = null);
|
||||
Button PauseMenu_MakeSimpleButton(string name, Menu customMenu = null);
|
||||
Menu PauseMenu_MakePauseListMenu(string title);
|
||||
PopupMenu MakeTwoChoicePopup(string message, string confirmText, string cancelText);
|
||||
PopupInputMenu MakeInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText);
|
||||
PopupMenu MakeInfoPopup(string message, string continueButtonText);
|
||||
void RegisterStartupPopup(string message);
|
||||
}
|
||||
}
|
||||
@ -11,15 +11,11 @@ namespace NewHorizons.OtherMods.MenuFramework
|
||||
{
|
||||
public static class MenuHandler
|
||||
{
|
||||
private static IMenuAPI _menuApi;
|
||||
|
||||
private static List<(IModBehaviour mod, string message, bool repeat)> _registeredPopups = new();
|
||||
private static List<string> _failedFiles = new();
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_menuApi = Main.Instance.ModHelper.Interaction.TryGetModApi<IMenuAPI>("_nebula.MenuFramework");
|
||||
|
||||
TextTranslation.Get().OnLanguageChanged += OnLanguageChanged;
|
||||
}
|
||||
|
||||
@ -35,14 +31,14 @@ namespace NewHorizons.OtherMods.MenuFramework
|
||||
Application.version);
|
||||
|
||||
NHLogger.LogError(warning);
|
||||
_menuApi.RegisterStartupPopup(warning);
|
||||
Main.Instance.ModHelper.MenuHelper.PopupMenuManager.RegisterStartupPopup(warning);
|
||||
}
|
||||
|
||||
foreach(var (mod, message, repeat) in _registeredPopups)
|
||||
{
|
||||
if (repeat || !NewHorizonsData.HasReadOneTimePopup(mod.ModHelper.Manifest.UniqueName))
|
||||
{
|
||||
_menuApi.RegisterStartupPopup(TranslationHandler.GetTranslation(message, TranslationHandler.TextType.UI));
|
||||
Main.Instance.ModHelper.MenuHelper.PopupMenuManager.RegisterStartupPopup(TranslationHandler.GetTranslation(message, TranslationHandler.TextType.UI));
|
||||
NewHorizonsData.ReadOneTimePopup(mod.ModHelper.Manifest.UniqueName);
|
||||
}
|
||||
}
|
||||
@ -52,7 +48,7 @@ namespace NewHorizons.OtherMods.MenuFramework
|
||||
var message = TranslationHandler.GetTranslation("JSON_FAILED_TO_LOAD", TranslationHandler.TextType.UI);
|
||||
var mods = string.Join(",", _failedFiles.Take(10));
|
||||
if (_failedFiles.Count > 10) mods += "...";
|
||||
_menuApi.RegisterStartupPopup(string.Format(message, mods));
|
||||
Main.Instance.ModHelper.MenuHelper.PopupMenuManager.RegisterStartupPopup(string.Format(message, mods));
|
||||
}
|
||||
|
||||
_registeredPopups.Clear();
|
||||
|
||||
@ -10,12 +10,12 @@ namespace NewHorizons.Utility.DebugTools
|
||||
public static class DebugReload
|
||||
{
|
||||
|
||||
private static IModButton _reloadButton;
|
||||
private static SubmitAction _reloadButton;
|
||||
|
||||
public static void InitializePauseMenu()
|
||||
{
|
||||
_reloadButton = Main.Instance.ModHelper.Menus.PauseMenu.OptionsButton.Duplicate(TranslationHandler.GetTranslation("Reload Configs", TranslationHandler.TextType.UI).ToUpper());
|
||||
_reloadButton.OnClick += ReloadConfigs;
|
||||
_reloadButton = Main.Instance.ModHelper.MenuHelper.PauseMenuManager.MakeSimpleButton(TranslationHandler.GetTranslation("Reload Configs", TranslationHandler.TextType.UI).ToUpper(), 3, true);
|
||||
_reloadButton.OnSubmitAction += ReloadConfigs;
|
||||
UpdateReloadButton();
|
||||
}
|
||||
|
||||
@ -23,8 +23,7 @@ namespace NewHorizons.Utility.DebugTools
|
||||
{
|
||||
if (_reloadButton != null)
|
||||
{
|
||||
if (Main.Debug) _reloadButton.Show();
|
||||
else _reloadButton.Hide();
|
||||
_reloadButton.gameObject.SetActive(Main.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ namespace NewHorizons.Utility.DebugTools.Menu
|
||||
{
|
||||
class DebugMenu : MonoBehaviour
|
||||
{
|
||||
private static IModButton pauseMenuButton;
|
||||
private static SubmitAction pauseMenuButton;
|
||||
|
||||
public GUIStyle _editorMenuStyle;
|
||||
public GUIStyle _tabBarStyle;
|
||||
@ -34,6 +34,8 @@ namespace NewHorizons.Utility.DebugTools.Menu
|
||||
// Submenus
|
||||
private List<DebugSubmenu> submenus;
|
||||
private int activeSubmenu = 0;
|
||||
|
||||
private static DebugMenu _instance;
|
||||
|
||||
internal static JsonSerializerSettings jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
@ -57,14 +59,14 @@ namespace NewHorizons.Utility.DebugTools.Menu
|
||||
{
|
||||
if (!staticInitialized)
|
||||
{
|
||||
_instance = this;
|
||||
|
||||
staticInitialized = true;
|
||||
|
||||
Main.Instance.ModHelper.Menus.PauseMenu.OnInit += PauseMenuInitHook;
|
||||
// This is lying, these hooks dont exist in the new menu system
|
||||
Main.Instance.ModHelper.Menus.PauseMenu.OnClosed += CloseMenu;
|
||||
Main.Instance.ModHelper.Menus.PauseMenu.OnOpened += RestoreMenuOpennessState;
|
||||
|
||||
PauseMenuInitHook();
|
||||
|
||||
Main.Instance.OnChangeStarSystem.AddListener((string s) => {
|
||||
if (saveButtonUnlocked)
|
||||
{
|
||||
@ -84,18 +86,17 @@ namespace NewHorizons.Utility.DebugTools.Menu
|
||||
}
|
||||
}
|
||||
|
||||
private void PauseMenuInitHook()
|
||||
public static void InitializePauseMenu()
|
||||
{
|
||||
pauseMenuButton = Main.Instance.ModHelper.Menus.PauseMenu.OptionsButton.Duplicate(TranslationHandler.GetTranslation("Toggle Dev Tools Menu", TranslationHandler.TextType.UI).ToUpper());
|
||||
InitMenu();
|
||||
pauseMenuButton = Main.Instance.ModHelper.MenuHelper.PauseMenuManager.MakeSimpleButton(TranslationHandler.GetTranslation("Toggle Dev Tools Menu", TranslationHandler.TextType.UI).ToUpper(), 3, true);
|
||||
_instance.InitMenu();
|
||||
}
|
||||
|
||||
public static void UpdatePauseMenuButton()
|
||||
{
|
||||
if (pauseMenuButton != null)
|
||||
{
|
||||
if (Main.Debug) pauseMenuButton.Show();
|
||||
else pauseMenuButton.Hide();
|
||||
pauseMenuButton.gameObject.SetActive(Main.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,7 +285,7 @@ namespace NewHorizons.Utility.DebugTools.Menu
|
||||
UpdatePauseMenuButton();
|
||||
|
||||
// TODO: figure out how to clear this event list so that we don't pile up useless instances of the DebugMenu that can't get garbage collected
|
||||
pauseMenuButton.OnClick += ToggleMenu;
|
||||
pauseMenuButton.OnSubmitAction += ToggleMenu;
|
||||
|
||||
submenus.ForEach(submenu => submenu.OnInit(this));
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "1.19.3",
|
||||
"owmlVersion": "2.9.8",
|
||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||
"owmlVersion": "2.10.3",
|
||||
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
|
||||
"pathsToPreserve": [ "planets", "systems", "translations" ],
|
||||
"donateLink": "https://www.patreon.com/ownh"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user