diff --git a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs index 3036bdb..edb493c 100644 --- a/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs +++ b/LightlessSync/LightlessConfiguration/Configurations/LightlessConfig.cs @@ -88,6 +88,7 @@ public class LightlessConfig : ILightlessConfiguration public bool LightfinderLabelUseIcon { get; set; } = false; public bool LightfinderLabelShowOwn { get; set; } = true; public bool LightfinderLabelShowPaired { get; set; } = true; + public bool LightfinderLabelShowHidden { get; set; } = false; public string LightfinderLabelIconGlyph { get; set; } = SeIconCharExtensions.ToIconString(SeIconChar.Hyadelyn); public float LightfinderLabelScale { get; set; } = 1.0f; public bool LightfinderAutoAlign { get; set; } = true; diff --git a/LightlessSync/Services/CommandManagerService.cs b/LightlessSync/Services/CommandManagerService.cs index b2993d3..7aedc7b 100644 --- a/LightlessSync/Services/CommandManagerService.cs +++ b/LightlessSync/Services/CommandManagerService.cs @@ -43,7 +43,7 @@ public sealed class CommandManagerService : IDisposable "\t /light gpose - Opens the Lightless Character Data Hub window" + Environment.NewLine + "\t /light analyze - Opens the Lightless Character Data Analysis window" + Environment.NewLine + "\t /light settings - Opens the Lightless Settings window" + Environment.NewLine + - "\t /light lightfinder - Opens the Lightfinder window" + "\t /light finder - Opens the Lightfinder window" }); } @@ -123,7 +123,7 @@ public sealed class CommandManagerService : IDisposable { _mediator.Publish(new UiToggleMessage(typeof(SettingsUi))); } - else if (string.Equals(splitArgs[0], "lightfinder", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(splitArgs[0], "finder", StringComparison.OrdinalIgnoreCase)) { _mediator.Publish(new UiToggleMessage(typeof(BroadcastUI))); } diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index 0731d0e..024c500 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -247,7 +247,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber var pNameplateIconNode = nameplateObject.MarkerIcon; var pNameplateResNode = nameplateObject.NameContainer; var pNameplateTextNode = nameplateObject.NameText; - bool IsVisible = pNameplateIconNode->AtkResNode.IsVisible() || (pNameplateResNode->IsVisible() && pNameplateTextNode->AtkResNode.IsVisible()); + bool IsVisible = pNameplateIconNode->AtkResNode.IsVisible() || (pNameplateResNode->IsVisible() && pNameplateTextNode->AtkResNode.IsVisible()) || _configService.Current.LightfinderLabelShowHidden; pNode->AtkResNode.ToggleVisibility(IsVisible); var nameContainer = nameplateObject.NameContainer; @@ -360,33 +360,35 @@ public unsafe class NameplateHandler : IMediatorSubscriber } int positionX; + + if (!config.LightfinderLabelUseIcon && (string.IsNullOrWhiteSpace(labelContent) || string.Equals(labelContent, "-", StringComparison.Ordinal))) + labelContent = DefaultLabelText; + + pNode->FontType = config.LightfinderLabelUseIcon ? FontType.Axis : FontType.MiedingerMed; + + pNode->SetText(labelContent); + + if (!config.LightfinderLabelUseIcon) + { + pNode->TextFlags &= ~TextFlags.AutoAdjustNodeSize; + pNode->AtkResNode.Width = 0; + nodeWidth = (int)pNode->AtkResNode.GetWidth(); + if (nodeWidth <= 0) + nodeWidth = (int)System.Math.Round(AtkNodeHelpers.DefaultTextNodeWidth * effectiveScale); + pNode->AtkResNode.Width = (ushort)nodeWidth; + } + else + { + pNode->TextFlags |= TextFlags.AutoAdjustNodeSize; + pNode->AtkResNode.Width = 0; + nodeWidth = pNode->AtkResNode.GetWidth(); + } + + if (config.LightfinderAutoAlign && nameContainer != null && hasValidOffset) { var nameplateWidth = (int)nameContainer->Width; - if (!config.LightfinderLabelUseIcon) - { - pNode->TextFlags &= ~TextFlags.AutoAdjustNodeSize; - pNode->AtkResNode.Width = 0; - pNode->SetText(labelContent); - - nodeWidth = (int)pNode->AtkResNode.GetWidth(); - if (nodeWidth <= 0) - nodeWidth = (int)System.Math.Round(AtkNodeHelpers.DefaultTextNodeWidth * effectiveScale); - - if (nodeWidth > nameplateWidth) - nodeWidth = nameplateWidth; - - pNode->AtkResNode.Width = (ushort)nodeWidth; - } - else - { - pNode->TextFlags |= TextFlags.AutoAdjustNodeSize; - pNode->AtkResNode.Width = 0; - pNode->SetText(labelContent); - nodeWidth = (int)pNode->AtkResNode.GetWidth(); - } - int leftPos = nameplateWidth / 8; int rightPos = nameplateWidth - nodeWidth - (nameplateWidth / 8); int centrePos = (nameplateWidth - nodeWidth) / 2; @@ -414,7 +416,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber positionX = 58 + config.LightfinderLabelOffsetX; alignment = AlignmentType.Bottom; } - + positionY += config.LightfinderLabelOffsetY; alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8); diff --git a/LightlessSync/UI/SettingsUi.cs b/LightlessSync/UI/SettingsUi.cs index 6bb69a2..1b3038a 100644 --- a/LightlessSync/UI/SettingsUi.cs +++ b/LightlessSync/UI/SettingsUi.cs @@ -1728,6 +1728,17 @@ public class SettingsUi : WindowMediatorSubscriberBase } _uiShared.DrawHelpText("Toggles paired player(s) Lightfinder label."); + var showHidden = _configService.Current.LightfinderLabelShowHidden; + if (ImGui.Checkbox("Show Lightfinder label when no nameplate(s) is visible", ref showHidden)) + { + _configService.Current.LightfinderLabelShowHidden = showHidden; + _configService.Save(); + _nameplateHandler.ClearNameplateCaches(); + _nameplateHandler.FlagRefresh(); + _nameplateService.RequestRedraw(); + } + _uiShared.DrawHelpText("Toggles Lightfinder label when no nameplate(s) is visible."); + _uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f); ImGui.TextUnformatted("Label"); @@ -1772,7 +1783,8 @@ public class SettingsUi : WindowMediatorSubscriberBase var selected = i == _lightfinderIconPresetIndex; if (ImGui.Selectable(preview, selected)) { - ApplyLightfinderIcon(optionGlyph, i); + _lightfinderIconInput = NameplateHandler.ToIconEditorString(optionGlyph); + _lightfinderIconPresetIndex = i; } } @@ -3151,7 +3163,7 @@ public class SettingsUi : WindowMediatorSubscriberBase ImGui.SameLine(); if (ImGui.Button("Lightless Sync Discord")) { - Util.OpenLink("https://discord.gg/mpNdkrTRjW"); + Util.OpenLink("https://discord.gg/Lightless"); } ImGui.Separator(); if (ImGui.BeginTabBar("mainTabBar"))