Merge pull request #209 from Aireil/add_commands_help

Add commands in plugin descriptions
This commit is contained in:
goaaats 2020-12-08 09:13:49 +01:00 committed by GitHub
commit 96c9ba0af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,5 @@
using System.Reflection;
namespace Dalamud.Game.Command {
/// <summary>
/// This class describes a registered command.
@ -31,6 +33,9 @@ namespace Dalamud.Game.Command {
/// <param name="handler"></param>
public CommandInfo(HandlerDelegate handler) {
Handler = handler;
LoaderAssemblyName = Assembly.GetCallingAssembly()?.GetName()?.Name;
}
internal string LoaderAssemblyName { get; set; } = string.Empty;
}
}

View file

@ -229,6 +229,15 @@ namespace Dalamud.Plugin
x => x.Definition.InternalName ==
pluginDefinition.InternalName);
if (this.dalamud.CommandManager.Commands.Any(x => x.Value.LoaderAssemblyName == installedPlugin.Definition?.InternalName)) {
ImGui.Dummy(new Vector2(10, 10) * ImGui.GetIO().FontGlobalScale);
foreach (var command in this.dalamud.CommandManager.Commands) {
if (command.Value.LoaderAssemblyName == installedPlugin.Definition.InternalName && command.Value.ShowInHelp) {
ImGui.Text($"{command.Key} → {command.Value.HelpMessage}");
}
}
}
if (ImGui.Button(Loc.Localize("InstallerDisable", "Disable")))
try {
this.dalamud.PluginManager.DisablePlugin(installedPlugin.Definition);