mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 16:27:44 +01:00
Magic the magic happen
This commit is contained in:
parent
84769ae5b7
commit
658eedca37
188 changed files with 10329 additions and 3549 deletions
111
Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
Normal file
111
Dalamud/Interface/Internal/Windows/ChangelogWindow.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System.Diagnostics;
|
||||
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// For major updates, an in-game Changelog window.
|
||||
/// </summary>
|
||||
internal sealed class ChangelogWindow : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the latest update warrants a changelog window.
|
||||
/// </summary>
|
||||
public const bool WarrantsChangelog = false;
|
||||
|
||||
private const string ChangeLog =
|
||||
@"* Various behind-the-scenes changes to improve stability
|
||||
* Faster startup times
|
||||
|
||||
If you note any issues or need help, please make sure to ask on our discord server.";
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly string assemblyVersion = Util.AssemblyVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChangelogWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
public ChangelogWindow(Dalamud dalamud)
|
||||
: base("What's new in XIVLauncher?", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
|
||||
this.Namespace = "DalamudChangelogWindow";
|
||||
|
||||
this.IsOpen = WarrantsChangelog;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text($"The in-game addon has been updated to version D{this.assemblyVersion}.");
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.Text("The following changes were introduced:");
|
||||
ImGui.Text(ChangeLog);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.Text("Thank you for using our tools!");
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
|
||||
if (ImGui.Button(FontAwesomeIcon.Download.ToIconString()))
|
||||
{
|
||||
this.dalamud.DalamudUi.OpenPluginInstaller();
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.PopFont();
|
||||
ImGui.SetTooltip("Open Plugin Installer");
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button(FontAwesomeIcon.LaughBeam.ToIconString()))
|
||||
{
|
||||
Process.Start("https://discord.gg/3NMcUV5");
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.PopFont();
|
||||
ImGui.SetTooltip("Join our Discord server");
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button(FontAwesomeIcon.Globe.ToIconString()))
|
||||
{
|
||||
Process.Start("https://github.com/goatcorp/FFXIVQuickLauncher");
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.PopFont();
|
||||
ImGui.SetTooltip("See our GitHub repository");
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
}
|
||||
|
||||
ImGui.PopFont();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy(20, 0);
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Close"))
|
||||
{
|
||||
this.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs
Normal file
56
Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Color Demo Window to view custom ImGui colors.
|
||||
/// </summary>
|
||||
internal sealed class ColorDemoWindow : Window
|
||||
{
|
||||
private readonly List<(string Name, Vector4 Color)> colors;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ColorDemoWindow"/> class.
|
||||
/// </summary>
|
||||
public ColorDemoWindow()
|
||||
: base("Dalamud Colors Demo")
|
||||
{
|
||||
this.Size = new Vector2(600, 500);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
|
||||
this.colors = new List<(string Name, Vector4 Color)>()
|
||||
{
|
||||
("White", ImGuiColors.White),
|
||||
("DalamudRed", ImGuiColors.DalamudRed),
|
||||
("DalamudGrey", ImGuiColors.DalamudGrey),
|
||||
("DalamudGrey2", ImGuiColors.DalamudGrey2),
|
||||
("DalamudGrey3", ImGuiColors.DalamudGrey3),
|
||||
("DalamudWhite", ImGuiColors.DalamudWhite),
|
||||
("DalamudWhite2", ImGuiColors.DalamudWhite2),
|
||||
("DalamudOrange", ImGuiColors.DalamudOrange),
|
||||
("TankBlue", ImGuiColors.TankBlue),
|
||||
("HealerGreen", ImGuiColors.HealerGreen),
|
||||
("DPSRed", ImGuiColors.DPSRed),
|
||||
}.OrderBy(colorDemo => colorDemo.Name).ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text("This is a collection of UI colors you can use in your plugin.");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
foreach (var (name, color) in this.colors)
|
||||
{
|
||||
ImGui.TextColored(color, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs
Normal file
89
Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Component Demo Window to view custom ImGui components.
|
||||
/// </summary>
|
||||
internal sealed class ComponentDemoWindow : Window
|
||||
{
|
||||
private readonly List<(string Name, Action Demo)> componentDemos;
|
||||
private Vector4 defaultColor = ImGuiColors.DalamudOrange;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ComponentDemoWindow"/> class.
|
||||
/// </summary>
|
||||
public ComponentDemoWindow()
|
||||
: base("Dalamud Components Demo")
|
||||
{
|
||||
this.Size = new Vector2(600, 500);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
|
||||
this.componentDemos = new()
|
||||
{
|
||||
("Test", ImGuiComponents.Test),
|
||||
("HelpMarker", HelpMarkerDemo),
|
||||
("IconButton", IconButtonDemo),
|
||||
("TextWithLabel", TextWithLabelDemo),
|
||||
("ColorPickerWithPalette", this.ColorPickerWithPaletteDemo),
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text("This is a collection of UI components you can use in your plugin.");
|
||||
|
||||
for (var i = 0; i < this.componentDemos.Count; i++)
|
||||
{
|
||||
var componentDemo = this.componentDemos[i];
|
||||
|
||||
if (ImGui.CollapsingHeader($"{componentDemo.Name}###comp{i}"))
|
||||
{
|
||||
componentDemo.Demo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void HelpMarkerDemo()
|
||||
{
|
||||
ImGui.Text("Hover over the icon to learn more.");
|
||||
ImGuiComponents.HelpMarker("help me!");
|
||||
}
|
||||
|
||||
private static void IconButtonDemo()
|
||||
{
|
||||
ImGui.Text("Click on the icon to use as a button.");
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButton(1, FontAwesomeIcon.Carrot))
|
||||
{
|
||||
ImGui.OpenPopup("IconButtonDemoPopup");
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopup("IconButtonDemoPopup"))
|
||||
{
|
||||
ImGui.Text("You clicked!");
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private static void TextWithLabelDemo()
|
||||
{
|
||||
ImGuiComponents.TextWithLabel("Label", "Hover to see more", "more");
|
||||
}
|
||||
|
||||
private void ColorPickerWithPaletteDemo()
|
||||
{
|
||||
ImGui.Text("Click on the color button to use the picker.");
|
||||
ImGui.SameLine();
|
||||
this.defaultColor = ImGuiComponents.ColorPickerWithPalette(1, "ColorPickerWithPalette Demo", this.defaultColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
207
Dalamud/Interface/Internal/Windows/CreditsWindow.cs
Normal file
207
Dalamud/Interface/Internal/Windows/CreditsWindow.cs
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// A window documenting contributors to the project.
|
||||
/// </summary>
|
||||
internal class CreditsWindow : Window, IDisposable
|
||||
{
|
||||
private const float CreditFPS = 60.0f;
|
||||
private const string CreditsTextTempl = @"
|
||||
Dalamud
|
||||
A FFXIV Hooking Framework
|
||||
Version D{0}
|
||||
|
||||
|
||||
created by:
|
||||
|
||||
goat
|
||||
Mino
|
||||
Meli
|
||||
attick
|
||||
Aida-Enna
|
||||
perchbird
|
||||
Wintermute
|
||||
fmauNeko
|
||||
Caraxi
|
||||
Adam
|
||||
nibs/Poliwrath
|
||||
karashiiro
|
||||
Pohky
|
||||
daemitus
|
||||
Aireil
|
||||
kalilistic
|
||||
|
||||
|
||||
|
||||
Localization by:
|
||||
|
||||
Aireil
|
||||
Akira
|
||||
area402
|
||||
Ridge
|
||||
availuzje
|
||||
CBMaca
|
||||
Delaene
|
||||
fang2hou
|
||||
Miu
|
||||
fmauNeko
|
||||
qtBxi
|
||||
JasonLucas
|
||||
karashiiro
|
||||
hibiya
|
||||
sayumizumi
|
||||
N30N014
|
||||
Neocrow
|
||||
OhagiYamada
|
||||
xDarkOne
|
||||
Truci
|
||||
Roy
|
||||
xenris
|
||||
Xorus
|
||||
|
||||
|
||||
|
||||
Logo by:
|
||||
|
||||
gucciBane
|
||||
|
||||
|
||||
|
||||
Your plugins were made by:
|
||||
|
||||
{1}
|
||||
|
||||
|
||||
Special thanks:
|
||||
|
||||
Adam
|
||||
karashiiro
|
||||
Kubera
|
||||
Truci
|
||||
Haplo
|
||||
Franz
|
||||
|
||||
Everyone in the XIVLauncher Discord server
|
||||
Join us at: https://discord.gg/3NMcUV5
|
||||
|
||||
|
||||
|
||||
Licensed under AGPL
|
||||
Contribute at: https://github.com/goatsoft/Dalamud
|
||||
|
||||
|
||||
Thank you for using XIVLauncher and Dalamud!
|
||||
";
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly TextureWrap logoTexture;
|
||||
private readonly Stopwatch creditsThrottler;
|
||||
|
||||
private string creditsText;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CreditsWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
public CreditsWindow(Dalamud dalamud)
|
||||
: base("Dalamud Credits", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize, true)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.logoTexture = this.dalamud.InterfaceManager.LoadImage(Path.Combine(this.dalamud.AssetDirectory.FullName, "UIRes", "logo.png"));
|
||||
this.creditsThrottler = new();
|
||||
|
||||
this.Size = new Vector2(500, 400);
|
||||
this.SizeCondition = ImGuiCond.Always;
|
||||
|
||||
this.PositionCondition = ImGuiCond.Always;
|
||||
|
||||
this.BgAlpha = 0.5f;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnOpen()
|
||||
{
|
||||
var pluginCredits = this.dalamud.PluginManager.InstalledPlugins
|
||||
.Where(plugin => plugin.Manifest != null)
|
||||
.Select(plugin => $"{plugin.Manifest.Name} by {plugin.Manifest.Author}\n")
|
||||
.Aggregate(string.Empty, (current, next) => $"{current}{next}");
|
||||
|
||||
this.creditsText = string.Format(CreditsTextTempl, typeof(Dalamud).Assembly.GetName().Version, pluginCredits);
|
||||
|
||||
this.dalamud.Framework.Gui.SetBgm(132);
|
||||
this.creditsThrottler.Restart();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnClose()
|
||||
{
|
||||
this.creditsThrottler.Reset();
|
||||
this.dalamud.Framework.Gui.SetBgm(9999);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
var screenSize = ImGui.GetMainViewport().Size;
|
||||
var windowSize = ImGui.GetWindowSize();
|
||||
|
||||
this.Position = (screenSize - windowSize) / 2;
|
||||
|
||||
ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.NoScrollbar);
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0, 340f);
|
||||
ImGui.Text(string.Empty);
|
||||
|
||||
ImGui.SameLine(150f);
|
||||
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(190f, 190f));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0, 20f);
|
||||
|
||||
var windowX = ImGui.GetWindowSize().X;
|
||||
|
||||
foreach (var creditsLine in this.creditsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
|
||||
{
|
||||
var lineLenX = ImGui.CalcTextSize(creditsLine).X;
|
||||
|
||||
ImGui.Dummy(new Vector2((windowX / 2) - (lineLenX / 2), 0f));
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(creditsLine);
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFPS))
|
||||
{
|
||||
var curY = ImGui.GetScrollY();
|
||||
var maxY = ImGui.GetScrollMaxY();
|
||||
|
||||
if (curY < maxY - 1)
|
||||
{
|
||||
ImGui.SetScrollY(curY + 1);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes of managed and unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.logoTexture?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
718
Dalamud/Interface/Internal/Windows/DataWindow.cs
Normal file
718
Dalamud/Interface/Internal/Windows/DataWindow.cs
Normal file
|
|
@ -0,0 +1,718 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game.ClientState;
|
||||
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.Addon;
|
||||
using Dalamud.Game.Internal.Gui.Toast;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Class responsible for drawing the data/debug window.
|
||||
/// </summary>
|
||||
internal class DataWindow : Window
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
|
||||
private readonly string[] dataKinds = new[]
|
||||
{
|
||||
"ServerOpCode", "Address", "Actor Table", "Font Test", "Party List", "Plugin IPC", "Condition",
|
||||
"Gauge", "Command", "Addon", "Addon Inspector", "StartInfo", "Target", "Toast", "ImGui", "Tex", "Gamepad",
|
||||
};
|
||||
|
||||
private bool wasReady;
|
||||
private string serverOpString;
|
||||
private int currentKind;
|
||||
|
||||
private bool drawActors = false;
|
||||
private float maxActorDrawDistance = 20;
|
||||
|
||||
private string inputSig = string.Empty;
|
||||
private IntPtr sigResult = IntPtr.Zero;
|
||||
|
||||
private string inputAddonName = string.Empty;
|
||||
private int inputAddonIndex;
|
||||
private Addon resultAddon;
|
||||
|
||||
private IntPtr findAgentInterfacePtr;
|
||||
|
||||
private bool resolveGameData = false;
|
||||
|
||||
private UIDebug addonInspector = null;
|
||||
|
||||
private string inputTextToast = string.Empty;
|
||||
private int toastPosition = 0;
|
||||
private int toastSpeed = 0;
|
||||
private int questToastPosition = 0;
|
||||
private bool questToastSound = false;
|
||||
private int questToastIconId = 0;
|
||||
private bool questToastCheckmark = false;
|
||||
|
||||
private string inputTexPath = string.Empty;
|
||||
private TextureWrap debugTex = null;
|
||||
private Vector2 inputTexUv0 = Vector2.Zero;
|
||||
private Vector2 inputTexUv1 = Vector2.One;
|
||||
private Vector4 inputTintCol = Vector4.One;
|
||||
private Vector2 inputTexScale = Vector2.Zero;
|
||||
|
||||
private uint copyButtonIndex = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DataWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance to access data of.</param>
|
||||
public DataWindow(Dalamud dalamud)
|
||||
: base("Dalamud Data")
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
|
||||
this.Size = new Vector2(500, 500);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
|
||||
this.Load();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the DataKind dropdown menu.
|
||||
/// </summary>
|
||||
/// <param name="dataKind">Data kind name, can be lower and/or without spaces.</param>
|
||||
public void SetDataKind(string dataKind)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dataKind))
|
||||
return;
|
||||
|
||||
if (dataKind == "ai")
|
||||
dataKind = "Addon Inspector";
|
||||
|
||||
int index;
|
||||
dataKind = dataKind.Replace(" ", string.Empty).ToLower();
|
||||
var dataKinds = this.dataKinds.Select(k => k.Replace(" ", string.Empty).ToLower()).ToList();
|
||||
if ((index = dataKinds.IndexOf(dataKind)) != -1)
|
||||
{
|
||||
this.currentKind = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dalamud.Framework.Gui.Chat.PrintError("/xldata: Invalid Data Type");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the window via ImGui.
|
||||
/// </summary>
|
||||
public override void Draw()
|
||||
{
|
||||
this.copyButtonIndex = 0;
|
||||
|
||||
// Main window
|
||||
if (ImGui.Button("Force Reload"))
|
||||
this.Load();
|
||||
ImGui.SameLine();
|
||||
var copy = ImGui.Button("Copy all");
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.Combo("Data kind", ref this.currentKind, this.dataKinds, this.dataKinds.Length);
|
||||
|
||||
ImGui.Checkbox("Resolve GameData", ref this.resolveGameData);
|
||||
|
||||
ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar);
|
||||
|
||||
if (copy)
|
||||
ImGui.LogToClipboard();
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
|
||||
|
||||
try
|
||||
{
|
||||
if (this.wasReady)
|
||||
{
|
||||
switch (this.currentKind)
|
||||
{
|
||||
case 0:
|
||||
ImGui.TextUnformatted(this.serverOpString);
|
||||
break;
|
||||
case 1:
|
||||
|
||||
ImGui.InputText(".text sig", ref this.inputSig, 400);
|
||||
if (ImGui.Button("Resolve"))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.sigResult = this.dalamud.SigScanner.ScanText(this.inputSig);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
this.sigResult = new IntPtr(-1);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Text($"Result: {this.sigResult.ToInt64():X}");
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button($"C{this.copyButtonIndex++}"))
|
||||
ImGui.SetClipboardText(this.sigResult.ToInt64().ToString("x"));
|
||||
|
||||
foreach (var debugScannedValue in BaseAddressResolver.DebugScannedValues)
|
||||
{
|
||||
ImGui.TextUnformatted($"{debugScannedValue.Key}");
|
||||
foreach (var valueTuple in debugScannedValue.Value)
|
||||
{
|
||||
ImGui.TextUnformatted(
|
||||
$" {valueTuple.Item1} - 0x{valueTuple.Item2.ToInt64():x}");
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button($"C##copyAddress{this.copyButtonIndex++}"))
|
||||
ImGui.SetClipboardText(valueTuple.Item2.ToInt64().ToString("x"));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// AT
|
||||
case 2:
|
||||
this.DrawActorTable();
|
||||
|
||||
break;
|
||||
|
||||
// Font
|
||||
case 3:
|
||||
var specialChars = string.Empty;
|
||||
for (var i = 0xE020; i <= 0xE0DB; i++)
|
||||
specialChars += $"0x{i:X} - {(SeIconChar)i} - {(char)i}\n";
|
||||
|
||||
ImGui.TextUnformatted(specialChars);
|
||||
|
||||
foreach (var fontAwesomeIcon in Enum.GetValues(typeof(FontAwesomeIcon))
|
||||
.Cast<FontAwesomeIcon>())
|
||||
{
|
||||
ImGui.Text(((int)fontAwesomeIcon.ToIconChar()).ToString("X") + " - ");
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.Text(fontAwesomeIcon.ToIconString());
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Party
|
||||
case 4:
|
||||
var partyString = string.Empty;
|
||||
|
||||
if (this.dalamud.ClientState.PartyList.Length == 0)
|
||||
{
|
||||
ImGui.TextUnformatted("Data not ready.");
|
||||
}
|
||||
else
|
||||
{
|
||||
partyString += $"{this.dalamud.ClientState.PartyList.Count} Members\n";
|
||||
for (var i = 0; i < this.dalamud.ClientState.PartyList.Count; i++)
|
||||
{
|
||||
var member = this.dalamud.ClientState.PartyList[i];
|
||||
if (member == null)
|
||||
{
|
||||
partyString +=
|
||||
$"[{i}] was null\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
partyString +=
|
||||
$"[{i}] {member.CharacterName} - {member.ObjectKind} - {member.Actor.ActorId}\n";
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(partyString);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Subscriptions
|
||||
case 5:
|
||||
this.DrawIpcDebug();
|
||||
|
||||
break;
|
||||
|
||||
// Condition
|
||||
case 6:
|
||||
#if DEBUG
|
||||
ImGui.Text($"ptr: 0x{this.dalamud.ClientState.Condition.ConditionArrayBase.ToInt64():X}");
|
||||
#endif
|
||||
|
||||
ImGui.Text("Current Conditions:");
|
||||
ImGui.Separator();
|
||||
|
||||
var didAny = false;
|
||||
|
||||
for (var i = 0; i < Condition.MaxConditionEntries; i++)
|
||||
{
|
||||
var typedCondition = (ConditionFlag)i;
|
||||
var cond = this.dalamud.ClientState.Condition[typedCondition];
|
||||
|
||||
if (!cond) continue;
|
||||
|
||||
didAny = true;
|
||||
|
||||
ImGui.Text($"ID: {i} Enum: {typedCondition}");
|
||||
}
|
||||
|
||||
if (!didAny)
|
||||
ImGui.Text("None. Talk to a shop NPC or visit a market board to find out more!!!!!!!");
|
||||
|
||||
break;
|
||||
|
||||
// Gauge
|
||||
case 7:
|
||||
var gauge = this.dalamud.ClientState.JobGauges.Get<ASTGauge>();
|
||||
ImGui.Text($"Moon: {gauge.ContainsSeal(SealType.MOON)} Drawn: {gauge.DrawnCard()}");
|
||||
|
||||
break;
|
||||
|
||||
// Command
|
||||
case 8:
|
||||
foreach (var command in this.dalamud.CommandManager.Commands)
|
||||
ImGui.Text($"{command.Key}\n -> {command.Value.HelpMessage}\n -> In help: {command.Value.ShowInHelp}\n\n");
|
||||
|
||||
break;
|
||||
|
||||
// Addon
|
||||
case 9:
|
||||
this.DrawAddonDebug();
|
||||
break;
|
||||
|
||||
// Addon Inspector
|
||||
case 10:
|
||||
this.addonInspector ??= new UIDebug(this.dalamud);
|
||||
this.addonInspector.Draw();
|
||||
break;
|
||||
|
||||
// StartInfo
|
||||
case 11:
|
||||
ImGui.Text(JsonConvert.SerializeObject(this.dalamud.StartInfo, Formatting.Indented));
|
||||
break;
|
||||
|
||||
// Target
|
||||
case 12:
|
||||
this.DrawTargetDebug();
|
||||
break;
|
||||
|
||||
// Toast
|
||||
case 13:
|
||||
ImGui.InputText("Toast text", ref this.inputTextToast, 200);
|
||||
|
||||
ImGui.Combo("Toast Position", ref this.toastPosition, new[] { "Bottom", "Top", }, 2);
|
||||
ImGui.Combo("Toast Speed", ref this.toastSpeed, new[] { "Slow", "Fast", }, 2);
|
||||
ImGui.Combo("Quest Toast Position", ref this.questToastPosition, new[] { "Centre", "Right", "Left" }, 3);
|
||||
ImGui.Checkbox("Quest Checkmark", ref this.questToastCheckmark);
|
||||
ImGui.Checkbox("Quest Play Sound", ref this.questToastSound);
|
||||
ImGui.InputInt("Quest Icon ID", ref this.questToastIconId);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(new Vector2(10, 10));
|
||||
|
||||
if (ImGui.Button("Show toast"))
|
||||
{
|
||||
this.dalamud.Framework.Gui.Toast.ShowNormal(this.inputTextToast, new ToastOptions
|
||||
{
|
||||
Position = (ToastPosition)this.toastPosition,
|
||||
Speed = (ToastSpeed)this.toastSpeed,
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui.Button("Show Quest toast"))
|
||||
{
|
||||
this.dalamud.Framework.Gui.Toast.ShowQuest(this.inputTextToast, new QuestToastOptions
|
||||
{
|
||||
Position = (QuestToastPosition)this.questToastPosition,
|
||||
DisplayCheckmark = this.questToastCheckmark,
|
||||
IconId = (uint)this.questToastIconId,
|
||||
PlaySound = this.questToastSound,
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui.Button("Show Error toast"))
|
||||
{
|
||||
this.dalamud.Framework.Gui.Toast.ShowError(this.inputTextToast);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// ImGui
|
||||
case 14:
|
||||
ImGui.Text("Monitor count: " + ImGui.GetPlatformIO().Monitors.Size);
|
||||
ImGui.Text("OverrideGameCursor: " + this.dalamud.InterfaceManager.OverrideGameCursor);
|
||||
|
||||
ImGui.Button("THIS IS A BUTTON###hoverTestButton");
|
||||
this.dalamud.InterfaceManager.OverrideGameCursor = !ImGui.IsItemHovered();
|
||||
|
||||
break;
|
||||
|
||||
// Tex
|
||||
case 15:
|
||||
ImGui.InputText("Tex Path", ref this.inputTexPath, 255);
|
||||
ImGui.InputFloat2("UV0", ref this.inputTexUv0);
|
||||
ImGui.InputFloat2("UV1", ref this.inputTexUv1);
|
||||
ImGui.InputFloat4("Tint", ref this.inputTintCol);
|
||||
ImGui.InputFloat2("Scale", ref this.inputTexScale);
|
||||
|
||||
if (ImGui.Button("Load Tex"))
|
||||
{
|
||||
try
|
||||
{
|
||||
this.debugTex = this.dalamud.Data.GetImGuiTexture(this.inputTexPath);
|
||||
this.inputTexScale = new Vector2(this.debugTex.Width, this.debugTex.Height);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not load tex.");
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
if (this.debugTex != null)
|
||||
{
|
||||
ImGui.Image(this.debugTex.ImGuiHandle, this.inputTexScale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol);
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
Util.ShowObject(this.debugTex);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Gamepad
|
||||
case 16:
|
||||
Action<string, uint, Func<GamepadButtons, float>> helper = (text, mask, resolve) =>
|
||||
{
|
||||
ImGui.Text($"{text} {mask:X4}");
|
||||
ImGui.Text($"DPadLeft {resolve(GamepadButtons.DpadLeft)} " +
|
||||
$"DPadUp {resolve(GamepadButtons.DpadUp)} " +
|
||||
$"DPadRight {resolve(GamepadButtons.DpadRight)} " +
|
||||
$"DPadDown {resolve(GamepadButtons.DpadDown)} ");
|
||||
ImGui.Text($"West {resolve(GamepadButtons.West)} " +
|
||||
$"North {resolve(GamepadButtons.North)} " +
|
||||
$"East {resolve(GamepadButtons.East)} " +
|
||||
$"South {resolve(GamepadButtons.South)} ");
|
||||
ImGui.Text($"L1 {resolve(GamepadButtons.L1)} " +
|
||||
$"L2 {resolve(GamepadButtons.L2)} " +
|
||||
$"R1 {resolve(GamepadButtons.R1)} " +
|
||||
$"R2 {resolve(GamepadButtons.R2)} ");
|
||||
ImGui.Text($"Select {resolve(GamepadButtons.Select)} " +
|
||||
$"Start {resolve(GamepadButtons.Start)} " +
|
||||
$"L3 {resolve(GamepadButtons.L3)} " +
|
||||
$"R3 {resolve(GamepadButtons.R3)} ");
|
||||
};
|
||||
#if DEBUG
|
||||
ImGui.Text($"GamepadInput 0x{this.dalamud.ClientState.GamepadState.GamepadInput.ToInt64():X}");
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
|
||||
|
||||
if (ImGui.IsItemClicked())
|
||||
ImGui.SetClipboardText($"0x{this.dalamud.ClientState.GamepadState.GamepadInput.ToInt64():X}");
|
||||
#endif
|
||||
|
||||
helper(
|
||||
"Buttons Raw",
|
||||
this.dalamud.ClientState.GamepadState.ButtonsRaw,
|
||||
this.dalamud.ClientState.GamepadState.Raw);
|
||||
helper(
|
||||
"Buttons Pressed",
|
||||
this.dalamud.ClientState.GamepadState.ButtonsPressed,
|
||||
this.dalamud.ClientState.GamepadState.Pressed);
|
||||
helper(
|
||||
"Buttons Repeat",
|
||||
this.dalamud.ClientState.GamepadState.ButtonsRepeat,
|
||||
this.dalamud.ClientState.GamepadState.Repeat);
|
||||
helper(
|
||||
"Buttons Released",
|
||||
this.dalamud.ClientState.GamepadState.ButtonsReleased,
|
||||
this.dalamud.ClientState.GamepadState.Released);
|
||||
ImGui.Text($"LeftStickLeft {this.dalamud.ClientState.GamepadState.LeftStickLeft:0.00} " +
|
||||
$"LeftStickUp {this.dalamud.ClientState.GamepadState.LeftStickUp:0.00} " +
|
||||
$"LeftStickRight {this.dalamud.ClientState.GamepadState.LeftStickRight:0.00} " +
|
||||
$"LeftStickDown {this.dalamud.ClientState.GamepadState.LeftStickDown:0.00} ");
|
||||
ImGui.Text($"RightStickLeft {this.dalamud.ClientState.GamepadState.RightStickLeft:0.00} " +
|
||||
$"RightStickUp {this.dalamud.ClientState.GamepadState.RightStickUp:0.00} " +
|
||||
$"RightStickRight {this.dalamud.ClientState.GamepadState.RightStickRight:0.00} " +
|
||||
$"RightStickDown {this.dalamud.ClientState.GamepadState.RightStickDown:0.00} ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TextUnformatted("Data not ready.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ImGui.TextUnformatted(ex.ToString());
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
private void DrawActorTable()
|
||||
{
|
||||
var stateString = string.Empty;
|
||||
|
||||
// LocalPlayer is null in a number of situations (at least with the current visible-actors list)
|
||||
// which would crash here.
|
||||
if (this.dalamud.ClientState.Actors.Length == 0)
|
||||
{
|
||||
ImGui.TextUnformatted("Data not ready.");
|
||||
}
|
||||
else if (this.dalamud.ClientState.LocalPlayer == null)
|
||||
{
|
||||
ImGui.TextUnformatted("LocalPlayer null.");
|
||||
}
|
||||
else
|
||||
{
|
||||
stateString += $"FrameworkBase: {this.dalamud.Framework.Address.BaseAddress.ToInt64():X}\n";
|
||||
stateString += $"ActorTableLen: {this.dalamud.ClientState.Actors.Length}\n";
|
||||
stateString += $"LocalPlayerName: {this.dalamud.ClientState.LocalPlayer.Name}\n";
|
||||
stateString += $"CurrentWorldName: {(this.resolveGameData ? this.dalamud.ClientState.LocalPlayer.CurrentWorld.GameData.Name : this.dalamud.ClientState.LocalPlayer.CurrentWorld.Id.ToString())}\n";
|
||||
stateString += $"HomeWorldName: {(this.resolveGameData ? this.dalamud.ClientState.LocalPlayer.HomeWorld.GameData.Name : this.dalamud.ClientState.LocalPlayer.HomeWorld.Id.ToString())}\n";
|
||||
stateString += $"LocalCID: {this.dalamud.ClientState.LocalContentId:X}\n";
|
||||
stateString += $"LastLinkedItem: {this.dalamud.Framework.Gui.Chat.LastLinkedItemId}\n";
|
||||
stateString += $"TerritoryType: {this.dalamud.ClientState.TerritoryType}\n\n";
|
||||
|
||||
ImGui.TextUnformatted(stateString);
|
||||
|
||||
ImGui.Checkbox("Draw actors on screen", ref this.drawActors);
|
||||
ImGui.SliderFloat("Draw Distance", ref this.maxActorDrawDistance, 2f, 40f);
|
||||
|
||||
for (var i = 0; i < this.dalamud.ClientState.Actors.Length; i++)
|
||||
{
|
||||
var actor = this.dalamud.ClientState.Actors[i];
|
||||
|
||||
if (actor == null)
|
||||
continue;
|
||||
|
||||
this.PrintActor(actor, i.ToString());
|
||||
|
||||
if (this.drawActors && this.dalamud.Framework.Gui.WorldToScreen(actor.Position, out var screenCoords))
|
||||
{
|
||||
// So, while WorldToScreen will return false if the point is off of game client screen, to
|
||||
// to avoid performance issues, we have to manually determine if creating a window would
|
||||
// produce a new viewport, and skip rendering it if so
|
||||
var actorText = $"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name}";
|
||||
|
||||
var screenPos = ImGui.GetMainViewport().Pos;
|
||||
var screenSize = ImGui.GetMainViewport().Size;
|
||||
|
||||
var windowSize = ImGui.CalcTextSize(actorText);
|
||||
|
||||
// Add some extra safety padding
|
||||
windowSize.X += ImGui.GetStyle().WindowPadding.X + 10;
|
||||
windowSize.Y += ImGui.GetStyle().WindowPadding.Y + 10;
|
||||
|
||||
if (screenCoords.X + windowSize.X > screenPos.X + screenSize.X ||
|
||||
screenCoords.Y + windowSize.Y > screenPos.Y + screenSize.Y)
|
||||
continue;
|
||||
|
||||
if (actor.YalmDistanceX > this.maxActorDrawDistance)
|
||||
continue;
|
||||
|
||||
ImGui.SetNextWindowPos(new Vector2(screenCoords.X, screenCoords.Y));
|
||||
|
||||
ImGui.SetNextWindowBgAlpha(Math.Max(1f - (actor.YalmDistanceX / this.maxActorDrawDistance), 0.2f));
|
||||
if (ImGui.Begin(
|
||||
$"Actor{i}##ActorWindow{i}",
|
||||
ImGuiWindowFlags.NoDecoration |
|
||||
ImGuiWindowFlags.AlwaysAutoResize |
|
||||
ImGuiWindowFlags.NoSavedSettings |
|
||||
ImGuiWindowFlags.NoMove |
|
||||
ImGuiWindowFlags.NoMouseInputs |
|
||||
ImGuiWindowFlags.NoDocking |
|
||||
ImGuiWindowFlags.NoFocusOnAppearing |
|
||||
ImGuiWindowFlags.NoNav))
|
||||
ImGui.Text(actorText);
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
private void DrawIpcDebug()
|
||||
{
|
||||
var i1 = new DalamudPluginInterface(this.dalamud, "DalamudTestSub", null);
|
||||
var i2 = new DalamudPluginInterface(this.dalamud, "DalamudTestPub", null);
|
||||
|
||||
if (ImGui.Button("Add test sub"))
|
||||
{
|
||||
i1.Subscribe("DalamudTestPub", o =>
|
||||
{
|
||||
dynamic msg = o;
|
||||
Log.Debug(msg.Expand);
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui.Button("Add test sub any"))
|
||||
{
|
||||
i1.SubscribeAny((o, a) =>
|
||||
{
|
||||
dynamic msg = a;
|
||||
Log.Debug($"From {o}: {msg.Expand}");
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui.Button("Remove test sub"))
|
||||
i1.Unsubscribe("DalamudTestPub");
|
||||
|
||||
if (ImGui.Button("Remove test sub any"))
|
||||
i1.UnsubscribeAny();
|
||||
|
||||
if (ImGui.Button("Send test message"))
|
||||
{
|
||||
dynamic testMsg = new ExpandoObject();
|
||||
testMsg.Expand = "dong";
|
||||
i2.SendMessage(testMsg);
|
||||
}
|
||||
|
||||
// This doesn't actually work, so don't mind it - impl relies on plugins being registered in PluginManager
|
||||
if (ImGui.Button("Send test message any"))
|
||||
{
|
||||
dynamic testMsg = new ExpandoObject();
|
||||
testMsg.Expand = "dong";
|
||||
i2.SendMessage("DalamudTestSub", testMsg);
|
||||
}
|
||||
|
||||
foreach (var ipc in this.dalamud.PluginManager.IpcSubscriptions)
|
||||
ImGui.Text($"Source:{ipc.SourcePluginName} Sub:{ipc.SubPluginName}");
|
||||
}
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
private void DrawAddonDebug()
|
||||
{
|
||||
ImGui.InputText("Addon name", ref this.inputAddonName, 256);
|
||||
ImGui.InputInt("Addon Index", ref this.inputAddonIndex);
|
||||
|
||||
if (ImGui.Button("Get Addon"))
|
||||
{
|
||||
this.resultAddon =
|
||||
this.dalamud.Framework.Gui.GetAddonByName(
|
||||
this.inputAddonName, this.inputAddonIndex);
|
||||
}
|
||||
|
||||
if (ImGui.Button("Find Agent"))
|
||||
this.findAgentInterfacePtr = this.dalamud.Framework.Gui.FindAgentInterface(this.inputAddonName);
|
||||
|
||||
if (this.resultAddon != null)
|
||||
{
|
||||
ImGui.TextUnformatted(
|
||||
$"{this.resultAddon.Name} - 0x{this.resultAddon.Address.ToInt64():x}\n v:{this.resultAddon.Visible} x:{this.resultAddon.X} y:{this.resultAddon.Y} s:{this.resultAddon.Scale}, w:{this.resultAddon.Width}, h:{this.resultAddon.Height}");
|
||||
}
|
||||
|
||||
if (this.findAgentInterfacePtr != IntPtr.Zero)
|
||||
{
|
||||
ImGui.TextUnformatted(
|
||||
$"Agent: 0x{this.findAgentInterfacePtr.ToInt64():x}");
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("C"))
|
||||
ImGui.SetClipboardText(this.findAgentInterfacePtr.ToInt64().ToString("x"));
|
||||
}
|
||||
|
||||
if (ImGui.Button("Get Base UI object"))
|
||||
{
|
||||
var addr = this.dalamud.Framework.Gui.GetBaseUIObject().ToInt64().ToString("x");
|
||||
Log.Information("{0}", addr);
|
||||
ImGui.SetClipboardText(addr);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTargetDebug()
|
||||
{
|
||||
var targetMgr = this.dalamud.ClientState.Targets;
|
||||
|
||||
if (targetMgr.CurrentTarget != null)
|
||||
{
|
||||
this.PrintActor(targetMgr.CurrentTarget, "CurrentTarget");
|
||||
Util.ShowObject(targetMgr.CurrentTarget);
|
||||
}
|
||||
|
||||
if (targetMgr.FocusTarget != null)
|
||||
this.PrintActor(targetMgr.FocusTarget, "FocusTarget");
|
||||
|
||||
if (targetMgr.MouseOverTarget != null)
|
||||
this.PrintActor(targetMgr.MouseOverTarget, "MouseOverTarget");
|
||||
|
||||
if (targetMgr.PreviousTarget != null)
|
||||
this.PrintActor(targetMgr.PreviousTarget, "PreviousTarget");
|
||||
|
||||
if (targetMgr.SoftTarget != null)
|
||||
this.PrintActor(targetMgr.SoftTarget, "SoftTarget");
|
||||
|
||||
if (ImGui.Button("Clear CT"))
|
||||
targetMgr.ClearCurrentTarget();
|
||||
|
||||
if (ImGui.Button("Clear FT"))
|
||||
targetMgr.ClearFocusTarget();
|
||||
|
||||
var localPlayer = this.dalamud.ClientState.LocalPlayer;
|
||||
|
||||
if (localPlayer != null)
|
||||
{
|
||||
if (ImGui.Button("Set CT"))
|
||||
targetMgr.SetCurrentTarget(localPlayer);
|
||||
|
||||
if (ImGui.Button("Set FT"))
|
||||
targetMgr.SetFocusTarget(localPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text("LocalPlayer is null.");
|
||||
}
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
if (this.dalamud.Data.IsDataReady)
|
||||
{
|
||||
this.serverOpString = JsonConvert.SerializeObject(this.dalamud.Data.ServerOpCodes, Formatting.Indented);
|
||||
this.wasReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintActor(Actor actor, string tag)
|
||||
{
|
||||
var actorString =
|
||||
$"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{tag}] - {actor.ObjectKind} - {actor.Name} - X{actor.Position.X} Y{actor.Position.Y} Z{actor.Position.Z} D{actor.YalmDistanceX} R{actor.Rotation} - Target: {actor.TargetActorID:X}\n";
|
||||
|
||||
if (actor is Npc npc)
|
||||
actorString += $" DataId: {npc.DataId} NameId:{npc.NameId}\n";
|
||||
|
||||
if (actor is Chara chara)
|
||||
{
|
||||
actorString +=
|
||||
$" Level: {chara.Level} ClassJob: {(this.resolveGameData ? chara.ClassJob.GameData.Name : chara.ClassJob.Id.ToString())} CHP: {chara.CurrentHp} MHP: {chara.MaxHp} CMP: {chara.CurrentMp} MMP: {chara.MaxMp}\n Customize: {BitConverter.ToString(chara.Customize).Replace("-", " ")} StatusFlags: {chara.StatusFlags}\n";
|
||||
}
|
||||
|
||||
if (actor is PlayerCharacter pc)
|
||||
{
|
||||
actorString +=
|
||||
$" HomeWorld: {(this.resolveGameData ? pc.HomeWorld.GameData.Name : pc.HomeWorld.Id.ToString())} CurrentWorld: {(this.resolveGameData ? pc.CurrentWorld.GameData.Name : pc.CurrentWorld.Id.ToString())} FC: {pc.CompanyTag}\n";
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(actorString);
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button($"C##{this.copyButtonIndex++}"))
|
||||
{
|
||||
ImGui.SetClipboardText(actor.Address.ToInt64().ToString("X"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using System.Numerics;
|
||||
|
||||
using CheapLoc;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Class responsible for drawing a notifier on screen that gamepad mode is active.
|
||||
/// </summary>
|
||||
internal class GamepadModeNotifierWindow : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GamepadModeNotifierWindow"/> class.
|
||||
/// </summary>
|
||||
public GamepadModeNotifierWindow()
|
||||
: base(
|
||||
"###DalamudGamepadModeNotifier",
|
||||
ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoMouseInputs
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoNav
|
||||
| ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings,
|
||||
true)
|
||||
{
|
||||
this.Size = Vector2.Zero;
|
||||
this.SizeCondition = ImGuiCond.Always;
|
||||
this.IsOpen = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws a light grey-ish, main-viewport-big filled rect in the background draw list alongside a text indicating gamepad mode.
|
||||
/// </summary>
|
||||
public override void Draw()
|
||||
{
|
||||
var drawList = ImGui.GetBackgroundDrawList();
|
||||
drawList.PushClipRectFullScreen();
|
||||
drawList.AddRectFilled(Vector2.Zero, ImGuiHelpers.MainViewport.Size, 0x661A1A1A);
|
||||
drawList.AddText(
|
||||
Vector2.One,
|
||||
0xFFFFFFFF,
|
||||
Loc.Localize(
|
||||
"DalamudGamepadModeNotifierText",
|
||||
"Gamepad mode is ON. Press L1+L3 to deactivate, press R3 to toggle PluginInstaller."));
|
||||
drawList.PopClipRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
175
Dalamud/Interface/Internal/Windows/LogWindow.cs
Normal file
175
Dalamud/Interface/Internal/Windows/LogWindow.cs
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// The window that displays the Dalamud log file in-game.
|
||||
/// </summary>
|
||||
internal class LogWindow : Window, IDisposable
|
||||
{
|
||||
private readonly CommandManager commandManager;
|
||||
private readonly DalamudConfiguration configuration;
|
||||
private readonly List<(string Line, Vector4 Color)> logText = new();
|
||||
private readonly object renderLock = new();
|
||||
private bool autoScroll;
|
||||
private bool openAtStartup;
|
||||
|
||||
private string commandText = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LogWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
public LogWindow(Dalamud dalamud)
|
||||
: base("Dalamud LOG")
|
||||
{
|
||||
this.commandManager = dalamud.CommandManager;
|
||||
this.configuration = dalamud.Configuration;
|
||||
this.autoScroll = this.configuration.LogAutoScroll;
|
||||
this.openAtStartup = this.configuration.LogOpenAtStartup;
|
||||
SerilogEventSink.Instance.OnLogLine += this.OnLogLine;
|
||||
|
||||
this.Size = new Vector2(500, 400);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of managed and unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
SerilogEventSink.Instance.OnLogLine -= this.OnLogLine;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the window of all log entries.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
lock (this.renderLock)
|
||||
{
|
||||
this.logText.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a single log line to the display.
|
||||
/// </summary>
|
||||
/// <param name="line">The line to add.</param>
|
||||
/// <param name="color">The line coloring.</param>
|
||||
public void AddLog(string line, Vector4 color)
|
||||
{
|
||||
lock (this.renderLock)
|
||||
{
|
||||
this.logText.Add((line, color));
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
// Options menu
|
||||
if (ImGui.BeginPopup("Options"))
|
||||
{
|
||||
if (ImGui.Checkbox("Auto-scroll", ref this.autoScroll))
|
||||
{
|
||||
this.configuration.LogAutoScroll = this.autoScroll;
|
||||
this.configuration.Save();
|
||||
}
|
||||
|
||||
if (ImGui.Checkbox("Open at startup", ref this.openAtStartup))
|
||||
{
|
||||
this.configuration.LogOpenAtStartup = this.openAtStartup;
|
||||
this.configuration.Save();
|
||||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
// Main window
|
||||
if (ImGui.Button("Options"))
|
||||
ImGui.OpenPopup("Options");
|
||||
|
||||
ImGui.SameLine();
|
||||
var clear = ImGui.Button("Clear");
|
||||
|
||||
ImGui.SameLine();
|
||||
var copy = ImGui.Button("Copy");
|
||||
|
||||
ImGui.Text("Enter command: ");
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.InputText("##commandbox", ref this.commandText, 255);
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Send"))
|
||||
{
|
||||
if (this.commandManager.ProcessCommand(this.commandText))
|
||||
{
|
||||
Log.Information("Command was dispatched.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Information($"Command {this.commandText} is not registered.");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.HorizontalScrollbar);
|
||||
|
||||
if (clear)
|
||||
{
|
||||
this.Clear();
|
||||
}
|
||||
|
||||
if (copy)
|
||||
{
|
||||
ImGui.LogToClipboard();
|
||||
}
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||
|
||||
lock (this.renderLock)
|
||||
{
|
||||
foreach (var (line, color) in this.logText)
|
||||
{
|
||||
ImGui.TextColored(color, line);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
if (this.autoScroll && ImGui.GetScrollY() >= ImGui.GetScrollMaxY())
|
||||
{
|
||||
ImGui.SetScrollHereY(1.0f);
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
private void OnLogLine(object sender, (string Line, LogEventLevel Level) logEvent)
|
||||
{
|
||||
var color = logEvent.Level switch
|
||||
{
|
||||
LogEventLevel.Error => ImGuiColors.DalamudRed,
|
||||
LogEventLevel.Verbose => ImGuiColors.DalamudWhite,
|
||||
LogEventLevel.Debug => ImGuiColors.DalamudWhite2,
|
||||
LogEventLevel.Information => ImGuiColors.DalamudWhite,
|
||||
LogEventLevel.Warning => ImGuiColors.DalamudOrange,
|
||||
LogEventLevel.Fatal => ImGuiColors.DalamudRed,
|
||||
_ => throw new ArgumentOutOfRangeException(logEvent.Level.ToString(), "Invalid LogEventLevel"),
|
||||
};
|
||||
|
||||
this.AddLog(logEvent.Line, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
1173
Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs
Normal file
1173
Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs
Normal file
File diff suppressed because it is too large
Load diff
264
Dalamud/Interface/Internal/Windows/PluginStatWindow.cs
Normal file
264
Dalamud/Interface/Internal/Windows/PluginStatWindow.cs
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
using Dalamud.Game.Internal;
|
||||
using Dalamud.Hooking.Internal;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// This window displays plugin statistics for troubleshooting.
|
||||
/// </summary>
|
||||
internal class PluginStatWindow : Window
|
||||
{
|
||||
private readonly PluginManager pluginManager;
|
||||
private bool showDalamudHooks;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginStatWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
public PluginStatWindow(Dalamud dalamud)
|
||||
: base("Plugin Statistics###DalamudPluginStatWindow")
|
||||
{
|
||||
this.pluginManager = dalamud.PluginManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.BeginTabBar("Stat Tabs");
|
||||
|
||||
if (ImGui.BeginTabItem("Draw times"))
|
||||
{
|
||||
var doStats = UiBuilder.DoStats;
|
||||
|
||||
if (ImGui.Checkbox("Enable Draw Time Tracking", ref doStats))
|
||||
{
|
||||
UiBuilder.DoStats = doStats;
|
||||
}
|
||||
|
||||
if (doStats)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Reset"))
|
||||
{
|
||||
foreach (var plugin in this.pluginManager.InstalledPlugins)
|
||||
{
|
||||
plugin.DalamudInterface.UiBuilder.LastDrawTime = -1;
|
||||
plugin.DalamudInterface.UiBuilder.MaxDrawTime = -1;
|
||||
plugin.DalamudInterface.UiBuilder.DrawTimeHistory.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Columns(4);
|
||||
ImGui.SetColumnWidth(0, 180f);
|
||||
ImGui.SetColumnWidth(1, 100f);
|
||||
ImGui.SetColumnWidth(2, 100f);
|
||||
ImGui.SetColumnWidth(3, 100f);
|
||||
|
||||
ImGui.Text("Plugin");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Last");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Longest");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Average");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
foreach (var plugin in this.pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded))
|
||||
{
|
||||
ImGui.Text(plugin.Manifest.Name);
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text($"{plugin.DalamudInterface.UiBuilder.LastDrawTime / 10000f:F4}ms");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text($"{plugin.DalamudInterface.UiBuilder.MaxDrawTime / 10000f:F4}ms");
|
||||
ImGui.NextColumn();
|
||||
|
||||
if (plugin.DalamudInterface.UiBuilder.DrawTimeHistory.Count > 0)
|
||||
{
|
||||
ImGui.Text($"{plugin.DalamudInterface.UiBuilder.DrawTimeHistory.Average() / 10000f:F4}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text("-");
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
|
||||
ImGui.Columns(1);
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem("Framework times"))
|
||||
{
|
||||
var doStats = Framework.StatsEnabled;
|
||||
|
||||
if (ImGui.Checkbox("Enable Framework Update Tracking", ref doStats))
|
||||
{
|
||||
Framework.StatsEnabled = doStats;
|
||||
}
|
||||
|
||||
if (doStats)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Reset"))
|
||||
{
|
||||
Framework.StatsHistory.Clear();
|
||||
}
|
||||
|
||||
ImGui.Columns(4);
|
||||
|
||||
ImGui.SetColumnWidth(0, ImGui.GetWindowContentRegionWidth() - 300);
|
||||
ImGui.SetColumnWidth(1, 100f);
|
||||
ImGui.SetColumnWidth(2, 100f);
|
||||
ImGui.SetColumnWidth(3, 100f);
|
||||
|
||||
ImGui.Text("Method");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Last");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Longest");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Average");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.Separator();
|
||||
|
||||
foreach (var handlerHistory in Framework.StatsHistory)
|
||||
{
|
||||
if (handlerHistory.Value.Count == 0)
|
||||
continue;
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.Text($"{handlerHistory.Key}");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text($"{handlerHistory.Value.Last():F4}ms");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text($"{handlerHistory.Value.Max():F4}ms");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text($"{handlerHistory.Value.Average():F4}ms");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
ImGui.Columns(0);
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem("Hooks"))
|
||||
{
|
||||
ImGui.Columns(3);
|
||||
|
||||
ImGui.SetColumnWidth(0, ImGui.GetWindowContentRegionWidth() - 280);
|
||||
ImGui.SetColumnWidth(1, 180f);
|
||||
ImGui.SetColumnWidth(2, 100f);
|
||||
|
||||
ImGui.Text("Detour Method");
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.Text(" ");
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.Checkbox("Show Dalamud Hooks ###showDalamudHooksCheckbox", ref this.showDalamudHooks);
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Address");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Text("Status");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.Separator();
|
||||
|
||||
foreach (var trackedHook in HookManager.TrackedHooks)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!this.showDalamudHooks && trackedHook.Assembly == Assembly.GetExecutingAssembly())
|
||||
continue;
|
||||
|
||||
ImGui.Text($"{trackedHook.Delegate.Target} :: {trackedHook.Delegate.Method.Name}");
|
||||
ImGui.TextDisabled(trackedHook.Assembly.FullName);
|
||||
ImGui.NextColumn();
|
||||
if (!trackedHook.Hook.IsDisposed)
|
||||
{
|
||||
ImGui.Text($"{trackedHook.Hook.Address.ToInt64():X}");
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
ImGui.SetClipboardText($"{trackedHook.Hook.Address.ToInt64():X}");
|
||||
}
|
||||
|
||||
var processMemoryOffset = trackedHook.InProcessMemory;
|
||||
if (processMemoryOffset.HasValue)
|
||||
{
|
||||
ImGui.Text($"ffxiv_dx11.exe + {processMemoryOffset:X}");
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
ImGui.SetClipboardText($"ffxiv_dx11.exe+{processMemoryOffset:X}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
|
||||
if (trackedHook.Hook.IsDisposed)
|
||||
{
|
||||
ImGui.Text("Disposed");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text(trackedHook.Hook.IsEnabled ? "Enabled" : "Disabled");
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ImGui.Text(ex.Message);
|
||||
ImGui.NextColumn();
|
||||
while (ImGui.GetColumnIndex() != 0) ImGui.NextColumn();
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
ImGui.Columns();
|
||||
}
|
||||
|
||||
if (ImGui.IsWindowAppearing())
|
||||
{
|
||||
HookManager.TrackedHooks.RemoveAll(h => h.Hook.IsDisposed);
|
||||
}
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
193
Dalamud/Interface/Internal/Windows/ScratchpadWindow.cs
Normal file
193
Dalamud/Interface/Internal/Windows/ScratchpadWindow.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Internal.Scratchpad;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// This class facilitates interacting with the ScratchPad window.
|
||||
/// </summary>
|
||||
internal class ScratchpadWindow : Window, IDisposable
|
||||
{
|
||||
private readonly Dalamud dalamud;
|
||||
private readonly List<ScratchpadDocument> documents = new();
|
||||
private readonly ScratchFileWatcher watcher = new();
|
||||
private string pathInput = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ScratchpadWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud instance.</param>
|
||||
public ScratchpadWindow(Dalamud dalamud)
|
||||
: base("Plugin Scratchpad", ImGuiWindowFlags.MenuBar)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
this.documents.Add(new ScratchpadDocument());
|
||||
|
||||
this.SizeConstraintsMin = new Vector2(400, 400);
|
||||
|
||||
this.Execution = new ScratchExecutionManager(dalamud);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ScratchPad execution manager.
|
||||
/// </summary>
|
||||
public ScratchExecutionManager Execution { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
if (ImGui.BeginPopupModal("Choose Path"))
|
||||
{
|
||||
ImGui.Text("Enter path:\n\n");
|
||||
|
||||
ImGui.InputText("###ScratchPathInput", ref this.pathInput, 1000);
|
||||
|
||||
if (ImGui.Button("OK", new Vector2(120, 0)))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
this.watcher.Load(this.pathInput);
|
||||
this.pathInput = string.Empty;
|
||||
}
|
||||
|
||||
ImGui.SetItemDefaultFocus();
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Cancel", new Vector2(120, 0)))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui.BeginMenuBar())
|
||||
{
|
||||
if (ImGui.BeginMenu("File"))
|
||||
{
|
||||
if (ImGui.MenuItem("Load & Watch"))
|
||||
{
|
||||
ImGui.OpenPopup("Choose Path");
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
ImGui.EndMenuBar();
|
||||
}
|
||||
|
||||
var flags = ImGuiTabBarFlags.Reorderable | ImGuiTabBarFlags.TabListPopupButton |
|
||||
ImGuiTabBarFlags.FittingPolicyScroll;
|
||||
|
||||
if (ImGui.BeginTabBar("ScratchDocTabBar", flags))
|
||||
{
|
||||
if (ImGui.TabItemButton("+", ImGuiTabItemFlags.Trailing | ImGuiTabItemFlags.NoTooltip))
|
||||
this.documents.Add(new ScratchpadDocument());
|
||||
|
||||
var docs = this.documents.Concat(this.watcher.TrackedScratches).ToArray();
|
||||
|
||||
for (var i = 0; i < docs.Length; i++)
|
||||
{
|
||||
var isOpen = true;
|
||||
|
||||
if (ImGui.BeginTabItem(docs[i].Title + (docs[i].HasUnsaved ? "*" : string.Empty) + "###ScratchItem" + i, ref isOpen))
|
||||
{
|
||||
var content = docs[i].Content;
|
||||
if (ImGui.InputTextMultiline("###ScratchInput" + i, ref content, 20000, new Vector2(-1, -34), ImGuiInputTextFlags.AllowTabInput))
|
||||
{
|
||||
docs[i].Content = content;
|
||||
docs[i].HasUnsaved = true;
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
|
||||
if (ImGui.Button("Compile & Reload"))
|
||||
{
|
||||
docs[i].Status = this.Execution.RenewScratch(docs[i]);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Dispose all"))
|
||||
{
|
||||
this.Execution.DisposeAllScratches();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Dump processed code"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var code = this.Execution.MacroProcessor.Process(docs[i].Content);
|
||||
Log.Information(code);
|
||||
ImGui.SetClipboardText(code);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not process macros");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Toggle Log"))
|
||||
{
|
||||
this.dalamud.DalamudUi.ToggleLogWindow();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
var isMacro = docs[i].IsMacro;
|
||||
if (ImGui.Checkbox("Use Macros", ref isMacro))
|
||||
{
|
||||
docs[i].IsMacro = isMacro;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
switch (docs[i].Status)
|
||||
{
|
||||
case ScratchLoadStatus.Unknown:
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, "Compile scratch to see status");
|
||||
break;
|
||||
case ScratchLoadStatus.FailureCompile:
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "Error during compilation");
|
||||
break;
|
||||
case ScratchLoadStatus.FailureInit:
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "Error during init");
|
||||
break;
|
||||
case ScratchLoadStatus.Success:
|
||||
ImGui.TextColored(ImGuiColors.HealerGreen, "OK!");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, docs[i].Id.ToString());
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of managed and unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Execution.DisposeAllScratches();
|
||||
}
|
||||
}
|
||||
}
|
||||
453
Dalamud/Interface/Internal/Windows/SettingsWindow.cs
Normal file
453
Dalamud/Interface/Internal/Windows/SettingsWindow.cs
Normal file
|
|
@ -0,0 +1,453 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CheapLoc;
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// The window that allows for general configuration of Dalamud itself.
|
||||
/// </summary>
|
||||
internal class SettingsWindow : Window
|
||||
{
|
||||
private const float MinScale = 0.3f;
|
||||
private const float MaxScale = 2.0f;
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
|
||||
private readonly string[] languages;
|
||||
private readonly string[] locLanguages;
|
||||
private int langIndex;
|
||||
|
||||
private Vector4 hintTextColor = ImGuiColors.DalamudGrey;
|
||||
private Vector4 warnTextColor = ImGuiColors.DalamudRed;
|
||||
|
||||
private XivChatType dalamudMessagesChatType;
|
||||
|
||||
private bool doCfTaskBarFlash;
|
||||
private bool doCfChatMessage;
|
||||
|
||||
private float globalUiScale;
|
||||
private bool doToggleUiHide;
|
||||
private bool doToggleUiHideDuringCutscenes;
|
||||
private bool doToggleUiHideDuringGpose;
|
||||
private bool doDocking;
|
||||
private bool doViewport;
|
||||
private bool doGamepad;
|
||||
private List<ThirdPartyRepoSettings> thirdRepoList;
|
||||
|
||||
private bool printPluginsWelcomeMsg;
|
||||
private bool autoUpdatePlugins;
|
||||
private bool doButtonsSystemMenu;
|
||||
|
||||
private string thirdRepoTempUrl = string.Empty;
|
||||
private string thirdRepoAddError = string.Empty;
|
||||
|
||||
#region Experimental
|
||||
|
||||
private bool doPluginTest;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SettingsWindow"/> class.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The Dalamud Instance.</param>
|
||||
public SettingsWindow(Dalamud dalamud)
|
||||
: base(Loc.Localize("DalamudSettingsHeader", "Dalamud Settings") + "###XlSettings2", ImGuiWindowFlags.NoCollapse)
|
||||
{
|
||||
this.dalamud = dalamud;
|
||||
|
||||
this.Size = new Vector2(740, 550);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
|
||||
this.dalamudMessagesChatType = this.dalamud.Configuration.GeneralChatType;
|
||||
|
||||
this.doCfTaskBarFlash = this.dalamud.Configuration.DutyFinderTaskbarFlash;
|
||||
this.doCfChatMessage = this.dalamud.Configuration.DutyFinderChatMessage;
|
||||
|
||||
this.globalUiScale = this.dalamud.Configuration.GlobalUiScale;
|
||||
this.doToggleUiHide = this.dalamud.Configuration.ToggleUiHide;
|
||||
this.doToggleUiHideDuringCutscenes = this.dalamud.Configuration.ToggleUiHideDuringCutscenes;
|
||||
this.doToggleUiHideDuringGpose = this.dalamud.Configuration.ToggleUiHideDuringGpose;
|
||||
|
||||
this.doDocking = this.dalamud.Configuration.IsDocking;
|
||||
this.doViewport = !this.dalamud.Configuration.IsDisableViewport;
|
||||
this.doGamepad = this.dalamud.Configuration.IsGamepadNavigationEnabled;
|
||||
|
||||
this.doPluginTest = this.dalamud.Configuration.DoPluginTest;
|
||||
this.thirdRepoList = this.dalamud.Configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
|
||||
|
||||
this.printPluginsWelcomeMsg = this.dalamud.Configuration.PrintPluginsWelcomeMsg;
|
||||
this.autoUpdatePlugins = this.dalamud.Configuration.AutoUpdatePlugins;
|
||||
this.doButtonsSystemMenu = this.dalamud.Configuration.DoButtonsSystemMenu;
|
||||
|
||||
this.languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.dalamud.Configuration.LanguageOverride))
|
||||
{
|
||||
var currentUiLang = CultureInfo.CurrentUICulture;
|
||||
|
||||
if (Localization.ApplicableLangCodes.Any(x => currentUiLang.TwoLetterISOLanguageName == x))
|
||||
this.langIndex = Array.IndexOf(this.languages, currentUiLang.TwoLetterISOLanguageName);
|
||||
else
|
||||
this.langIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.langIndex = Array.IndexOf(this.languages, this.dalamud.Configuration.LanguageOverride);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.langIndex = 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var locLanguagesList = new List<string>();
|
||||
string locLanguage;
|
||||
foreach (var language in this.languages)
|
||||
{
|
||||
if (language != "ko")
|
||||
{
|
||||
locLanguage = CultureInfo.GetCultureInfo(language).NativeName;
|
||||
locLanguagesList.Add(char.ToUpper(locLanguage[0]) + locLanguage[1..]);
|
||||
}
|
||||
else
|
||||
{
|
||||
locLanguagesList.Add("Korean");
|
||||
}
|
||||
}
|
||||
|
||||
this.locLanguages = locLanguagesList.ToArray();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.locLanguages = this.languages; // Languages not localized, only codes.
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnOpen()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnClose()
|
||||
{
|
||||
ImGui.GetIO().FontGlobalScale = this.dalamud.Configuration.GlobalUiScale;
|
||||
|
||||
this.thirdRepoList = this.dalamud.Configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
var windowSize = ImGui.GetWindowSize();
|
||||
ImGui.BeginChild("scrolling", new Vector2(windowSize.X - 5 - (5 * ImGuiHelpers.GlobalScale), windowSize.Y - 35 - (35 * ImGuiHelpers.GlobalScale)), false, ImGuiWindowFlags.HorizontalScrollbar);
|
||||
|
||||
if (ImGui.BeginTabBar("SetTabBar"))
|
||||
{
|
||||
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsGeneral", "General")))
|
||||
{
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsLanguage", "Language"));
|
||||
ImGui.Combo("##XlLangCombo", ref this.langIndex, this.locLanguages, this.locLanguages.Length);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsLanguageHint", "Select the language Dalamud will be displayed in."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsChannel", "General Chat Channel"));
|
||||
if (ImGui.BeginCombo("##XlChatTypeCombo", this.dalamudMessagesChatType.ToString()))
|
||||
{
|
||||
foreach (var type in Enum.GetValues(typeof(XivChatType)).Cast<XivChatType>())
|
||||
{
|
||||
if (ImGui.Selectable(type.ToString(), type == this.dalamudMessagesChatType))
|
||||
{
|
||||
this.dalamudMessagesChatType = type;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsFlash", "Flash FFXIV window on duty pop"), ref this.doCfTaskBarFlash);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsFlashHint", "Flash the FFXIV window in your task bar when a duty is ready."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsDutyFinderMessage", "Chatlog message on duty pop"), ref this.doCfChatMessage);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsDutyFinderMessageHint", "Send a message in FFXIV chat when a duty is ready."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsPrintPluginsWelcomeMsg", "Display loaded plugins in the welcome message"), ref this.printPluginsWelcomeMsg);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsPrintPluginsWelcomeMsgHint", "Display loaded plugins in FFXIV chat when logging in with a character."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsAutoUpdatePlugins", "Auto-update plugins"), ref this.autoUpdatePlugins);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsAutoUpdatePluginsMsgHint", "Automatically update plugins when logging in with a character."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"), ref this.doButtonsSystemMenu);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."));
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsVisual", "Look & Feel")))
|
||||
{
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsGlobalUiScale", "Global UI Scale"));
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 3);
|
||||
if (ImGui.Button("Reset"))
|
||||
{
|
||||
this.globalUiScale = 1.0f;
|
||||
ImGui.GetIO().FontGlobalScale = this.globalUiScale;
|
||||
}
|
||||
|
||||
if (ImGui.DragFloat("##DalamudSettingsGlobalUiScaleDrag", ref this.globalUiScale, 0.005f, MinScale, MaxScale, "%.2f"))
|
||||
ImGui.GetIO().FontGlobalScale = this.globalUiScale;
|
||||
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsGlobalUiScaleHint", "Scale all XIVLauncher UI elements - useful for 4K displays."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10, 16);
|
||||
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"), ref this.doToggleUiHide);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHideDuringCutscenes", "Hide plugin UI during cutscenes"), ref this.doToggleUiHideDuringCutscenes);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleUiHideDuringCutscenesHint", "Hide any open windows by plugins during cutscenes."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleUiHideDuringGpose", "Hide plugin UI while gpose is active"), ref this.doToggleUiHideDuringGpose);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleUiHideDuringGposeHint", "Hide any open windows by plugins while gpose is active."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10, 16);
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleViewports", "Enable multi-monitor windows"), ref this.doViewport);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleViewportsHint", "This will allow you move plugin windows onto other monitors.\nWill only work in Borderless Window or Windowed mode."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleDocking", "Enable window docking"), ref this.doDocking);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."));
|
||||
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingToggleGamepadNavigation", "Enable navigation of ImGui windows via gamepad."), ref this.doGamepad);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and ImGui navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."));
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem(Loc.Localize("DalamudSettingsExperimental", "Experimental")))
|
||||
{
|
||||
ImGui.Checkbox(Loc.Localize("DalamudSettingsPluginTest", "Get plugin testing builds"), ref this.doPluginTest);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsPluginTestHint", "Receive testing prereleases for plugins."));
|
||||
ImGui.TextColored(this.warnTextColor, Loc.Localize("DalamudSettingsPluginTestWarning", "Testing plugins may not have been vetted before being published. Please only enable this if you are aware of the risks."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(12);
|
||||
|
||||
if (ImGui.Button(Loc.Localize("DalamudSettingsClearHidden", "Clear hidden plugins")))
|
||||
{
|
||||
this.dalamud.Configuration.HiddenPluginInternalName.Clear();
|
||||
this.dalamud.PluginManager.RefilterPluginMasters();
|
||||
}
|
||||
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsClearHiddenHint", "Restore plugins you have previously hidden from the plugin installer."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(12);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(12);
|
||||
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories."));
|
||||
ImGui.TextColored(this.warnTextColor, Loc.Localize("DalamudSettingCustomRepoWarning", "We cannot take any responsibility for third-party plugins and repositories.\nTake care when installing third-party plugins from untrusted sources."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
ImGui.Columns(4);
|
||||
ImGui.SetColumnWidth(0, 18 + (5 * ImGuiHelpers.GlobalScale));
|
||||
ImGui.SetColumnWidth(1, ImGui.GetWindowWidth() - (18 + 16 + 14) - ((5 + 45 + 26) * ImGuiHelpers.GlobalScale));
|
||||
ImGui.SetColumnWidth(2, 16 + (45 * ImGuiHelpers.GlobalScale));
|
||||
ImGui.SetColumnWidth(3, 14 + (26 * ImGuiHelpers.GlobalScale));
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Text("#");
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text("URL");
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text("Enabled");
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text(string.Empty);
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Text("0");
|
||||
ImGui.NextColumn();
|
||||
ImGui.Text("XIVLauncher");
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.Separator();
|
||||
|
||||
ThirdPartyRepoSettings toRemove = null;
|
||||
|
||||
var repoNumber = 1;
|
||||
foreach (var thirdRepoSetting in this.thirdRepoList)
|
||||
{
|
||||
var isEnabled = thirdRepoSetting.IsEnabled;
|
||||
|
||||
ImGui.PushID($"thirdRepo_{thirdRepoSetting.Url}");
|
||||
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(repoNumber.ToString()).X / 2));
|
||||
ImGui.Text(repoNumber.ToString());
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.TextWrapped(thirdRepoSetting.Url);
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 7 - (12 * ImGuiHelpers.GlobalScale));
|
||||
ImGui.Checkbox("##thirdRepoCheck", ref isEnabled);
|
||||
ImGui.NextColumn();
|
||||
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash))
|
||||
{
|
||||
toRemove = thirdRepoSetting;
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.Separator();
|
||||
|
||||
thirdRepoSetting.IsEnabled = isEnabled;
|
||||
|
||||
repoNumber++;
|
||||
}
|
||||
|
||||
if (toRemove != null)
|
||||
{
|
||||
this.thirdRepoList.Remove(toRemove);
|
||||
}
|
||||
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(repoNumber.ToString()).X / 2));
|
||||
ImGui.Text(repoNumber.ToString());
|
||||
ImGui.NextColumn();
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
ImGui.InputText("##thirdRepoUrlInput", ref this.thirdRepoTempUrl, 300);
|
||||
ImGui.NextColumn();
|
||||
// Enabled button
|
||||
ImGui.NextColumn();
|
||||
if (!string.IsNullOrEmpty(this.thirdRepoTempUrl) && ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
if (this.thirdRepoList.Any(r => string.Equals(r.Url, this.thirdRepoTempUrl, StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
this.thirdRepoAddError = Loc.Localize("DalamudThirdRepoExists", "Repo already exists.");
|
||||
Task.Delay(5000).ContinueWith(t => this.thirdRepoAddError = string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.thirdRepoList.Add(new ThirdPartyRepoSettings
|
||||
{
|
||||
Url = this.thirdRepoTempUrl,
|
||||
IsEnabled = true,
|
||||
});
|
||||
|
||||
this.thirdRepoTempUrl = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Columns(1);
|
||||
|
||||
ImGui.EndTabItem();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.thirdRepoAddError))
|
||||
{
|
||||
ImGui.TextColored(new Vector4(1, 0, 0, 1), this.thirdRepoAddError);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
|
||||
if (ImGui.Button(Loc.Localize("Save", "Save")))
|
||||
{
|
||||
this.Save();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
|
||||
{
|
||||
this.Save();
|
||||
this.IsOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
this.dalamud.LocalizationManager.SetupWithLangCode(this.languages[this.langIndex]);
|
||||
this.dalamud.Configuration.LanguageOverride = this.languages[this.langIndex];
|
||||
|
||||
this.dalamud.Configuration.GeneralChatType = this.dalamudMessagesChatType;
|
||||
|
||||
this.dalamud.Configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;
|
||||
this.dalamud.Configuration.DutyFinderChatMessage = this.doCfChatMessage;
|
||||
|
||||
this.dalamud.Configuration.GlobalUiScale = this.globalUiScale;
|
||||
this.dalamud.Configuration.ToggleUiHide = this.doToggleUiHide;
|
||||
this.dalamud.Configuration.ToggleUiHideDuringCutscenes = this.doToggleUiHideDuringCutscenes;
|
||||
this.dalamud.Configuration.ToggleUiHideDuringGpose = this.doToggleUiHideDuringGpose;
|
||||
|
||||
this.dalamud.Configuration.IsDocking = this.doDocking;
|
||||
this.dalamud.Configuration.IsGamepadNavigationEnabled = this.doGamepad;
|
||||
|
||||
// This is applied every frame in InterfaceManager::CheckViewportState()
|
||||
this.dalamud.Configuration.IsDisableViewport = !this.doViewport;
|
||||
|
||||
// Apply docking flag
|
||||
if (!this.dalamud.Configuration.IsDocking)
|
||||
{
|
||||
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.DockingEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.GetIO().ConfigFlags |= ImGuiConfigFlags.DockingEnable;
|
||||
}
|
||||
|
||||
// NOTE (Chiv) Toggle gamepad navigation via setting
|
||||
if (!this.dalamud.Configuration.IsGamepadNavigationEnabled)
|
||||
{
|
||||
ImGui.GetIO().BackendFlags &= ~ImGuiBackendFlags.HasGamepad;
|
||||
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.NavEnableSetMousePos;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.GetIO().BackendFlags |= ImGuiBackendFlags.HasGamepad;
|
||||
ImGui.GetIO().ConfigFlags |= ImGuiConfigFlags.NavEnableSetMousePos;
|
||||
}
|
||||
|
||||
this.dalamud.Configuration.DoPluginTest = this.doPluginTest;
|
||||
this.dalamud.Configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
|
||||
|
||||
this.dalamud.Configuration.PrintPluginsWelcomeMsg = this.printPluginsWelcomeMsg;
|
||||
this.dalamud.Configuration.AutoUpdatePlugins = this.autoUpdatePlugins;
|
||||
this.dalamud.Configuration.DoButtonsSystemMenu = this.doButtonsSystemMenu;
|
||||
|
||||
this.dalamud.Configuration.Save();
|
||||
|
||||
this.dalamud.PluginManager.ReloadPluginMasters();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue