add UIColor to Dalamud Data window

This commit is contained in:
MidoriKami 2023-01-28 18:24:17 -08:00
parent 80bf56ab5b
commit b0c91fe1bd

View file

@ -40,9 +40,11 @@ using Dalamud.Plugin.Ipc.Internal;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using ImGuiNET;
using ImGuiScene; using ImGuiScene;
using Lumina.Excel.GeneratedSheets;
using Newtonsoft.Json; using Newtonsoft.Json;
using PInvoke; using PInvoke;
using Serilog; using Serilog;
using Condition = Dalamud.Game.ClientState.Conditions.Condition;
namespace Dalamud.Interface.Internal.Windows; namespace Dalamud.Interface.Internal.Windows;
@ -169,6 +171,7 @@ internal class DataWindow : Window
Hook, Hook,
Aetherytes, Aetherytes,
Dtr_Bar, Dtr_Bar,
UIColor,
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -195,6 +198,7 @@ internal class DataWindow : Window
"ai" => "Addon Inspector", "ai" => "Addon Inspector",
"at" => "Object Table", // Actor Table "at" => "Object Table", // Actor Table
"ot" => "Object Table", "ot" => "Object Table",
"uic" => "UIColor",
_ => dataKind, _ => dataKind,
}; };
@ -356,6 +360,10 @@ internal class DataWindow : Window
case DataKind.Dtr_Bar: case DataKind.Dtr_Bar:
this.DrawDtr(); this.DrawDtr();
break; break;
case DataKind.UIColor:
this.DrawUIColor();
break;
} }
} }
else else
@ -1713,6 +1721,40 @@ internal class DataWindow : Window
} }
} }
private void DrawUIColor()
{
var colorSheet = Service<DataManager>.Get().GetExcelSheet<UIColor>();
if (colorSheet is null) return;
foreach (var color in colorSheet)
{
this.DrawUIColor(color);
}
}
private void DrawUIColor(UIColor color)
{
ImGui.Text($"[{color.RowId:D3}]");
ImGui.SameLine();
ImGui.TextColored(this.ConvertToVector4(color.Unknown2), $"Unknown2");
ImGui.SameLine();
ImGui.TextColored(this.ConvertToVector4(color.UIForeground), "UIForeground");
ImGui.SameLine();
ImGui.TextColored(this.ConvertToVector4(color.Unknown3), "Unknown3");
ImGui.SameLine();
ImGui.TextColored(this.ConvertToVector4(color.UIGlow), "UIGlow");
}
private Vector4 ConvertToVector4(uint color)
{
var r = (byte)(color >> 24);
var g = (byte)(color >> 16);
var b = (byte)(color >> 8);
var a = (byte)(color);
return new Vector4(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
}
private async Task TestTaskInTaskDelay(CancellationToken token) private async Task TestTaskInTaskDelay(CancellationToken token)
{ {
await Task.Delay(5000, token); await Task.Delay(5000, token);