Files
zzz_REBIRTH__Utils/Scripts/GameOptions/CustomOptionsConfig.cs
2025-06-04 16:44:53 +09:30

48 lines
1.5 KiB
C#

using IntegratedConfigs.Core.Entities;
using IntegratedConfigs.Scripts;
using System.Collections;
namespace YourNamespace
{
public class CustomOptionsConfig : IIntegratedConfig
{
public XmlLoadInfo RegistrationInfo { get; }
private const string XML_NAME = "CustomGameOptions";
// This provided here as
public static readonly string ModName = "zzz_REBIRTH__Utils";
public static readonly Mod Mod = ModManager.GetMod(ModName, true);
public static readonly string ModPath = Mod.Path;
// an example.
public CustomOptionsConfig()
{
//Log.Out("ModPath: " + ModPath);
string SaveDataPath = GameIO.GetUserGameDataDir() + "/RebirthData/";
Log.Out("Rebirth Data location: " + SaveDataPath);
CustomGameOptions.CheckConfigs();
//RegistrationInfo = new XmlLoadInfo(XML_NAME, $"{ModPath}/CustomGameOptions", false, true, OnLoad, null, OnLoadComplete);
RegistrationInfo = new XmlLoadInfo(XML_NAME, $"{SaveDataPath}", false, true, OnLoad, null, OnLoadComplete);
}
private IEnumerator OnLoad(XmlFile xmlFile)
{
Log.Out($"OnLoad called for custom XML: {XML_NAME}");
CustomGameOptions.LoadConfigs(xmlFile);
yield break;
}
private static IEnumerator OnLoadComplete()
{
Log.Out($"OnLoadComplete called for custom XML: {XML_NAME}");
yield break;
}
}
}