feat: add help system

This commit is contained in:
Anna 2021-11-22 23:18:52 -05:00
parent d09a7016bb
commit 619c2dff65
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
5 changed files with 74 additions and 0 deletions

3
Glamaholic/FodyWeavers.xml Executable file
View File

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Resourcer/>
</Weavers>

View File

@ -54,10 +54,16 @@
<ItemGroup>
<PackageReference Include="DalamudLinter" Version="1.0.3"/>
<PackageReference Include="DalamudPackager" Version="2.1.4"/>
<PackageReference Include="Fody" Version="6.6.0" PrivateAssets="all"/>
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<Content Include="..\icon.png" Link="images/icon.png" CopyToOutputDirectory="PreserveNewest" Visible="false"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="help.txt"/>
</ItemGroup>
</Project>

View File

@ -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<AlternativeFinder> 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);

View File

@ -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);

34
Glamaholic/help.txt Executable file
View File

@ -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.