TechbloxModdingAPI/GamecraftModdingAPI/Tests/GamecraftModdingAPIPluginTest.cs

68 lines
2.7 KiB
C#
Raw Normal View History

2019-12-13 05:00:11 +00:00
using System;
using System.Reflection;
2019-12-14 18:52:24 +00:00
using Harmony;
using GamecraftModdingAPI.Events;
using GamecraftModdingAPI.Utility;
2019-12-13 05:00:11 +00:00
2019-12-14 04:42:55 +00:00
namespace GamecraftModdingAPI.Tests
2019-12-13 05:00:11 +00:00
{
// unused by design
2019-12-14 18:52:24 +00:00
public class GamecraftModdingAPIPluginTest
#if DEBUG
: IllusionPlugin.IEnhancedPlugin
#endif
2019-12-13 05:00:11 +00:00
{
public static HarmonyInstance harmony { get; protected set; }
public string[] Filter { get; } = new string[] { "Gamecraft" };
2019-12-14 18:52:24 +00:00
public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name;
2019-12-13 05:00:11 +00:00
2019-12-14 18:52:24 +00:00
public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();
2019-12-13 05:00:11 +00:00
public string HarmonyID { get; } = "org.git.exmods.modtainers.gamecraftmoddingapi";
public void OnApplicationQuit()
{
2019-12-14 04:42:55 +00:00
GamecraftModdingAPI.Main.Shutdown();
2019-12-13 05:00:11 +00:00
}
public void OnApplicationStart()
{
2019-12-14 04:42:55 +00:00
GamecraftModdingAPI.Main.Init();
2019-12-14 18:52:24 +00:00
// in case Steam is not installed/running
// this will crash the game slightly later during startup
//SteamInitPatch.ForcePassSteamCheck = true;
// in case running in a VM
//MinimumSpecsCheckPatch.ForcePassMinimumSpecCheck = true;
// debug/test handlers
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("App Inited event!"); }, () => { },
EventType.ApplicationInitialized, "appinit API debug"));
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("Menu Activated event!"); },
() => { Logging.Log("Menu Destroyed event!"); },
EventType.Menu, "menuact API debug"));
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("Menu Switched To event!"); }, () => { },
EventType.MenuSwitchedTo, "menuswitch API debug"));
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("Game Activated event!"); },
() => { Logging.Log("Game Destroyed event!"); },
EventType.Game, "gameact API debug"));
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("Game Reloaded event!"); }, () => { },
EventType.GameReloaded, "gamerel API debug"));
Manager.AddEventHandler(new SimpleEventHandlerEngine(() => { Logging.Log("Game Switched To event!"); }, () => { },
EventType.GameSwitchedTo, "gameswitch API debug"));
2019-12-13 05:00:11 +00:00
}
public void OnFixedUpdate() { }
public void OnLateUpdate() { }
public void OnLevelWasInitialized(int level) { }
public void OnLevelWasLoaded(int level) { }
public void OnUpdate() { }
}
}