refactor: update for api 9

This commit is contained in:
Anna
2023-10-03 02:59:51 -04:00
parent 32e7fbe586
commit c9cd28589b
15 changed files with 85 additions and 82 deletions
+7 -6
View File
@@ -11,10 +11,11 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Logging;
using Dalamud.Memory;
using ImGuiNET;
using ImGuiScene;
using Lumina.Excel.GeneratedSheets;
namespace ChatTwo.Ui;
@@ -28,7 +29,7 @@ internal sealed class ChatLog : IUiComponent {
internal bool Activate;
private int _activatePos = -1;
internal string Chat = string.Empty;
private readonly TextureWrap? _fontIcon;
private readonly IDalamudTextureWrap? _fontIcon;
private readonly List<string> _inputBacklog = new();
private int _inputBacklogIdx = -1;
internal int LastTab { get; private set; }
@@ -62,7 +63,7 @@ internal sealed class ChatLog : IUiComponent {
this.Ui.Plugin.Commands.Register("/clearlog2", "Clear the Chat 2 chat log").Execute += this.ClearLog;
this.Ui.Plugin.Commands.Register("/chat2").Execute += this.ToggleChat;
this._fontIcon = this.Ui.Plugin.DataManager.GetImGuiTexture("common/font/fonticon_ps5.tex");
this._fontIcon = this.Ui.Plugin.TextureProvider.GetTextureFromGame("common/font/fonticon_ps5.tex");
this.Ui.Plugin.Functions.Chat.Activated += this.Activated;
this.Ui.Plugin.ClientState.Login += this.Login;
@@ -78,13 +79,13 @@ internal sealed class ChatLog : IUiComponent {
this.Ui.Plugin.Commands.Register("/clearlog2").Execute -= this.ClearLog;
}
private void Logout(object? sender, EventArgs e) {
private void Logout() {
foreach (var tab in this.Ui.Plugin.Config.Tabs) {
tab.Clear();
}
}
private void Login(object? sender, EventArgs e) {
private void Login() {
this.Ui.Plugin.Store.FilterAllTabs(false);
}
@@ -415,7 +416,7 @@ internal sealed class ChatLog : IUiComponent {
ImGui.SetNextWindowSize(new Vector2(500, 250) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
if (!ImGui.Begin($"{this.Ui.Plugin.Name}###chat2", flags)) {
if (!ImGui.Begin($"{Plugin.Name}###chat2", flags)) {
this._lastViewport = ImGui.GetWindowViewport().NativePtr;
this._wasDocked = ImGui.IsWindowDocked();
ImGui.End();
+1 -1
View File
@@ -1,6 +1,6 @@
using System.Numerics;
using ChatTwo.Util;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
+3 -3
View File
@@ -3,7 +3,7 @@ using System.Numerics;
using ChatTwo.Resources;
using ChatTwo.Ui.SettingsTabs;
using ChatTwo.Util;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
namespace ChatTwo.Ui;
@@ -61,7 +61,7 @@ internal sealed class Settings : IUiComponent {
ImGui.SetNextWindowSize(new Vector2(475, 600) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
var name = string.Format(Language.Settings_Title, this.Ui.Plugin.Name);
var name = string.Format(Language.Settings_Title, Plugin.Name);
if (!ImGui.Begin($"{name}###chat2-settings", ref this.Ui.SettingsVisible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)) {
ImGui.End();
return;
@@ -117,7 +117,7 @@ internal sealed class Settings : IUiComponent {
this.Ui.SettingsVisible = false;
}
var buttonLabel = string.Format(Language.Settings_Kofi, this.Ui.Plugin.Name);
var buttonLabel = string.Format(Language.Settings_Kofi, Plugin.Name);
ImGui.PushStyleColor(ImGuiCol.Button, ColourUtil.RgbaToAbgr(0xFF5E5BFF));
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, ColourUtil.RgbaToAbgr(0xFF7775FF));