mirror of
https://github.com/misternebula/MenuFramework.git
synced 2025-12-11 20:15:15 +01:00
commit
ce5af3a8f6
@ -78,7 +78,7 @@
|
||||
<HintPath>..\packages\MonoMod.Utils.21.8.19.1\lib\net40\MonoMod.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\NAudio-Unity.dll</HintPath>
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\NAudio-Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OuterWildsGameLibs.1.1.14.768\lib\netstandard.dll</HintPath>
|
||||
@ -86,32 +86,32 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OuterWildsGameLibs.1.1.14.768\lib\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.Common.dll</HintPath>
|
||||
<Reference Include="OWML.Common, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.Logging.dll</HintPath>
|
||||
<Reference Include="OWML.Logging, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.Assets.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.Events.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.Input.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.ModHelper.Menus.dll</HintPath>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Utils, Version=2.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.9.8\lib\net48\OWML.Utils.dll</HintPath>
|
||||
<Reference Include="OWML.Utils, Version=2.10.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.10.1\lib\net48\OWML.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OuterWildsGameLibs.1.1.14.768\lib\System.dll</HintPath>
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
@ -15,154 +9,9 @@ namespace MenuFramework
|
||||
private void Awake()
|
||||
=> Instance = this;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Main.Helper.HarmonyHelper.AddPrefix<TitleScreenManager>(nameof(TitleScreenManager.DetermineStartupPopups), typeof(StartupPatches), nameof(StartupPatches.DetermineStartupPopups));
|
||||
Main.Helper.HarmonyHelper.AddPrefix<TitleScreenManager>(nameof(TitleScreenManager.OnUserConfirmStartupPopup), typeof(StartupPatches), nameof(StartupPatches.OnUserConfirmStartupPopup));
|
||||
|
||||
if (typeof(TitleScreenManager).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).Any(x => x.Name == "ShowStartupPopupsAndShowMenu"))
|
||||
{
|
||||
Main.Helper.HarmonyHelper.AddPrefix<TitleScreenManager>("ShowStartupPopupsAndShowMenu", typeof(StartupPatches), nameof(StartupPatches.ShowStartupPopupsAndShowMenu));
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Helper.HarmonyHelper.AddPrefix<TitleScreenManager>("TryShowStartupPopupsAndShowMenu", typeof(StartupPatches), nameof(StartupPatches.TryShowStartupPopupsAndShowMenu));
|
||||
Main.Helper.HarmonyHelper.AddPrefix<TitleScreenManager>("TryShowStartupPopups", typeof(StartupPatches), nameof(StartupPatches.TryShowStartupPopups));
|
||||
}
|
||||
}
|
||||
|
||||
public int ActivePopup;
|
||||
|
||||
public List<int> PopupsToShow = new List<int>();
|
||||
|
||||
public List<string> Popups = new List<string>()
|
||||
{
|
||||
UITextLibrary.GetString(UITextType.MenuMessage_InputUpdate),
|
||||
UITextLibrary.GetString(UITextType.MenuMessage_ReducedFrightOptionAvail),
|
||||
UITextLibrary.GetString(UITextType.MenuMessage_NewExhibit)
|
||||
};
|
||||
|
||||
public void RegisterStartupPopup(string message)
|
||||
{
|
||||
PopupsToShow.Add(Popups.Count);
|
||||
Popups.Add(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StartupPatches
|
||||
{
|
||||
public static bool DetermineStartupPopups(TitleScreenManager __instance)
|
||||
{
|
||||
if (__instance._profileManager.currentProfileGameSave.version == "NONE")
|
||||
{
|
||||
StartupPopupManager.Instance.PopupsToShow.Add(0);
|
||||
}
|
||||
|
||||
var ownsDlc = EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||
|
||||
if (ownsDlc && (__instance._profileManager.currentProfileGameSave.shownPopups & StartupPopups.ReducedFrights) == StartupPopups.None)
|
||||
{
|
||||
StartupPopupManager.Instance.PopupsToShow.Add(1);
|
||||
}
|
||||
|
||||
if (ownsDlc && (__instance._profileManager.currentProfileGameSave.shownPopups & StartupPopups.NewExhibit) == StartupPopups.None)
|
||||
{
|
||||
StartupPopupManager.Instance.PopupsToShow.Add(2);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ShowStartupPopupsAndShowMenu(TitleScreenManager __instance)
|
||||
{
|
||||
var popupManger = StartupPopupManager.Instance;
|
||||
|
||||
if (popupManger.PopupsToShow.Count == 0)
|
||||
{
|
||||
__instance._okCancelPopup.ResetPopup();
|
||||
__instance.SetUpMainMenu();
|
||||
__instance.FadeInMenuOptions();
|
||||
return false;
|
||||
}
|
||||
|
||||
popupManger.ActivePopup = popupManger.PopupsToShow.OrderBy(x => x).First();
|
||||
var message = popupManger.Popups[popupManger.ActivePopup];
|
||||
|
||||
__instance._inputModule.EnableInputs();
|
||||
__instance._titleMenuRaycastBlocker.blocksRaycasts = false;
|
||||
__instance._okCancelPopup.ResetPopup();
|
||||
__instance._okCancelPopup.SetUpPopup(message, InputLibrary.menuConfirm, null, __instance._continuePrompt, null, true, false);
|
||||
__instance._okCancelPopup.OnPopupConfirm += __instance.OnUserConfirmStartupPopup;
|
||||
__instance._okCancelPopup.EnableMenu(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool OnUserConfirmStartupPopup(TitleScreenManager __instance)
|
||||
{
|
||||
var popupManger = StartupPopupManager.Instance;
|
||||
|
||||
popupManger.PopupsToShow.Remove(popupManger.ActivePopup);
|
||||
|
||||
if (popupManger.ActivePopup <= 2)
|
||||
{
|
||||
switch (popupManger.ActivePopup)
|
||||
{
|
||||
case 0:
|
||||
PlayerData.SetShownPopups(StartupPopups.ResetInputs);
|
||||
break;
|
||||
case 1:
|
||||
PlayerData.SetShownPopups(StartupPopups.ReducedFrights);
|
||||
break;
|
||||
case 2:
|
||||
PlayerData.SetShownPopups(StartupPopups.NewExhibit);
|
||||
break;
|
||||
}
|
||||
|
||||
PlayerData.SaveCurrentGame();
|
||||
}
|
||||
|
||||
popupManger.ActivePopup = -1;
|
||||
__instance._okCancelPopup.OnPopupConfirm -= __instance.OnUserConfirmStartupPopup;
|
||||
__instance._inputModule.DisableInputs();
|
||||
__instance._titleMenuRaycastBlocker.blocksRaycasts = true;
|
||||
__instance.TryShowStartupPopupsAndShowMenu(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryShowStartupPopupsAndShowMenu(TitleScreenManager __instance)
|
||||
{
|
||||
var popupManger = StartupPopupManager.Instance;
|
||||
|
||||
if (popupManger.PopupsToShow.Count == 0)
|
||||
{
|
||||
__instance._okCancelPopup.ResetPopup();
|
||||
__instance.SetUpMainMenu();
|
||||
__instance.FadeInMenuOptions();
|
||||
return false;
|
||||
}
|
||||
|
||||
__instance.TryShowStartupPopups();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryShowStartupPopups(TitleScreenManager __instance)
|
||||
{
|
||||
var popupManger = StartupPopupManager.Instance;
|
||||
|
||||
popupManger.ActivePopup = popupManger.PopupsToShow.First();
|
||||
var message = popupManger.Popups[popupManger.ActivePopup];
|
||||
|
||||
__instance._inputModule.EnableInputs();
|
||||
__instance._titleMenuRaycastBlocker.blocksRaycasts = false;
|
||||
__instance._okCancelPopup.ResetPopup();
|
||||
__instance._okCancelPopup.SetUpPopup(message, InputLibrary.menuConfirm, null, __instance._continuePrompt, null, true, false);
|
||||
__instance._okCancelPopup.OnPopupConfirm += __instance.OnUserConfirmStartupPopup;
|
||||
__instance._okCancelPopup.EnableMenu(true);
|
||||
|
||||
return false;
|
||||
Main.Helper.MenuHelper.PopupMenuManager.RegisterStartupPopup(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
"name": "Menu Framework",
|
||||
"description": "Custom menu framework/wrapper.",
|
||||
"uniqueName": "_nebula.MenuFramework",
|
||||
"version": "4.0.0",
|
||||
"owmlVersion": "2.9.8"
|
||||
"version": "5.0.0",
|
||||
"owmlVersion": "2.10.1"
|
||||
}
|
||||
@ -7,5 +7,5 @@
|
||||
<package id="MonoMod.RuntimeDetour" version="21.8.19.1" targetFramework="net48" />
|
||||
<package id="MonoMod.Utils" version="21.8.19.1" targetFramework="net48" />
|
||||
<package id="OuterWildsGameLibs" version="1.1.14.768" targetFramework="net48" />
|
||||
<package id="OWML" version="2.9.8" targetFramework="net48" />
|
||||
<package id="OWML" version="2.10.1" targetFramework="net48" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user