aboutsummaryrefslogtreecommitdiffstats
path: root/SamplePlugin
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-08-27 22:21:18 -0700
committerPinapelz <yukais@pinapelz.com>2024-08-27 22:21:18 -0700
commit72f85fd952c8e53230c968ef9a433644dae90254 (patch)
treea93b73e9d045243cdc4ee467376ef8573f297d2c /SamplePlugin
parentb8c43fbe717d794284c6c4578c9c00ae8e26d711 (diff)
Initial Version 1.0.0.0
Diffstat (limited to 'SamplePlugin')
-rw-r--r--SamplePlugin/Configuration.cs20
-rw-r--r--SamplePlugin/Dalamud.Plugin.Bootstrap.targets11
-rw-r--r--SamplePlugin/Plugin.cs73
-rw-r--r--SamplePlugin/SamplePlugin.csproj19
-rw-r--r--SamplePlugin/SamplePlugin.json12
-rw-r--r--SamplePlugin/Windows/ConfigWindow.cs59
-rw-r--r--SamplePlugin/Windows/MainWindow.cs58
-rw-r--r--SamplePlugin/packages.lock.json13
8 files changed, 0 insertions, 265 deletions
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 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
- <PropertyGroup>
- <DalamudLibPath Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
- <DalamudLibPath Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(HOME)/.xlcore/dalamud/Hooks/dev/</DalamudLibPath>
- <DalamudLibPath Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(HOME)/Library/Application Support/XIV on Mac/dalamud/Hooks/dev/</DalamudLibPath>
- <DalamudLibPath Condition="$(DALAMUD_HOME) != ''">$(DALAMUD_HOME)/</DalamudLibPath>
- </PropertyGroup>
-
- <Import Project="$(DalamudLibPath)/targets/Dalamud.Plugin.targets"/>
-</Project>
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 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project Sdk="Microsoft.NET.Sdk">
- <Import Project="Dalamud.Plugin.Bootstrap.targets"/>
-
- <PropertyGroup>
- <Version>0.0.0.1</Version>
- <Description>A sample plugin.</Description>
- <PackageProjectUrl>https://github.com/goatcorp/SamplePlugin</PackageProjectUrl>
- <PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
- <IsPackable>false</IsPackable>
- </PropertyGroup>
-
- <ItemGroup>
- <Content Include="..\Data\goat.png">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- <Visible>false</Visible>
- </Content>
- </ItemGroup>
-</Project>
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage