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

56 lines
1.4 KiB
C#
Raw Normal View History

2020-11-03 21:11:10 +00:00
using OWML.Common;
using QSB.ConversationSync.Patches;
using QSB.DeathSync.Patches;
using QSB.ElevatorSync.Patches;
using QSB.FrequencySync.Patches;
using QSB.LogSync.Patches;
using QSB.OrbSync.Patches;
using QSB.QuantumSync.Patches;
using QSB.TimeSync.Patches;
using QSB.TranslationSync.Patches;
2020-11-03 21:11:10 +00:00
using QSB.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
namespace QSB.Patches
{
2020-12-02 21:29:53 +00:00
public static class QSBPatchManager
{
2021-02-06 22:03:10 +00:00
public static event Action<QSBPatchTypes> OnPatchType;
2020-11-04 20:01:28 +00:00
2020-12-14 21:20:53 +00:00
private static List<QSBPatch> _patchList = new List<QSBPatch>();
2020-12-14 20:41:56 +00:00
2020-12-14 21:20:53 +00:00
public static void Init()
2020-12-02 21:29:53 +00:00
{
_patchList = new List<QSBPatch>
{
new ConversationPatches(),
new DeathPatches(),
new ElevatorPatches(),
new OrbPatches(),
2020-12-19 10:56:25 +00:00
new WakeUpPatches(),
2020-12-21 19:41:53 +00:00
new LogPatches(),
2020-12-22 21:39:53 +00:00
new QuantumVisibilityPatches(),
2021-01-18 12:33:07 +00:00
new ServerQuantumPatches(),
new ClientQuantumPatches(),
new FrequencyPatches(),
2021-01-18 12:33:07 +00:00
new SpiralPatches(),
new QuantumPatches()
2020-12-02 21:29:53 +00:00
};
2020-11-03 21:11:10 +00:00
2020-12-02 21:29:53 +00:00
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
}
2020-11-03 21:11:10 +00:00
2020-12-02 21:29:53 +00:00
public static void DoPatchType(QSBPatchTypes type)
{
2021-02-06 22:03:10 +00:00
OnPatchType?.SafeInvoke(type);
2020-12-02 21:29:53 +00:00
DebugLog.DebugWrite($"Patch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
foreach (var patch in _patchList.Where(x => x.Type == type))
{
DebugLog.DebugWrite($" - Patching in {patch.GetType().Name}", MessageType.Info);
patch.DoPatches();
}
}
}
2020-12-03 08:28:05 +00:00
}