improve lightfinder settings

This commit is contained in:
2025-10-08 01:47:04 +09:00
parent 1d88c04235
commit a772ee4705
3 changed files with 53 additions and 10 deletions

View File

@@ -80,7 +80,7 @@ public class LightlessConfig : ILightlessConfiguration
public bool LightfinderLabelUseIcon { get; set; } = false; public bool LightfinderLabelUseIcon { get; set; } = false;
public bool LightfinderLabelShowOwn { get; set; } = true; public bool LightfinderLabelShowOwn { get; set; } = true;
public bool LightfinderLabelShowPaired { 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 float LightfinderLabelScale { get; set; } = 1.0f;
public bool LightfinderAutoAlign { get; set; } = true; public bool LightfinderAutoAlign { get; set; } = true;
public LabelAlignment LabelAlignment { get; set; } = LabelAlignment.Left; public LabelAlignment LabelAlignment { get; set; } = LabelAlignment.Left;

View File

@@ -43,7 +43,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber
internal const uint mNameplateNodeIDBase = 0x7D99D500; internal const uint mNameplateNodeIDBase = 0x7D99D500;
private const string DefaultLabelText = "LightFinder"; private const string DefaultLabelText = "LightFinder";
private const SeIconChar DefaultIcon = SeIconChar.LinkMarker; private const SeIconChar DefaultIcon = SeIconChar.Hyadelyn;
private const int ContainerOffsetX = 50; private const int ContainerOffsetX = 50;
private static readonly string DefaultIconGlyph = SeIconCharExtensions.ToIconString(DefaultIcon); private static readonly string DefaultIconGlyph = SeIconCharExtensions.ToIconString(DefaultIcon);

View File

@@ -1066,7 +1066,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (_uiShared.MediumTreeNode("Lightfinder", UIColors.Get("LightlessPurple"))) if (_uiShared.MediumTreeNode("Lightfinder", UIColors.Get("LightlessPurple")))
{ {
var autoAlign = _configService.Current.LightfinderAutoAlign;
var offsetX = (int)_configService.Current.LightfinderLabelOffsetX; 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)) if (ImGui.SliderInt("Label Offset X", ref offsetX, -200, 200))
{ {
_configService.Current.LightfinderLabelOffsetX = (short)offsetX; _configService.Current.LightfinderLabelOffsetX = (short)offsetX;
@@ -1075,9 +1081,20 @@ public class SettingsUi : WindowMediatorSubscriberBase
_nameplateHandler.FlagRefresh(); _nameplateHandler.FlagRefresh();
_nameplateService.RequestRedraw(); _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)) if (ImGui.SliderInt("Label Offset Y", ref offsetY, -200, 200))
{ {
_configService.Current.LightfinderLabelOffsetY = (short)offsetY; _configService.Current.LightfinderLabelOffsetY = (short)offsetY;
@@ -1086,9 +1103,18 @@ public class SettingsUi : WindowMediatorSubscriberBase
_nameplateHandler.FlagRefresh(); _nameplateHandler.FlagRefresh();
_nameplateService.RequestRedraw(); _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."); _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")) if (ImGui.SliderFloat("Label Size", ref labelScale, 0.5f, 2.0f, "%.2fx"))
{ {
_configService.Current.LightfinderLabelScale = labelScale; _configService.Current.LightfinderLabelScale = labelScale;
@@ -1097,9 +1123,20 @@ public class SettingsUi : WindowMediatorSubscriberBase
_nameplateHandler.FlagRefresh(); _nameplateHandler.FlagRefresh();
_nameplateService.RequestRedraw(); _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."); _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)) if (ImGui.Checkbox("Automatically align with nameplate", ref autoAlign))
{ {
_configService.Current.LightfinderAutoAlign = 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; 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.Current.LightfinderLabelShowOwn = showOwn;
_configService.Save(); _configService.Save();
@@ -1157,10 +1197,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
_nameplateHandler.FlagRefresh(); _nameplateHandler.FlagRefresh();
_nameplateService.RequestRedraw(); _nameplateService.RequestRedraw();
} }
_uiShared.DrawHelpText("Toggles your own Lightfinder indicator."); _uiShared.DrawHelpText("Toggles your own Lightfinder label.");
var showPaired = _configService.Current.LightfinderLabelShowPaired; 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.Current.LightfinderLabelShowPaired = showPaired;
_configService.Save(); _configService.Save();
@@ -1168,8 +1208,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
_nameplateHandler.FlagRefresh(); _nameplateHandler.FlagRefresh();
_nameplateService.RequestRedraw(); _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; var useIcon = _configService.Current.LightfinderLabelUseIcon;
if (ImGui.Checkbox("Show icon instead of text", ref useIcon)) if (ImGui.Checkbox("Show icon instead of text", ref useIcon))
{ {