Initial release: HSUI v1.0.0.0 - HUD replacement with configurable hotbars
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
using Dalamud.Interface.Windowing;
|
||||
using HSUI.Helpers;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace HSUI.Config.Windows
|
||||
{
|
||||
public class ChangelogWindow : Window
|
||||
{
|
||||
public string Changelog { get; set; }
|
||||
private bool _needsToSetSize = true;
|
||||
|
||||
public bool AutoClose = false;
|
||||
private double _openTime = -1;
|
||||
|
||||
private bool _popColors = false;
|
||||
|
||||
public ChangelogWindow(string name, string changelog) : base(name)
|
||||
{
|
||||
Changelog = changelog;
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
if (ConfigurationManager.Instance.OverrideDalamudStyle)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(10f / 255f, 10f / 255f, 10f / 255f, 0.95f));
|
||||
_popColors = true;
|
||||
}
|
||||
|
||||
if (_needsToSetSize)
|
||||
{
|
||||
float height = ImGui.CalcTextSize(Changelog).Y + 100;
|
||||
ImGui.SetNextWindowSize(new Vector2(500, Math.Min(height, 500)), ImGuiCond.FirstUseEver);
|
||||
_needsToSetSize = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
Vector2 size = ImGui.GetWindowSize();
|
||||
ImGui.PushTextWrapPos(ImGui.GetCursorPosX() + size.X - 24);
|
||||
ImGui.TextWrapped(Changelog);
|
||||
|
||||
if (AutoClose &&
|
||||
_openTime > 0 &&
|
||||
ImGui.GetTime() - _openTime > 10)
|
||||
{
|
||||
IsOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw()
|
||||
{
|
||||
if (_popColors)
|
||||
{
|
||||
ImGui.PopStyleColor();
|
||||
_popColors = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
_openTime = ImGui.GetTime();
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
if (AutoClose && InputsHelper.Instance != null)
|
||||
{
|
||||
AutoClose = false;
|
||||
Plugin.LoadTime = ImGui.GetTime() - InputsHelper.InitializationDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Dalamud.Interface.Windowing;
|
||||
using HSUI.Interface.GeneralElements;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using System.Numerics;
|
||||
|
||||
namespace HSUI.Config.Windows
|
||||
{
|
||||
public class GridWindow : Window
|
||||
{
|
||||
private bool _popColors = false;
|
||||
public GridWindow(string name) : base(name)
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollWithMouse;
|
||||
Size = new Vector2(300, 200);
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
ConfigurationManager.Instance.LockHUD = true;
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
if (ConfigurationManager.Instance.OverrideDalamudStyle)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(10f / 255f, 10f / 255f, 10f / 255f, 0.95f));
|
||||
_popColors = true;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowFocus();
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
var configManager = ConfigurationManager.Instance;
|
||||
var node = configManager.GetConfigPageNode<GridConfig>();
|
||||
if (node == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.PushItemWidth(150);
|
||||
bool changed = false;
|
||||
node.Draw(ref changed);
|
||||
}
|
||||
|
||||
public override void PostDraw()
|
||||
{
|
||||
if (_popColors)
|
||||
{
|
||||
ImGui.PopStyleColor();
|
||||
_popColors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using HSUI.Config.Tree;
|
||||
using HSUI.Interface.GeneralElements;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace HSUI.Config.Windows
|
||||
{
|
||||
public class MainConfigWindow : Window
|
||||
{
|
||||
public BaseNode? node { get; set; }
|
||||
public Action? CloseAction;
|
||||
|
||||
private float _alpha = 1f;
|
||||
private Vector2 _lastWindowPos = Vector2.Zero;
|
||||
private Vector2 _size = new Vector2(1050, 750);
|
||||
|
||||
private bool _popColors = false;
|
||||
|
||||
public MainConfigWindow(string name) : base(name)
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoTitleBar;
|
||||
Size = _size;
|
||||
SizeCondition = ImGuiCond.FirstUseEver;
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
private bool CheckWindowFocus()
|
||||
{
|
||||
Vector2 mousePos = ImGui.GetMousePos();
|
||||
Vector2 endPos = _lastWindowPos + _size;
|
||||
|
||||
return mousePos.X >= _lastWindowPos.X && mousePos.X <= endPos.X &&
|
||||
mousePos.Y >= _lastWindowPos.Y && mousePos.Y <= endPos.Y;
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
_alpha = 1;
|
||||
|
||||
HUDOptionsConfig? config = ConfigurationManager.Instance.GetConfigObject<HUDOptionsConfig>();
|
||||
if (config?.DimConfigWindow == true)
|
||||
{
|
||||
_alpha = CheckWindowFocus() ? 1 : 0.5f;
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Instance.OverrideDalamudStyle)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Border, new Vector4(0f / 255f, 0f / 255f, 0f / 255f, _alpha));
|
||||
ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Vector4(0f / 255f, 0f / 255f, 0f / 255f, _alpha));
|
||||
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(20f / 255f, 21f / 255f, 20f / 255f, _alpha));
|
||||
_popColors = true;
|
||||
}
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 1);
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 1);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
_lastWindowPos = ImGui.GetWindowPos();
|
||||
|
||||
if (_popColors)
|
||||
{
|
||||
ImGui.PopStyleColor(3);
|
||||
_popColors = false;
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar(2);
|
||||
|
||||
node?.Draw(_alpha);
|
||||
|
||||
_size = ImGui.GetWindowSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user