From 8fcc186566ee80fb9f359b8efceb5fb6aae15e04 Mon Sep 17 00:00:00 2001 From: Camille Date: Sat, 11 Dec 2021 12:02:01 +0100 Subject: [PATCH] cleanup --- SamplePlugin.sln => CurrencyAlert.sln | 62 +++++++++---------- README.md | 40 ------------ ...mplePlugin.csproj => CurrencyAlert.csproj} | 0 SamplePlugin/Plugin.cs | 8 +-- SamplePlugin/PluginUI.cs | 14 ++--- 5 files changed, 38 insertions(+), 86 deletions(-) rename SamplePlugin.sln => CurrencyAlert.sln (85%) delete mode 100644 README.md rename SamplePlugin/{SamplePlugin.csproj => CurrencyAlert.csproj} (100%) diff --git a/SamplePlugin.sln b/CurrencyAlert.sln similarity index 85% rename from SamplePlugin.sln rename to CurrencyAlert.sln index cdcc9cb..55a77fc 100644 --- a/SamplePlugin.sln +++ b/CurrencyAlert.sln @@ -1,31 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIDev", "UIDev\UIDev.csproj", "{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64 - {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64 - {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64 - {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64 - {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.ActiveCfg = Debug|x64 - {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.Build.0 = Debug|x64 - {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.ActiveCfg = Release|x64 - {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31919.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIDev", "UIDev\UIDev.csproj", "{4FEC9558-EB25-419F-B86E-51B8CFDA32B7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.ActiveCfg = Debug|x64 + {13C812E9-0D42-4B95-8646-40EEBF30636F}.Debug|x64.Build.0 = Debug|x64 + {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.ActiveCfg = Release|x64 + {13C812E9-0D42-4B95-8646-40EEBF30636F}.Release|x64.Build.0 = Release|x64 + {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.ActiveCfg = Debug|x64 + {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Debug|x64.Build.0 = Debug|x64 + {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.ActiveCfg = Release|x64 + {4FEC9558-EB25-419F-B86E-51B8CFDA32B7}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B17E85B1-5F60-4440-9F9A-3DDE877E8CDF} + EndGlobalSection +EndGlobal diff --git a/README.md b/README.md deleted file mode 100644 index 04a854b..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# SamplePlugin -Simple example plugin for XivLauncher/Dalamud, that shows both a working plugin and an associated UI test project, to allow for building and tweaking the UI without having to run the game. - -This is not designed to be the simplest possible example, but neither is it designed to cover everything you might want to do. - -I'm mostly hoping this helps some people to build out their UIs without having to constantly jump in and out of game. - - -### Main Points -* Simple functional plugin - * Slash command - * Main UI - * Settings UI - * Image loading - * Plugin json -* Simple, slightly-improved plugin configuration handling -* Basic ImGui testbed application project - * Allows testing UI changes without needing to run the game - * UI environment provided should match what is seen in game - * Defaults to an invisible fullscreen overlay; can easily be changed to use an opaque window etc - * Currently relies more on copy/paste of your UI code than fully generic objects (though this could be done) -* Project organization - * Copies all necessary plugin files to the output directory - * Does not copy dependencies that are provided by dalamud - * Output directory can be zipped directly and have exactly what is required - * Hides data files from visual studio to reduce clutter - * Also allows having data files in different paths than VS would usually allow if done in the IDE directly - - - The intention is less that any of this is used directly in other projects, and more to show how similar things can be done. - - The UIDev project could be used as-is, with just the UITest.cs file needing to be redone for your specific project UI. - - ### To Use - You'll need to fixup the library dependencies (for both projects), to point at your local dalamud binary directory. - - This will either be a custom dalamud build, or `%APPDATA%\XivLauncher\addon\Hooks\` for the current live release. - - After that, clear out what you don't need in UITest.cs, and implement your own local UI under Draw() - diff --git a/SamplePlugin/SamplePlugin.csproj b/SamplePlugin/CurrencyAlert.csproj similarity index 100% rename from SamplePlugin/SamplePlugin.csproj rename to SamplePlugin/CurrencyAlert.csproj diff --git a/SamplePlugin/Plugin.cs b/SamplePlugin/Plugin.cs index b486159..141b962 100644 --- a/SamplePlugin/Plugin.cs +++ b/SamplePlugin/Plugin.cs @@ -8,9 +8,9 @@ namespace SamplePlugin { public sealed class Plugin : IDalamudPlugin { - public string Name => "Sample Plugin"; + public string Name => "Currency Alert"; - private const string commandName = "/tsalert"; + private const string commandName = "/currencyalert"; private DalamudPluginInterface PluginInterface { get; init; } private CommandManager CommandManager { get; init; } @@ -29,9 +29,7 @@ namespace SamplePlugin // you might normally want to embed resources and load them from the manifest stream var assemblyLocation = Assembly.GetExecutingAssembly().Location; - var imagePath = Path.Combine(Path.GetDirectoryName(assemblyLocation)!, "goat.png"); - var goatImage = this.PluginInterface.UiBuilder.LoadImage(imagePath); - this.PluginUi = new PluginUI(this.Configuration, goatImage); + this.PluginUi = new PluginUI(this.Configuration); this.CommandManager.AddHandler(commandName, new CommandInfo(OnCommand) { diff --git a/SamplePlugin/PluginUI.cs b/SamplePlugin/PluginUI.cs index d0ddccc..a689ba9 100644 --- a/SamplePlugin/PluginUI.cs +++ b/SamplePlugin/PluginUI.cs @@ -11,8 +11,6 @@ namespace SamplePlugin { private Configuration configuration; - private ImGuiScene.TextureWrap goatImage; - // this extra bool exists for ImGui, since you can't ref a property private bool visible = false; public bool Visible @@ -31,16 +29,15 @@ namespace SamplePlugin //public unsafe InventoryManager* InventoryManager { get; } // passing in the image here just for simplicity - public PluginUI(Configuration configuration, ImGuiScene.TextureWrap goatImage) + public PluginUI(Configuration configuration) { this.configuration = configuration; - this.goatImage = goatImage; //this.InventoryManager = InventoryManager.Instance(); } public void Dispose() { - this.goatImage.Dispose(); + } public void Draw() @@ -83,11 +80,6 @@ namespace SamplePlugin Visible = true; } - //if (wolfMarks >= 15000) - //{ - // ImGui.Text("Wolf Marks: " + wolfMarks); - //} - if (!Visible) { return; @@ -95,6 +87,7 @@ namespace SamplePlugin ImGui.SetNextWindowSize(new Vector2(375, 330), ImGuiCond.FirstUseEver); ImGui.SetNextWindowSizeConstraints(new Vector2(375, 330), new Vector2(float.MaxValue, float.MaxValue)); + if (ImGui.Begin("My Amazing Window", ref this.visible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)) { if (ImGui.Button("Show Settings")) @@ -107,6 +100,7 @@ namespace SamplePlugin ImGui.Text("DEPENSE TES POETICS MERDE"); } } + ImGui.End(); } }