From a772ee4705e7f374e405444f68d47eb13de59429 Mon Sep 17 00:00:00 2001 From: azyges Date: Wed, 8 Oct 2025 01:47:04 +0900 Subject: [PATCH] improve lightfinder settings --- .../Configurations/LightlessConfig.cs | 2 +- LightlessSync/Services/NameplateHandler.cs | 2 +- LightlessSync/UI/SettingsUi.cs | 59 ++++++++++++++++--- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs index f90472a..c20d631 100644 --- a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs @@ -80,7 +80,7 @@ public class LightlessConfig : ILightlessConfiguration public bool LightfinderLabelUseIcon { get; set; } = false; public bool LightfinderLabelShowOwn { get; set; } = true; public bool LightfinderLabelShowPaired { get; set; } = true; - public string LightfinderLabelIconGlyph { get; set; } = SeIconCharExtensions.ToIconString(SeIconChar.LinkMarker); + public string LightfinderLabelIconGlyph { get; set; } = SeIconCharExtensions.ToIconString(SeIconChar.Hyadelyn); public float LightfinderLabelScale { get; set; } = 1.0f; public bool LightfinderAutoAlign { get; set; } = true; public LabelAlignment LabelAlignment { get; set; } = LabelAlignment.Left; diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index 0c4d65b..74edabc 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -43,7 +43,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber internal const uint mNameplateNodeIDBase = 0x7D99D500; private const string DefaultLabelText = "LightFinder"; - private const SeIconChar DefaultIcon = SeIconChar.LinkMarker; + private const SeIconChar DefaultIcon = SeIconChar.Hyadelyn; private const int ContainerOffsetX = 50; private static readonly string DefaultIconGlyph = SeIconCharExtensions.ToIconString(DefaultIcon); diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 95b0311..84e4e94 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -1066,7 +1066,13 @@ public class SettingsUi : WindowMediatorSubscriberBase if (_uiShared.MediumTreeNode("Lightfinder", UIColors.Get("LightlessPurple"))) { + var autoAlign = _configService.Current.LightfinderAutoAlign; var offsetX = (int)_configService.Current.LightfinderLabelOffsetX; + var offsetY = (int)_configService.Current.LightfinderLabelOffsetY; + var labelScale = _configService.Current.LightfinderLabelScale; + + ImGui.TextUnformatted("Alignment"); + ImGui.BeginDisabled(autoAlign); if (ImGui.SliderInt("Label Offset X", ref offsetX, -200, 200)) { _configService.Current.LightfinderLabelOffsetX = (short)offsetX; @@ -1075,9 +1081,20 @@ public class SettingsUi : WindowMediatorSubscriberBase _nameplateHandler.FlagRefresh(); _nameplateService.RequestRedraw(); } - _uiShared.DrawHelpText("Moves the Lightfinder label horizontally on player nameplates."); + if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) + { + _configService.Current.LightfinderLabelOffsetX = 0; + _configService.Save(); + _nameplateHandler.ClearNameplateCaches(); + _nameplateHandler.FlagRefresh(); + _nameplateService.RequestRedraw(); + } + if (ImGui.IsItemHovered()) + ImGui.SetTooltip("Right click to reset to default."); + ImGui.EndDisabled(); + _uiShared.DrawHelpText("Moves the Lightfinder label horizontally on player nameplates.\nUnavailable when automatic alignment is enabled."); + - var offsetY = (int)_configService.Current.LightfinderLabelOffsetY; if (ImGui.SliderInt("Label Offset Y", ref offsetY, -200, 200)) { _configService.Current.LightfinderLabelOffsetY = (short)offsetY; @@ -1086,9 +1103,18 @@ public class SettingsUi : WindowMediatorSubscriberBase _nameplateHandler.FlagRefresh(); _nameplateService.RequestRedraw(); } + if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) + { + _configService.Current.LightfinderLabelOffsetY = 0; + _configService.Save(); + _nameplateHandler.ClearNameplateCaches(); + _nameplateHandler.FlagRefresh(); + _nameplateService.RequestRedraw(); + } + if (ImGui.IsItemHovered()) + ImGui.SetTooltip("Right click to reset to default."); _uiShared.DrawHelpText("Moves the Lightfinder label vertically on player nameplates."); - var labelScale = _configService.Current.LightfinderLabelScale; if (ImGui.SliderFloat("Label Size", ref labelScale, 0.5f, 2.0f, "%.2fx")) { _configService.Current.LightfinderLabelScale = labelScale; @@ -1097,9 +1123,20 @@ public class SettingsUi : WindowMediatorSubscriberBase _nameplateHandler.FlagRefresh(); _nameplateService.RequestRedraw(); } + if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) + { + _configService.Current.LightfinderLabelScale = 1.0f; + _configService.Save(); + _nameplateHandler.ClearNameplateCaches(); + _nameplateHandler.FlagRefresh(); + _nameplateService.RequestRedraw(); + } + if (ImGui.IsItemHovered()) + ImGui.SetTooltip("Right click to reset to default."); _uiShared.DrawHelpText("Adjusts the Lightfinder label size for both text and icon modes."); - var autoAlign = _configService.Current.LightfinderAutoAlign; + ImGui.Dummy(new Vector2(8)); + if (ImGui.Checkbox("Automatically align with nameplate", ref autoAlign)) { _configService.Current.LightfinderAutoAlign = autoAlign; @@ -1148,8 +1185,11 @@ public class SettingsUi : WindowMediatorSubscriberBase } + _uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f); + + ImGui.TextUnformatted("Visibility"); var showOwn = _configService.Current.LightfinderLabelShowOwn; - if (ImGui.Checkbox("Show your own Lightfinder indicator", ref showOwn)) + if (ImGui.Checkbox("Show your own Lightfinder label", ref showOwn)) { _configService.Current.LightfinderLabelShowOwn = showOwn; _configService.Save(); @@ -1157,10 +1197,10 @@ public class SettingsUi : WindowMediatorSubscriberBase _nameplateHandler.FlagRefresh(); _nameplateService.RequestRedraw(); } - _uiShared.DrawHelpText("Toggles your own Lightfinder indicator."); + _uiShared.DrawHelpText("Toggles your own Lightfinder label."); var showPaired = _configService.Current.LightfinderLabelShowPaired; - if (ImGui.Checkbox("Show paired player(s) Lightfinder indicator", ref showPaired)) + if (ImGui.Checkbox("Show paired player(s) Lightfinder label", ref showPaired)) { _configService.Current.LightfinderLabelShowPaired = showPaired; _configService.Save(); @@ -1168,8 +1208,11 @@ public class SettingsUi : WindowMediatorSubscriberBase _nameplateHandler.FlagRefresh(); _nameplateService.RequestRedraw(); } - _uiShared.DrawHelpText("Toggles paired player(s) Lightfinder indicator."); + _uiShared.DrawHelpText("Toggles paired player(s) Lightfinder label."); + _uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f); + + ImGui.TextUnformatted("Label"); var useIcon = _configService.Current.LightfinderLabelUseIcon; if (ImGui.Checkbox("Show icon instead of text", ref useIcon)) {