This commit is contained in:
Anna 2022-09-03 23:23:19 -04:00
parent 432db7f23b
commit 9dd8262c82
3 changed files with 36 additions and 0 deletions

21
client/Commands.cs Normal file
View File

@ -0,0 +1,21 @@
using Dalamud.Game.Command;
namespace OrangeGuidanceTomestone;
internal class Commands : IDisposable {
private Plugin Plugin { get; }
internal Commands(Plugin plugin) {
this.Plugin = plugin;
this.Plugin.CommandManager.AddHandler("/ogt", new CommandInfo(this.OnCommand));
}
public void Dispose() {
this.Plugin.CommandManager.RemoveHandler("/ogt");
}
private void OnCommand(string command, string arguments) {
this.Plugin.Ui.WriterVisible ^= true;
}
}

View File

@ -1,5 +1,6 @@
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Plugin;
@ -14,6 +15,9 @@ public class Plugin : IDalamudPlugin {
[PluginService]
internal ClientState ClientState { get; init; }
[PluginService]
internal CommandManager CommandManager { get; init; }
[PluginService]
internal Framework Framework { get; init; }
@ -21,6 +25,7 @@ public class Plugin : IDalamudPlugin {
internal Vfx Vfx { get; }
internal PluginUi Ui { get; }
internal Messages Messages { get; }
internal Commands Commands { get; }
public Plugin() {
this.Config = this.Interface!.GetPluginConfig() as Configuration ?? new Configuration();
@ -36,9 +41,11 @@ public class Plugin : IDalamudPlugin {
this.Vfx = new Vfx();
this.Ui = new PluginUi(this);
this.Messages = new Messages(this);
this.Commands = new Commands(this);
}
public void Dispose() {
this.Commands.Dispose();
this.Messages.Dispose();
this.Ui.Dispose();
this.Vfx.Dispose();

View File

@ -211,6 +211,8 @@ public class PluginUi : IDisposable {
};
this.Plugin.Messages.Add(newMsg);
this.ResetWriter();
this.WriterVisible = false;
}
});
}
@ -228,6 +230,12 @@ public class PluginUi : IDisposable {
ImGui.End();
}
private void ResetWriter() {
this._part1 = this._part2 = this._conj = -1;
this._word1 = (-1, -1);
this._word2 = (-1, -1);
}
private void ClearIfNecessary() {
if (this._pack == -1) {
this._part1 = -1;