diff --git a/projectTemplates/BSIPA Plugin (Core)/$safeprojectname$.csproj b/projectTemplates.old/BSIPA Plugin (Core)/$safeprojectname$.csproj similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/$safeprojectname$.csproj rename to projectTemplates.old/BSIPA Plugin (Core)/$safeprojectname$.csproj diff --git a/projectTemplates/BSIPA Plugin (Core)/$safeprojectname$Controller.cs b/projectTemplates.old/BSIPA Plugin (Core)/$safeprojectname$Controller.cs similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/$safeprojectname$Controller.cs rename to projectTemplates.old/BSIPA Plugin (Core)/$safeprojectname$Controller.cs diff --git a/projectTemplates/BSIPA Plugin (Core)/.template.config/template.json b/projectTemplates.old/BSIPA Plugin (Core)/.template.config/template.json similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/.template.config/template.json rename to projectTemplates.old/BSIPA Plugin (Core)/.template.config/template.json diff --git a/projectTemplates/BSIPA Plugin (Core)/Directory.Build.props b/projectTemplates.old/BSIPA Plugin (Core)/Directory.Build.props similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/Directory.Build.props rename to projectTemplates.old/BSIPA Plugin (Core)/Directory.Build.props diff --git a/projectTemplates/BSIPA Plugin (Core)/Directory.Build.targets b/projectTemplates.old/BSIPA Plugin (Core)/Directory.Build.targets similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/Directory.Build.targets rename to projectTemplates.old/BSIPA Plugin (Core)/Directory.Build.targets diff --git a/projectTemplates/BSIPA Plugin (Core)/Plugin.cs b/projectTemplates.old/BSIPA Plugin (Core)/Plugin.cs similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/Plugin.cs rename to projectTemplates.old/BSIPA Plugin (Core)/Plugin.cs diff --git a/projectTemplates/BSIPA Plugin (Core)/PluginConfig.cs b/projectTemplates.old/BSIPA Plugin (Core)/PluginConfig.cs similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/PluginConfig.cs rename to projectTemplates.old/BSIPA Plugin (Core)/PluginConfig.cs diff --git a/projectTemplates/BSIPA Plugin (Core)/Properties/AssemblyInfo.cs b/projectTemplates.old/BSIPA Plugin (Core)/Properties/AssemblyInfo.cs similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/Properties/AssemblyInfo.cs rename to projectTemplates.old/BSIPA Plugin (Core)/Properties/AssemblyInfo.cs diff --git a/projectTemplates/BSIPA Plugin (Core)/beat_saber.ico b/projectTemplates.old/BSIPA Plugin (Core)/beat_saber.ico similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/beat_saber.ico rename to projectTemplates.old/BSIPA Plugin (Core)/beat_saber.ico diff --git a/projectTemplates/BSIPA Plugin (Core)/manifest.json b/projectTemplates.old/BSIPA Plugin (Core)/manifest.json similarity index 100% rename from projectTemplates/BSIPA Plugin (Core)/manifest.json rename to projectTemplates.old/BSIPA Plugin (Core)/manifest.json diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/$safeprojectname$.csproj b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/$safeprojectname$.csproj similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/$safeprojectname$.csproj rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/$safeprojectname$.csproj diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/.template.config/template.json b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/.template.config/template.json similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/.template.config/template.json rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/.template.config/template.json diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Configuration/PluginConfig.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Configuration/PluginConfig.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Configuration/PluginConfig.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Configuration/PluginConfig.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.props b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.props similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.props rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.props diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.targets b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.targets similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.targets rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Directory.Build.targets diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/FlowCoordinators/$safeprojectname$FlowCoordinator.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/FlowCoordinators/$safeprojectname$FlowCoordinator.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/FlowCoordinators/$safeprojectname$FlowCoordinator.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/FlowCoordinators/$safeprojectname$FlowCoordinator.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$AppInstaller.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$AppInstaller.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$AppInstaller.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$AppInstaller.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$GameInstaller.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$GameInstaller.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$GameInstaller.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$GameInstaller.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$MenuInstaller.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$MenuInstaller.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$MenuInstaller.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Installers/$safeprojectname$MenuInstaller.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Managers/$safeprojectname$Manager.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Managers/$safeprojectname$Manager.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Managers/$safeprojectname$Manager.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Managers/$safeprojectname$Manager.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Plugin.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Plugin.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/Plugin.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/Plugin.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/UI/$safeprojectname$ViewController.cs b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/UI/$safeprojectname$ViewController.cs similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/UI/$safeprojectname$ViewController.cs rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/UI/$safeprojectname$ViewController.cs diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/UI/BSML/$safeprojectname$View.bsml b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/UI/BSML/$safeprojectname$View.bsml similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/UI/BSML/$safeprojectname$View.bsml rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/UI/BSML/$safeprojectname$View.bsml diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/beat_saber.ico b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/beat_saber.ico similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/beat_saber.ico rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/beat_saber.ico diff --git a/projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/manifest.json b/projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/manifest.json similarity index 100% rename from projectTemplates/BSIPA4 Plugin (Barebones Zenject Project)/manifest.json rename to projectTemplates.old/BSIPA4 Plugin (Barebones Zenject Project)/manifest.json diff --git a/projectTemplates/BSIPA Plugin (Bare)/.template.config/template.json b/projectTemplates/BSIPA Plugin (Bare)/.template.config/template.json new file mode 100644 index 0000000..fd59694 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (Bare)/.template.config/template.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://json.schemastore.org/template", + "author": "qqrz997", + "classifications": [ + "Common", + "Library" + ], + "identity": "BSIPA.Plugin.Bare", + "name": "BSIPA Plugin (Bare)", + "defaultName": "BeatSaberPlugin", + "description": "A bare-minimum template for a new Beat Saber IPA mod.", + "shortName": "bsbare", + "sourceName": "BarePlugin", + "tags": { + "language": "C#", + "type": "project", + "platform": ".NET" + }, + "preferNameDirectory": true, + "symbols": { + "ModVersion": { + "type": "parameter", + "description": "The version of the mod. Must be of format major.minor.patch.", + "datatype": "text", + "replaces": "{ModVersion}", + "defaultValue": "0.0.1", + "displayName": "Mod Version" + }, + "ModAuthor": { + "type": "parameter", + "description": "The name of who is developing the mod.", + "datatype": "text", + "replaces": "{ModAuthor}", + "displayName": "Author", + "defaultValue": "" + }, + "ModDescription": { + "type": "parameter", + "description": "A short sentence describing the mod's features.", + "datatype": "text", + "replaces": "{ModDescription}", + "displayName": "Description", + "defaultValue": "" + }, + "GameVersion": { + "type": "parameter", + "description": "Version of the game you are developing for.", + "datatype": "text", + "replaces": "{GameVersion}", + "displayName": "Game Version", + "defaultValue": "1.40.0" + }, + "Nullable": { + "type": "parameter", + "description": "Use nullable reference types. (Recommended)", + "datatype": "bool", + "replaces": "{Nullable}", + "defaultValue": "true" + }, + "EnableHints": { + "type": "parameter", + "description": "Includes code comments that provide helpful information.", + "datatype": "bool", + "displayName": "Enable Hints", + "defaultValue": "true" + } + }, + "primaryOutputs": [ + {"path": "Plugin.cs" } + ], + "postActions": [ + { + "condition": "(HostIdentifier != \"dotnetcli\")", + "description": "Opens Plugin.cs in the editor", + "manualInstructions": [ ], + "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6", + "args": { + "files": "0" + }, + "continueOnError": true + } + ] +} \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (Bare)/BarePlugin.csproj b/projectTemplates/BSIPA Plugin (Bare)/BarePlugin.csproj new file mode 100644 index 0000000..2c71418 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (Bare)/BarePlugin.csproj @@ -0,0 +1,85 @@ + + + + + + net472 + + + + + latest + + enable + + disable + + true + true + $(BeatSaberDir)\Beat Saber_Data\Managed + false + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll + false + + + $(BeatSaberDir)\Plugins\BSML.dll + false + + + $(BeatSaberDir)\Libs\Hive.Versioning.dll + false + + + $(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll + false + + + $(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll + false + + + + + + + $(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll + false + + + $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.dll + false + + + $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll + false + + + $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll + False + + + $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll + False + + + $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIModule.dll + False + + + + \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (Bare)/Directory.Build.props b/projectTemplates/BSIPA Plugin (Bare)/Directory.Build.props new file mode 100644 index 0000000..0f69e3e --- /dev/null +++ b/projectTemplates/BSIPA Plugin (Bare)/Directory.Build.props @@ -0,0 +1,33 @@ + + + + + + + BarePlugin + BarePlugin + {ModAuthor} + {ModVersion} + {GameVersion} + {ModDescription} + + + + + + + + + + + + + BSIPA + true + + + + true + + + \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (Bare)/Plugin.cs b/projectTemplates/BSIPA Plugin (Bare)/Plugin.cs new file mode 100644 index 0000000..5f31b31 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (Bare)/Plugin.cs @@ -0,0 +1,34 @@ +using IPA; +using IPA.Loader; +using IpaLogger = IPA.Logging.Logger; + +namespace BarePlugin; + +[Plugin(RuntimeOptions.DynamicInit)] +internal class Plugin +{ + internal static IpaLogger Log { get; private set; } = null!; +#if (EnableHints) + // Methods with [Init] are called when the plugin is first loaded by IPA. + // All the parameters are provided by IPA and are optional. + // The constructor is called before any method with [Init]. Only use [Init] with one constructor. +#endif + [Init] + public Plugin(IpaLogger ipaLogger, PluginMetadata pluginMetadata) + { + Log = ipaLogger; + Log.Info($"{pluginMetadata.Name} {pluginMetadata.HVersion} initialized."); + } + + [OnStart] + public void OnApplicationStart() + { + Log.Debug("OnApplicationStart"); + } + + [OnExit] + public void OnApplicationQuit() + { + Log.Debug("OnApplicationQuit"); + } +} \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (Core)/$safeprojectname$.csproj.user b/projectTemplates/BSIPA Plugin (Core)/$safeprojectname$.csproj.user deleted file mode 100644 index 70913ad..0000000 --- a/projectTemplates/BSIPA Plugin (Core)/$safeprojectname$.csproj.user +++ /dev/null @@ -1,7 +0,0 @@ - - - - - $SomeBeatSaberDir$ - - \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (UI)/.template.config/template.json b/projectTemplates/BSIPA Plugin (UI)/.template.config/template.json new file mode 100644 index 0000000..aa3abb9 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (UI)/.template.config/template.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://json.schemastore.org/template", + "author": "qqrz997", + "classifications": [ + "Common", + "Library" + ], + "identity": "BSIPA.Plugin.UI", + "name": "BSIPA Plugin (UI)", + "defaultName": "BeatSaberPlugin", + "description": "A template for a new Beat Saber IPA mod with a basic UI setup using BeatSaberMarkupLanguage.", + "shortName": "bsui", + "sourceName": "MenuPlugin", + "tags": { + "language": "C#", + "type": "project", + "platform": ".NET" + }, + "preferNameDirectory": true, + "symbols": { + "ModVersion": { + "type": "parameter", + "description": "The version of the mod. Must be of format major.minor.patch.", + "datatype": "text", + "replaces": "{ModVersion}", + "defaultValue": "0.0.1", + "displayName": "Mod Version" + }, + "ModAuthor": { + "type": "parameter", + "description": "The name of who is developing the mod.", + "datatype": "text", + "replaces": "{ModAuthor}", + "displayName": "Author", + "defaultValue": "" + }, + "ModDescription": { + "type": "parameter", + "description": "A short sentence describing the mod's features.", + "datatype": "text", + "replaces": "{ModDescription}", + "displayName": "Description", + "defaultValue": "" + }, + "GameVersion": { + "type": "parameter", + "description": "Version of the game you are developing for.", + "datatype": "text", + "replaces": "{GameVersion}", + "displayName": "Game Version", + "defaultValue": "1.40.0" + }, + "Nullable": { + "type": "parameter", + "description": "Use nullable reference types. (Recommended)", + "datatype": "bool", + "replaces": "{Nullable}", + "defaultValue": "true" + }, + "EnableHints": { + "type": "parameter", + "description": "Includes code comments that provide helpful information.", + "datatype": "bool", + "displayName": "Enable Hints", + "defaultValue": "true" + } + }, + "primaryOutputs": [ + {"path": "Plugin.cs" } + ], + "postActions": [ + { + "condition": "(HostIdentifier != \"dotnetcli\")", + "description": "Opens Plugin.cs in the editor", + "manualInstructions": [ ], + "actionId": "84C0DA21-51C8-4541-9940-6CA19AF04EE6", + "args": { + "files": "0" + }, + "continueOnError": true + } + ] +} \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (UI)/Directory.Build.props b/projectTemplates/BSIPA Plugin (UI)/Directory.Build.props new file mode 100644 index 0000000..b4890e0 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (UI)/Directory.Build.props @@ -0,0 +1,34 @@ + + + + + + + MenuPlugin + MenuPlugin + {ModAuthor} + {ModVersion} + {GameVersion} + {ModDescription} + + + + + + + + + + + + + + BSIPA + true + + + + true + + + \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (UI)/Menu/ExampleSettingsMenu.cs b/projectTemplates/BSIPA Plugin (UI)/Menu/ExampleSettingsMenu.cs new file mode 100644 index 0000000..e7fd07c --- /dev/null +++ b/projectTemplates/BSIPA Plugin (UI)/Menu/ExampleSettingsMenu.cs @@ -0,0 +1,41 @@ +using BeatSaberMarkupLanguage.Attributes; +using HMUI; +using TMPro; +using UnityEngine; + +namespace MenuPlugin.Menu; +#if (EnableHints) +// This class is for managing the BSML resource and interact with the UI object in game. +// To see more about components read the BSML docs. https://monkeymanboy.github.io/BSML-Docs/ +#endif +internal class ExampleSettingsMenu : MonoBehaviour +{ +#if (EnableHints) + // [UIComponent] will get a specified component from the BSML object with the matching id +#endif + [UIComponent("example-image")] + private readonly ImageView exampleImage = null!; + + [UIComponent("example-text")] + private readonly TextMeshProUGUI exampleText = null!; + +#if (EnableHints) + // The #post-parse event is provided by BSML. This action is invoked after BSML has parsed this object and + // all [UIComponent] and [UIObject] members have been populated. Any initialization logic for the menu should + // be done in here, rather than in Unity's Awake or Start events. +#endif + [UIAction("#post-parse")] + private void PostParse() + { + Plugin.Log.Debug($"{name} parsed"); + } +#if (EnableHints) + // [UIAction] will be used by UI elements like buttons to invoke methods such as the one here. +#endif + [UIAction("example-action")] + private void ExampleAction() + { + exampleImage.color = Color.white; + exampleText.text = "Hello World!"; + } +} \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (UI)/Menu/SettingsMenuManager.cs b/projectTemplates/BSIPA Plugin (UI)/Menu/SettingsMenuManager.cs new file mode 100644 index 0000000..bf02858 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (UI)/Menu/SettingsMenuManager.cs @@ -0,0 +1,39 @@ +using BeatSaberMarkupLanguage.Settings; +using UnityEngine; + +namespace MenuPlugin.Menu; + +internal static class SettingsMenuManager +{ +#if (Nullable) + private static ExampleSettingsMenu? Instance { get; set; } +#else + private static ExampleSettingsMenu Instance { get; set; } +#endif + + private const string MenuName = nameof(MenuPlugin); + private const string ResourcePath = nameof(MenuPlugin) + ".Menu.example.bsml"; +#if (EnableHints) + /// + /// Adds a custom menu in the Mod Settings section of the main menu. + /// This should only be called when the main menu is active. + /// +#endif + public static void AddSettingsMenu() + { + if (Instance == null) + { + Instance = new GameObject(nameof(ExampleSettingsMenu)).AddComponent(); + Object.DontDestroyOnLoad(Instance.gameObject); + } + + RemoveSettingsMenu(); + + BSMLSettings.Instance.AddSettingsMenu(MenuName, ResourcePath, Instance); + } + + public static void RemoveSettingsMenu() + { + BSMLSettings.Instance.RemoveSettingsMenu(Instance); + } +} \ No newline at end of file diff --git a/projectTemplates/BSIPA Plugin (UI)/Menu/example.bsml b/projectTemplates/BSIPA Plugin (UI)/Menu/example.bsml new file mode 100644 index 0000000..20f06b3 --- /dev/null +++ b/projectTemplates/BSIPA Plugin (UI)/Menu/example.bsml @@ -0,0 +1,7 @@ + + +