Merge branch '1.12.2' into lightfinder-partial-rework

This commit is contained in:
2025-10-11 01:04:12 +02:00
4 changed files with 44 additions and 29 deletions

View File

@@ -88,6 +88,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 bool LightfinderLabelShowHidden { get; set; } = false;
public string LightfinderLabelIconGlyph { get; set; } = SeIconCharExtensions.ToIconString(SeIconChar.Hyadelyn); 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;

View File

@@ -43,7 +43,7 @@ public sealed class CommandManagerService : IDisposable
"\t /light gpose - Opens the Lightless Character Data Hub window" + Environment.NewLine + "\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 analyze - Opens the Lightless Character Data Analysis window" + Environment.NewLine +
"\t /light settings - Opens the Lightless Settings 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))); _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))); _mediator.Publish(new UiToggleMessage(typeof(BroadcastUI)));
} }

View File

@@ -247,7 +247,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber
var pNameplateIconNode = nameplateObject.MarkerIcon; var pNameplateIconNode = nameplateObject.MarkerIcon;
var pNameplateResNode = nameplateObject.NameContainer; var pNameplateResNode = nameplateObject.NameContainer;
var pNameplateTextNode = nameplateObject.NameText; 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); pNode->AtkResNode.ToggleVisibility(IsVisible);
var nameContainer = nameplateObject.NameContainer; var nameContainer = nameplateObject.NameContainer;
@@ -360,33 +360,35 @@ public unsafe class NameplateHandler : IMediatorSubscriber
} }
int positionX; 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) if (config.LightfinderAutoAlign && nameContainer != null && hasValidOffset)
{ {
var nameplateWidth = (int)nameContainer->Width; 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 leftPos = nameplateWidth / 8;
int rightPos = nameplateWidth - nodeWidth - (nameplateWidth / 8); int rightPos = nameplateWidth - nodeWidth - (nameplateWidth / 8);
int centrePos = (nameplateWidth - nodeWidth) / 2; int centrePos = (nameplateWidth - nodeWidth) / 2;
@@ -414,7 +416,7 @@ public unsafe class NameplateHandler : IMediatorSubscriber
positionX = 58 + config.LightfinderLabelOffsetX; positionX = 58 + config.LightfinderLabelOffsetX;
alignment = AlignmentType.Bottom; alignment = AlignmentType.Bottom;
} }
positionY += config.LightfinderLabelOffsetY; positionY += config.LightfinderLabelOffsetY;
alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8); alignment = (AlignmentType)System.Math.Clamp((int)alignment, 0, 8);

View File

@@ -1728,6 +1728,17 @@ public class SettingsUi : WindowMediatorSubscriberBase
} }
_uiShared.DrawHelpText("Toggles paired player(s) Lightfinder label."); _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); _uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Label"); ImGui.TextUnformatted("Label");
@@ -1772,7 +1783,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
var selected = i == _lightfinderIconPresetIndex; var selected = i == _lightfinderIconPresetIndex;
if (ImGui.Selectable(preview, selected)) if (ImGui.Selectable(preview, selected))
{ {
ApplyLightfinderIcon(optionGlyph, i); _lightfinderIconInput = NameplateHandler.ToIconEditorString(optionGlyph);
_lightfinderIconPresetIndex = i;
} }
} }
@@ -3151,7 +3163,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.SameLine(); ImGui.SameLine();
if (ImGui.Button("Lightless Sync Discord")) if (ImGui.Button("Lightless Sync Discord"))
{ {
Util.OpenLink("https://discord.gg/mpNdkrTRjW"); Util.OpenLink("https://discord.gg/Lightless");
} }
ImGui.Separator(); ImGui.Separator();
if (ImGui.BeginTabBar("mainTabBar")) if (ImGui.BeginTabBar("mainTabBar"))