From 72f85fd952c8e53230c968ef9a433644dae90254 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 27 Aug 2024 22:21:18 -0700 Subject: Initial Version 1.0.0.0 --- SamplePlugin/Configuration.cs | 20 -------- SamplePlugin/Dalamud.Plugin.Bootstrap.targets | 11 ---- SamplePlugin/Plugin.cs | 73 --------------------------- SamplePlugin/SamplePlugin.csproj | 19 ------- SamplePlugin/SamplePlugin.json | 12 ----- SamplePlugin/Windows/ConfigWindow.cs | 59 ---------------------- SamplePlugin/Windows/MainWindow.cs | 58 --------------------- SamplePlugin/packages.lock.json | 13 ----- 8 files changed, 265 deletions(-) delete mode 100644 SamplePlugin/Configuration.cs delete mode 100644 SamplePlugin/Dalamud.Plugin.Bootstrap.targets delete mode 100644 SamplePlugin/Plugin.cs delete mode 100644 SamplePlugin/SamplePlugin.csproj delete mode 100644 SamplePlugin/SamplePlugin.json delete mode 100644 SamplePlugin/Windows/ConfigWindow.cs delete mode 100644 SamplePlugin/Windows/MainWindow.cs delete mode 100644 SamplePlugin/packages.lock.json (limited to 'SamplePlugin') diff --git a/SamplePlugin/Configuration.cs b/SamplePlugin/Configuration.cs deleted file mode 100644 index 4cdc476..0000000 --- a/SamplePlugin/Configuration.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Dalamud.Configuration; -using Dalamud.Plugin; -using System; - -namespace SamplePlugin; - -[Serializable] -public class Configuration : IPluginConfiguration -{ - public int Version { get; set; } = 0; - - public bool IsConfigWindowMovable { get; set; } = true; - public bool SomePropertyToBeSavedAndWithADefault { get; set; } = true; - - // the below exist just to make saving less cumbersome - public void Save() - { - Plugin.PluginInterface.SavePluginConfig(this); - } -} diff --git a/SamplePlugin/Dalamud.Plugin.Bootstrap.targets b/SamplePlugin/Dalamud.Plugin.Bootstrap.targets deleted file mode 100644 index 11eec9c..0000000 --- a/SamplePlugin/Dalamud.Plugin.Bootstrap.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - $(appdata)\XIVLauncher\addon\Hooks\dev\ - $(HOME)/.xlcore/dalamud/Hooks/dev/ - $(HOME)/Library/Application Support/XIV on Mac/dalamud/Hooks/dev/ - $(DALAMUD_HOME)/ - - - - 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(); -} diff --git a/SamplePlugin/SamplePlugin.csproj b/SamplePlugin/SamplePlugin.csproj deleted file mode 100644 index e952b44..0000000 --- a/SamplePlugin/SamplePlugin.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - 0.0.0.1 - A sample plugin. - https://github.com/goatcorp/SamplePlugin - AGPL-3.0-or-later - false - - - - - PreserveNewest - false - - - diff --git a/SamplePlugin/SamplePlugin.json b/SamplePlugin/SamplePlugin.json deleted file mode 100644 index c806554..0000000 --- a/SamplePlugin/SamplePlugin.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Author": "your name here", - "Name": "Sample Plugin", - "Punchline": "A short one-liner that shows up in /xlplugins.", - "Description": "A description that shows up in /xlplugins. List any major slash-command(s).", - "ApplicableVersion": "any", - "Tags": [ - "sample", - "plugin", - "goats" - ] -} diff --git a/SamplePlugin/Windows/ConfigWindow.cs b/SamplePlugin/Windows/ConfigWindow.cs deleted file mode 100644 index 0a0af98..0000000 --- a/SamplePlugin/Windows/ConfigWindow.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Windowing; -using ImGuiNET; - -namespace SamplePlugin.Windows; - -public class ConfigWindow : Window, IDisposable -{ - private Configuration Configuration; - - // We give this window a constant ID using ### - // This allows for labels being dynamic, like "{FPS Counter}fps###XYZ counter window", - // and the window ID will always be "###XYZ counter window" for ImGui - public ConfigWindow(Plugin plugin) : base("A Wonderful Configuration Window###With a constant ID") - { - Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | - ImGuiWindowFlags.NoScrollWithMouse; - - Size = new Vector2(232, 90); - SizeCondition = ImGuiCond.Always; - - Configuration = plugin.Configuration; - } - - public void Dispose() { } - - public override void PreDraw() - { - // Flags must be added or removed before Draw() is being called, or they won't apply - if (Configuration.IsConfigWindowMovable) - { - Flags &= ~ImGuiWindowFlags.NoMove; - } - else - { - Flags |= ImGuiWindowFlags.NoMove; - } - } - - public override void Draw() - { - // can't ref a property, so use a local copy - var configValue = Configuration.SomePropertyToBeSavedAndWithADefault; - if (ImGui.Checkbox("Random Config Bool", ref configValue)) - { - Configuration.SomePropertyToBeSavedAndWithADefault = configValue; - // can save immediately on change, if you don't want to provide a "Save and Close" button - Configuration.Save(); - } - - var movable = Configuration.IsConfigWindowMovable; - if (ImGui.Checkbox("Movable Config Window", ref movable)) - { - Configuration.IsConfigWindowMovable = movable; - Configuration.Save(); - } - } -} diff --git a/SamplePlugin/Windows/MainWindow.cs b/SamplePlugin/Windows/MainWindow.cs deleted file mode 100644 index 9ac6a4d..0000000 --- a/SamplePlugin/Windows/MainWindow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Internal; -using Dalamud.Interface.Utility; -using Dalamud.Interface.Windowing; -using Dalamud.Plugin.Services; -using ImGuiNET; - -namespace SamplePlugin.Windows; - -public class MainWindow : Window, IDisposable -{ - private string GoatImagePath; - private Plugin Plugin; - - // We give this window a hidden ID using ## - // So that the user will see "My Amazing Window" as window title, - // but for ImGui the ID is "My Amazing Window##With a hidden ID" - public MainWindow(Plugin plugin, string goatImagePath) - : base("My Amazing Window##With a hidden ID", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) - { - SizeConstraints = new WindowSizeConstraints - { - MinimumSize = new Vector2(375, 330), - MaximumSize = new Vector2(float.MaxValue, float.MaxValue) - }; - - GoatImagePath = goatImagePath; - Plugin = plugin; - } - - public void Dispose() { } - - public override void Draw() - { - ImGui.Text($"The random config bool is {Plugin.Configuration.SomePropertyToBeSavedAndWithADefault}"); - - if (ImGui.Button("Show Settings")) - { - Plugin.ToggleConfigUI(); - } - - ImGui.Spacing(); - - ImGui.Text("Have a goat:"); - var goatImage = Plugin.TextureProvider.GetFromFile(GoatImagePath).GetWrapOrDefault(); - if (goatImage != null) - { - ImGuiHelpers.ScaledIndent(55f); - ImGui.Image(goatImage.ImGuiHandle, new Vector2(goatImage.Width, goatImage.Height)); - ImGuiHelpers.ScaledIndent(-55f); - } - else - { - ImGui.Text("Image not found."); - } - } -} diff --git a/SamplePlugin/packages.lock.json b/SamplePlugin/packages.lock.json deleted file mode 100644 index 19fcea9..0000000 --- a/SamplePlugin/packages.lock.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": 1, - "dependencies": { - "net8.0-windows7.0": { - "DalamudPackager": { - "type": "Direct", - "requested": "[2.1.13, )", - "resolved": "2.1.13", - "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" - } - } - } -} \ No newline at end of file -- cgit v1.2.3