diff --git a/Constants.cs b/Constants.cs new file mode 100644 index 0000000..943fef0 --- /dev/null +++ b/Constants.cs @@ -0,0 +1,9 @@ +namespace GorillaCaptions +{ + internal class Constants + { + public const string Guid = "com.deez.gorillacaptions"; + public const string Name = "Deez's GorillaCaptions"; + public const string Version = "1.0.3"; + } +} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..f0b34aa --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,15 @@ + + + + C:\Program Files (x86)\Steam\steamapps\common\Gorilla Tag + $(GamePath)\Gorilla Tag_Data\Managed + $(GamePath)\BepInEx\core + $(GamePath)\BepInEx\plugins + + + .\Libs + .\Libs + .\Libs + 0 + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..a11df93 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,7 @@ + + + + + + + diff --git a/HarmonyPatches.cs b/HarmonyPatches.cs new file mode 100644 index 0000000..04be822 --- /dev/null +++ b/HarmonyPatches.cs @@ -0,0 +1,36 @@ +using HarmonyLib; +using System.Reflection; + +namespace GorillaCaptions +{ + public class HarmonyPatches + { + private static Harmony instance; + + public static bool IsPatched { get; private set; } + public const string InstanceId = Constants.Guid; + + internal static void ApplyHarmonyPatches() + { + if (!IsPatched) + { + if (instance == null) + { + instance = new Harmony(InstanceId); + } + + instance.PatchAll(Assembly.GetExecutingAssembly()); + IsPatched = true; + } + } + + internal static void RemoveHarmonyPatches() + { + if (instance != null && IsPatched) + { + instance.UnpatchSelf(); + IsPatched = false; + } + } + } +} diff --git a/Plugin.cs b/Plugin.cs new file mode 100644 index 0000000..e1bf3eb --- /dev/null +++ b/Plugin.cs @@ -0,0 +1,33 @@ +using BepInEx; +using GorillaCaptions.Classes.Admin; +using GorillaCaptions.Managers.DiscordRPC; +using UnityEngine; + +namespace GorillaCaptions; + +[BepInPlugin(Constants.Guid, Constants.Name, Constants.Version)] +public class Plugin : BaseUnityPlugin +{ + public static Plugin instance; + + void Awake() + { + instance = this; + Debug.Log(" Created by Deez <3"); + } + + void Start() + { + HarmonyPatches.ApplyHarmonyPatches(); + + GameObject ClassHolder = new("Deez's GorillaCaptions"); + ClassHolder.AddComponent(); + ClassHolder.AddComponent(); + ClassHolder.AddComponent(); + ClassHolder.AddComponent(); + ClassHolder.AddComponent(); + DontDestroyOnLoad(ClassHolder); + + Debug.Log(" Fully intialized"); + } +} \ No newline at end of file