Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_XUiC_NewContinueGame.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

50 lines
2.0 KiB
C#

namespace Harmony.XUiC
{
public class XUiC_NewContinueGamePatches
{
[HarmonyPatch(typeof(XUiC_NewContinueGame))]
[HarmonyPatch("BtnConfirmDelete_OnPressed")]
public class BtnConfirmDelete_OnPressedPatch
{
public static bool Prefix(XUiC_NewContinueGame __instance, XUiController _sender, int _mouseButton)
{
XUiC_SavegamesList.ListEntry entry = __instance.savesList.SelectedEntry.GetEntry();
string SaveDataPath = SaveDataPath = GameIO.GetUserGameDataDir() + "/RebirthData/Scenarios";
string scenarioPath = $"{SaveDataPath}/{entry.worldName}/{entry.saveName}";
if (System.IO.Directory.Exists(scenarioPath))
{
Directory.Delete(scenarioPath, true);
}
return true;
}
}
[HarmonyPatch(typeof(XUiC_NewContinueGame))]
[HarmonyPatch("OnOpen")]
public class OnOpenPatch
{
public static bool Prefix(XUiC_NewContinueGame __instance)
{
//Log.Out("XUiC_NewContinueGamePatches-OnOpen START");
CustomGameOptions.LoadGameOptions(null, __instance.isContinueGame);
return true;
}
}
/*[HarmonyPatch(typeof(XUiC_NewContinueGame))]
[HarmonyPatch("CbxWorldName_OnValueChanged")]
public class CbxWorldName_OnValueChangedPatch
{
public static void Postfix(XUiC_NewContinueGame __instance, XUiController _sender, XUiC_NewContinueGame.LevelInfo _oldValue, XUiC_NewContinueGame.LevelInfo _newValue)
{
Log.Out("XUiC_NewContinueGamePatches-CbxWorldName_OnValueChanged world: " + GamePrefs.GetString(EnumGamePrefs.GameWorld));
Log.Out("XUiC_NewContinueGamePatches-CbxWorldName_OnValueChanged game: " + GamePrefs.GetString(EnumGamePrefs.GameName));
CustomGameOptions.LoadGameOptions(null);
}
}*/
}
}