From 14dfe22d9c281c6d81652e57c3279b36216a4389 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 22 Nov 2021 23:18:52 -0500 Subject: [PATCH] feat: add help system --- Glamaholic/FodyWeavers.xml | 3 +++ Glamaholic/Glamaholic.csproj | 6 ++++++ Glamaholic/PluginUi.cs | 15 +++++++++++++++ Glamaholic/Ui/MainInterface.cs | 16 ++++++++++++++++ Glamaholic/help.txt | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100755 Glamaholic/FodyWeavers.xml create mode 100755 Glamaholic/help.txt diff --git a/Glamaholic/FodyWeavers.xml b/Glamaholic/FodyWeavers.xml new file mode 100755 index 0000000..37de851 --- /dev/null +++ b/Glamaholic/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + diff --git a/Glamaholic/Glamaholic.csproj b/Glamaholic/Glamaholic.csproj index 93d9983..96ce504 100755 --- a/Glamaholic/Glamaholic.csproj +++ b/Glamaholic/Glamaholic.csproj @@ -54,10 +54,16 @@ + + + + + + diff --git a/Glamaholic/PluginUi.cs b/Glamaholic/PluginUi.cs index 3c45e15..935bba4 100755 --- a/Glamaholic/PluginUi.cs +++ b/Glamaholic/PluginUi.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using FFXIVClientStructs.FFXIV.Client.System.Framework; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using Glamaholic.Ui; @@ -16,10 +17,24 @@ namespace Glamaholic { private EditorHelper EditorHelper { get; } private ExamineHelper ExamineHelper { get; } internal List AlternativeFinders { get; } = new(); + internal List<(string, string)> Help { get; } = new(); internal PluginUi(Plugin plugin) { this.Plugin = plugin; + foreach (var entry in Resourcer.Resource.AsString("help.txt").Split("---")) { + var lines = entry.Trim().Split(new[] { "\n", "\r\n" }, StringSplitOptions.TrimEntries); + if (lines.Length == 0 || !lines[0].StartsWith("#")) { + continue; + } + + var title = lines[0][1..].Trim(); + var content = string.Join(" ", lines[1..] + .SkipWhile(string.IsNullOrWhiteSpace) + .Select(line => string.IsNullOrWhiteSpace(line) ? "\n" : line)); + this.Help.Add((title, content)); + } + this.MainInterface = new MainInterface(this); this.EditorHelper = new EditorHelper(this); this.ExamineHelper = new ExamineHelper(this); diff --git a/Glamaholic/Ui/MainInterface.cs b/Glamaholic/Ui/MainInterface.cs index c9bab82..ee69304 100755 --- a/Glamaholic/Ui/MainInterface.cs +++ b/Glamaholic/Ui/MainInterface.cs @@ -164,6 +164,22 @@ namespace Glamaholic.Ui { ImGui.EndMenu(); } + if (ImGui.BeginMenu("Help")) { + foreach (var (title, content) in this.Ui.Help) { + if (!ImGui.BeginMenu(title)) { + continue; + } + + ImGui.PushTextWrapPos(ImGui.CalcTextSize("0").X * 60f * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(content); + ImGui.PopTextWrapPos(); + + ImGui.EndMenu(); + } + + ImGui.EndMenu(); + } + if (this.Ui.Plugin.Config.ShowKofiButton) { const string kofiText = "Support on Ko-fi"; var kofiTextSize = ImGui.CalcTextSize(kofiText); diff --git a/Glamaholic/help.txt b/Glamaholic/help.txt new file mode 100755 index 0000000..ce696da --- /dev/null +++ b/Glamaholic/help.txt @@ -0,0 +1,34 @@ +# How to use Glamaholic + +Thank you for installing Glamaholic! This plugin can act as your home for +glamours, since you can store as many as you would like in it. To get started, +try reading the section called "Adding glamour plates". Keep in mind that you'll +need to be editing your plates at the Glamour Dresser to be able to copy those +plates into the plugin or apply new plates. + +--- + +# Adding glamour plates + +Click on the Plates menu and you can add plates to Glamaholic. + + +- Click "New" to add an empty plate, starting from scratch. + +- Hover over "Add from current plate", type in a name, and press Enter to copy a +plate from your glamour dresser into Glamaholic. + +- Hover over "Import" and paste in a shared glamour plate to import a plate from +elsewhere. + +- Open the Examine window a character, click the "Glamaholic" menu, then click +"Create glamour plate" to create a glamour plate from someone else's outfit. + +--- + +# Finding items that share a model + +You can search for items that share the same model as another item by either +middle-clicking (click with mouse wheel) or holding Control and left-clicking on +any item name or item icon. This will open a window listing items with the same +model where you can link or try them on.