mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add repeatPopup field to addon-manifest
This commit is contained in:
parent
f92e1cf59b
commit
87372466ad
5
NewHorizons/External/Configs/AddonConfig.cs
vendored
5
NewHorizons/External/Configs/AddonConfig.cs
vendored
@ -26,5 +26,10 @@ namespace NewHorizons.External.Configs
|
|||||||
/// A pop-up message for the first time a user runs the add-on
|
/// A pop-up message for the first time a user runs the add-on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string popupMessage;
|
public string popupMessage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If popupMessage is set, should it repeat every time the game starts or only once
|
||||||
|
/// </summary>
|
||||||
|
public bool repeatPopup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -701,7 +701,7 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(addonConfig.popupMessage))
|
if (!string.IsNullOrEmpty(addonConfig.popupMessage))
|
||||||
{
|
{
|
||||||
MenuHandler.RegisterOneTimePopup(mod, TranslationHandler.GetTranslation(addonConfig.popupMessage, TranslationHandler.TextType.UI));
|
MenuHandler.RegisterOneTimePopup(mod, TranslationHandler.GetTranslation(addonConfig.popupMessage, TranslationHandler.TextType.UI), addonConfig.repeatPopup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace NewHorizons.OtherMods.MenuFramework
|
|||||||
{
|
{
|
||||||
private static IMenuAPI _menuApi;
|
private static IMenuAPI _menuApi;
|
||||||
|
|
||||||
private static List<(IModBehaviour mod, string message)> _registeredPopups = new();
|
private static List<(IModBehaviour mod, string message, bool repeat)> _registeredPopups = new();
|
||||||
private static List<string> _failedFiles = new();
|
private static List<string> _failedFiles = new();
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@ -38,9 +38,9 @@ namespace NewHorizons.OtherMods.MenuFramework
|
|||||||
_menuApi.RegisterStartupPopup(warning);
|
_menuApi.RegisterStartupPopup(warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var (mod, message) in _registeredPopups)
|
foreach(var (mod, message, repeat) in _registeredPopups)
|
||||||
{
|
{
|
||||||
if (!NewHorizonsData.HasReadOneTimePopup(mod.ModHelper.Manifest.UniqueName))
|
if (repeat || !NewHorizonsData.HasReadOneTimePopup(mod.ModHelper.Manifest.UniqueName))
|
||||||
{
|
{
|
||||||
_menuApi.RegisterStartupPopup(TranslationHandler.GetTranslation(message, TranslationHandler.TextType.UI));
|
_menuApi.RegisterStartupPopup(TranslationHandler.GetTranslation(message, TranslationHandler.TextType.UI));
|
||||||
NewHorizonsData.ReadOneTimePopup(mod.ModHelper.Manifest.UniqueName);
|
NewHorizonsData.ReadOneTimePopup(mod.ModHelper.Manifest.UniqueName);
|
||||||
@ -64,6 +64,6 @@ namespace NewHorizons.OtherMods.MenuFramework
|
|||||||
|
|
||||||
public static void RegisterFailedConfig(string filename) => _failedFiles.Add(filename);
|
public static void RegisterFailedConfig(string filename) => _failedFiles.Add(filename);
|
||||||
|
|
||||||
public static void RegisterOneTimePopup(IModBehaviour mod, string message) => _registeredPopups.Add((mod, message));
|
public static void RegisterOneTimePopup(IModBehaviour mod, string message, bool repeat) => _registeredPopups.Add((mod, message, repeat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user