Fly text support

This commit is contained in:
liam 2021-08-10 15:02:37 -04:00
parent 5c4550762b
commit 9fe8395287
7 changed files with 653 additions and 0 deletions

View file

@ -9,6 +9,7 @@ using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.ClientState.Actors.Types.NonPlayer;
using Dalamud.Game.ClientState.Structs.JobGauge;
using Dalamud.Game.Internal;
using Dalamud.Game.Internal.Gui;
using Dalamud.Game.Internal.Gui.Addon;
using Dalamud.Game.Internal.Gui.Toast;
using Dalamud.Game.Text;
@ -49,6 +50,7 @@ namespace Dalamud.Interface.Internal.Windows
private UIDebug addonInspector = null;
// Toast fields
private string inputTextToast = string.Empty;
private int toastPosition = 0;
private int toastSpeed = 0;
@ -57,6 +59,17 @@ namespace Dalamud.Interface.Internal.Windows
private int questToastIconId = 0;
private bool questToastCheckmark = false;
// Fly text fields
private int flyActor;
private FlyTextKind flyKind;
private int flyVal1;
private int flyVal2;
private string flyText1 = string.Empty;
private string flyText2 = string.Empty;
private int flyIcon;
private Vector4 flyColor = new(1, 0, 0, 1);
// ImGui fields
private string inputTexPath = string.Empty;
private TextureWrap debugTex = null;
private Vector2 inputTexUv0 = Vector2.Zero;
@ -98,6 +111,7 @@ namespace Dalamud.Interface.Internal.Windows
StartInfo,
Target,
Toast,
FlyText,
ImGui,
Tex,
Gamepad,
@ -226,6 +240,10 @@ namespace Dalamud.Interface.Internal.Windows
this.DrawToast();
break;
case DataKind.FlyText:
this.DrawFlyText();
break;
case DataKind.ImGui:
this.DrawImGui();
break;
@ -687,6 +705,45 @@ namespace Dalamud.Interface.Internal.Windows
}
}
private void DrawFlyText()
{
if (ImGui.BeginCombo("Kind", this.flyKind.ToString()))
{
var names = Enum.GetNames(typeof(FlyTextKind));
for (int i = 0; i < names.Length; i++)
{
if (ImGui.Selectable($"{names[i]} ({i})"))
this.flyKind = (FlyTextKind)i;
}
ImGui.EndCombo();
}
ImGui.InputText("Text1", ref this.flyText1, 200);
ImGui.InputText("Text2", ref this.flyText2, 200);
ImGui.InputInt("Val1", ref this.flyVal1);
ImGui.InputInt("Val2", ref this.flyVal2);
ImGui.InputInt("Icon ID", ref this.flyIcon);
ImGui.ColorEdit4("Color", ref this.flyColor);
ImGui.InputInt("Actor Index", ref this.flyActor);
var sendColor = ImGui.ColorConvertFloat4ToU32(this.flyColor);
if (ImGui.Button("Send"))
{
this.dalamud.Framework.Gui.FlyText.AddFlyText(
this.flyKind,
unchecked((uint)this.flyActor),
unchecked((uint)this.flyVal1),
unchecked((uint)this.flyVal2),
this.flyText1,
this.flyText2,
sendColor,
unchecked((uint)this.flyIcon));
}
}
private void DrawImGui()
{
ImGui.Text("Monitor count: " + ImGui.GetPlatformIO().Monitors.Size);