diff options
Diffstat (limited to 'SamplePlugin/Plugin.cs')
| -rw-r--r-- | SamplePlugin/Plugin.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/SamplePlugin/Plugin.cs b/SamplePlugin/Plugin.cs deleted file mode 100644 index b8e859b..0000000 --- a/SamplePlugin/Plugin.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Dalamud.Game.Command; -using Dalamud.IoC; -using Dalamud.Plugin; -using System.IO; -using Dalamud.Interface.Windowing; -using Dalamud.Plugin.Services; -using SamplePlugin.Windows; - -namespace SamplePlugin; - -public sealed class Plugin : IDalamudPlugin -{ - [PluginService] internal static IDalamudPluginInterface PluginInterface { get; private set; } = null!; - [PluginService] internal static ITextureProvider TextureProvider { get; private set; } = null!; - [PluginService] internal static ICommandManager CommandManager { get; private set; } = null!; - - private const string CommandName = "/pmycommand"; - - public Configuration Configuration { get; init; } - - public readonly WindowSystem WindowSystem = new("SamplePlugin"); - private ConfigWindow ConfigWindow { get; init; } - private MainWindow MainWindow { get; init; } - - public Plugin() - { - Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); - - // you might normally want to embed resources and load them from the manifest stream - var goatImagePath = Path.Combine(PluginInterface.AssemblyLocation.Directory?.FullName!, "goat.png"); - - ConfigWindow = new ConfigWindow(this); - MainWindow = new MainWindow(this, goatImagePath); - - WindowSystem.AddWindow(ConfigWindow); - WindowSystem.AddWindow(MainWindow); - - CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) - { - HelpMessage = "A useful message to display in /xlhelp" - }); - - PluginInterface.UiBuilder.Draw += DrawUI; - - // This adds a button to the plugin installer entry of this plugin which allows - // to toggle the display status of the configuration ui - PluginInterface.UiBuilder.OpenConfigUi += ToggleConfigUI; - - // Adds another button that is doing the same but for the main ui of the plugin - PluginInterface.UiBuilder.OpenMainUi += ToggleMainUI; - } - - public void Dispose() - { - WindowSystem.RemoveAllWindows(); - - ConfigWindow.Dispose(); - MainWindow.Dispose(); - - CommandManager.RemoveHandler(CommandName); - } - - private void OnCommand(string command, string args) - { - // in response to the slash command, just toggle the display status of our main ui - ToggleMainUI(); - } - - private void DrawUI() => WindowSystem.Draw(); - - public void ToggleConfigUI() => ConfigWindow.Toggle(); - public void ToggleMainUI() => MainWindow.Toggle(); -} |
