diff --git a/ContentAPI/API/Components/CustomKeybind.cs b/ContentAPI/API/Components/CustomKeybind.cs index bd7ae25..9dc94e0 100644 --- a/ContentAPI/API/Components/CustomKeybind.cs +++ b/ContentAPI/API/Components/CustomKeybind.cs @@ -1,4 +1,4 @@ -namespace ContentAPI.API.Monobehavior +namespace ContentAPI.API.Components { using System.Linq; using UnityEngine; diff --git a/ContentAPI/API/Features/Modal.cs b/ContentAPI/API/Features/Modal.cs index 3dfaf1b..6e12afa 100644 --- a/ContentAPI/API/Features/Modal.cs +++ b/ContentAPI/API/Features/Modal.cs @@ -1,6 +1,7 @@ namespace ContentAPI.API.Features { using System.Collections.Generic; + using UnityEngine; /// /// Modal wrapper base class. @@ -29,7 +30,7 @@ public void Show() { if (Options.Count == 0) { - ContentPlugin.Log.LogInfo("No options present going in safe mode."); + Debug.Log("No options present going in safe mode."); global::Modal.ShowError(Title, Body); return; } diff --git a/ContentAPI/ContentBepinLoad.cs b/ContentAPI/ContentBepinLoad.cs new file mode 100644 index 0000000..bfa4843 --- /dev/null +++ b/ContentAPI/ContentBepinLoad.cs @@ -0,0 +1,12 @@ +namespace ContentAPI +{ + using BepInEx; + + using static ContentPlugin; + + /// + /// Handles loading the API through BepInEx. + /// + [BepInPlugin(ContentGuid, ContentName, ContentVersion)] + public class ContentBepinLoad : BaseUnityPlugin; +} \ No newline at end of file diff --git a/ContentAPI/ContentPlugin.cs b/ContentAPI/ContentPlugin.cs index 7c7858f..8b7feb2 100644 --- a/ContentAPI/ContentPlugin.cs +++ b/ContentAPI/ContentPlugin.cs @@ -1,72 +1,49 @@ namespace ContentAPI { - using BepInEx; - using BepInEx.Logging; - using ContentAPI.API.Monobehavior; - using HarmonyLib; + using ContentAPI.API.Components; using UnityEngine; - using UnityEngine.SceneManagement; /// /// Base class handling loading the plugin. /// - [BepInPlugin(ContentGuid, ContentName, ContentVersion)] [ContentWarningPlugin(ContentGuid, ContentVersion, ContentVanillaCompatible)] - public class ContentPlugin : BaseUnityPlugin + public static class ContentPlugin { /// /// The guid of the ContentAPI. /// public const string ContentGuid = "Circus.ContentAPI"; - private const string ContentName = "ContentAPI"; - private const string ContentVersion = "0.0.3"; - private const bool ContentVanillaCompatible = true; - - static ContentPlugin() - { - new GameObject("ContentAPI").AddComponent(); - } /// - /// Gets the instance of the plugin. + /// Gets the name to be used. /// - public static ContentPlugin Instance { get; private set; } + public const string ContentName = "ContentAPI"; /// - /// Gets the plugin Logger. + /// Gets the version of the API. /// - internal static ManualLogSource Log { get; private set; } + public const string ContentVersion = "0.0.3"; /// - /// Gets the Harmony. + /// Gets whether or not its compatible with vanilla. /// - internal static Harmony Harmony { get; private set; } + public const bool ContentVanillaCompatible = true; - private void Awake() + static ContentPlugin() { - if (Instance != null) - return; - - Instance = this; - Log = Logger; - Harmony = new(ContentGuid); - Harmony.PatchAll(); - - new GameObject("ContentAPI_CustomKeybindings").AddComponent(); - - Logger.LogInfo($"Plugin {ContentGuid}@{ContentVersion} is loaded!"); - DontDestroyOnLoad(gameObject); + CreateObjects(); } - private void Update() + /// + /// Gets the used by the API. + /// + public static GameObject GameObject { get; private set; } + + private static void CreateObjects() { - if (Input.GetKeyDown(KeyCode.F2)) - { - foreach (API.Features.Player player in API.Features.Player.List) - { - Log.LogInfo(player.SteamID.ToString()); - } - } + GameObject = new("ContentAPI"); + GameObject.AddComponent(); + Object.DontDestroyOnLoad(GameObject); } } } \ No newline at end of file diff --git a/ContentAPI/Example/InputShowcase.cs b/ContentAPI/Example/InputShowcase.cs index 4e4c9e2..30fe54a 100644 --- a/ContentAPI/Example/InputShowcase.cs +++ b/ContentAPI/Example/InputShowcase.cs @@ -14,7 +14,7 @@ public class InputShowcase : Input /// public override void ProcessInput() { - ContentPlugin.Log.LogInfo("YOOO! The player clicked Backspace."); + Debug.Log("YOOO! The player clicked Backspace."); } } } \ No newline at end of file diff --git a/ContentAPI/Example/ModalShowcase.cs b/ContentAPI/Example/ModalShowcase.cs index c3e93ca..fcc279d 100644 --- a/ContentAPI/Example/ModalShowcase.cs +++ b/ContentAPI/Example/ModalShowcase.cs @@ -1,6 +1,7 @@ namespace ContentAPI.Example { using System.Collections.Generic; + using UnityEngine; /// /// Showcase how a modal works. @@ -28,7 +29,7 @@ public ModalShowcase() /// protected override void OnClosed() { - ContentPlugin.Log.LogInfo("Cookie closed."); + Debug.Log("Cookie closed."); base.OnClosed(); } @@ -36,11 +37,11 @@ protected override void OnClosed() protected override void HandleButtonClick(int buttonNumber) { if (buttonNumber == 1) - ContentPlugin.Log.LogInfo("No cookie :("); + Debug.Log("No cookie :("); else if (buttonNumber == 2) - ContentPlugin.Log.LogInfo("Cookie :)"); + Debug.Log("Cookie :)"); else if (buttonNumber == 3) - ContentPlugin.Log.LogInfo("Wut bugged cookie??????"); + Debug.Log("Wut bugged cookie??????"); base.HandleButtonClick(buttonNumber); }