quantum-space-buddies/QSB/Patches/QSBPatchManager.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2020-11-03 21:11:10 +00:00
using OWML.Common;
using QSB.ConversationSync;
using QSB.DeathSync;
using QSB.ElevatorSync;
using QSB.OrbSync;
using QSB.TimeSync;
using QSB.Tools;
using QSB.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
namespace QSB.Patches
{
2020-11-04 20:01:28 +00:00
public delegate void PatchEvent(QSBPatchTypes type);
2020-11-03 21:11:10 +00:00
public static class QSBPatchManager
{
public static List<QSBPatch> _patchList = new List<QSBPatch>();
2020-11-04 20:01:28 +00:00
public static event PatchEvent OnPatchType;
2020-11-03 21:11:10 +00:00
public static void Init()
{
_patchList = new List<QSBPatch>
{
new ConversationPatches(),
new DeathPatches(),
new ElevatorPatches(),
new OrbPatches(),
new WakeUpPatches(),
new ProbePatches()
};
2020-11-04 09:34:01 +00:00
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
2020-11-03 21:11:10 +00:00
}
public static void DoPatchType(QSBPatchTypes type)
{
2020-11-06 22:05:43 +00:00
OnPatchType?.Invoke(type);
2020-11-04 20:01:28 +00:00
DebugLog.DebugWrite($"Patch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
2020-11-03 21:11:10 +00:00
foreach (var patch in _patchList.Where(x => x.Type == type))
{
2020-11-04 20:01:28 +00:00
DebugLog.DebugWrite($" - Patching in {patch.GetType().Name}", MessageType.Info);
2020-11-03 21:11:10 +00:00
patch.DoPatches();
}
}
}
}