This commit is contained in:
2025-12-16 06:31:29 +09:00
parent bdfcf254a8
commit 4444a88746
32 changed files with 1204 additions and 464 deletions

View File

@@ -42,6 +42,8 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
private const float DescriptionMaxVisibleLines = 12f;
private const string UserDescriptionPlaceholder = "-- User has no description set --";
private const string GroupDescriptionPlaceholder = "-- Syncshell has no description set --";
private const string LightfinderDisplayName = "Lightfinder User";
private readonly string _lightfinderDisplayName = LightfinderDisplayName;
private float _lastComputedWindowHeight = -1f;
public StandaloneProfileUi(
@@ -50,6 +52,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
UiSharedService uiBuilder,
ServerConfigurationManager serverManager,
ProfileTagService profileTagService,
DalamudUtilService dalamudUtilService,
LightlessProfileManager lightlessProfileManager,
PairUiService pairUiService,
Pair? pair,
@@ -58,7 +61,12 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
bool isLightfinderContext,
string? lightfinderCid,
PerformanceCollectorService performanceCollector)
: base(logger, mediator, BuildWindowTitle(userData, groupData, isLightfinderContext), performanceCollector)
: base(logger, mediator, BuildWindowTitle(
userData,
groupData,
isLightfinderContext,
isLightfinderContext ? ResolveLightfinderDisplayName(dalamudUtilService, lightfinderCid) : null),
performanceCollector)
{
_uiSharedService = uiBuilder;
_serverManager = serverManager;
@@ -71,17 +79,19 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
_isGroupProfile = groupData is not null;
_isLightfinderContext = isLightfinderContext;
_lightfinderCid = lightfinderCid;
if (_isLightfinderContext)
_lightfinderDisplayName = ResolveLightfinderDisplayName(dalamudUtilService, lightfinderCid);
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize;
var fixedSize = new Vector2(840f, 525f) * ImGuiHelpers.GlobalScale;
Size = fixedSize;
SizeCondition = ImGuiCond.Always;
SizeConstraints = new()
{
MinimumSize = fixedSize,
MaximumSize = new Vector2(fixedSize.X, fixedSize.Y * MaxHeightMultiplier)
};
WindowBuilder.For(this)
.SetSizeConstraints(
fixedSize,
new Vector2(fixedSize.X, fixedSize.Y * MaxHeightMultiplier))
.Apply();
IsOpen = true;
}
@@ -115,7 +125,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
return fallback;
}
private static string BuildWindowTitle(UserData? userData, GroupData? groupData, bool isLightfinderContext)
private static string BuildWindowTitle(UserData? userData, GroupData? groupData, bool isLightfinderContext, string? lightfinderDisplayName)
{
if (groupData is not null)
{
@@ -126,11 +136,24 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
if (userData is null)
return "Lightless Profile##LightlessSyncStandaloneProfileUI";
var name = userData.AliasOrUID;
var name = isLightfinderContext ? lightfinderDisplayName ?? LightfinderDisplayName : userData.AliasOrUID;
var suffix = isLightfinderContext ? " (Lightfinder)" : string.Empty;
return $"Lightless Profile of {name}{suffix}##LightlessSyncStandaloneProfileUI{name}";
}
private static string ResolveLightfinderDisplayName(DalamudUtilService dalamudUtilService, string? hashedCid)
{
if (string.IsNullOrEmpty(hashedCid))
return LightfinderDisplayName;
var (name, address) = dalamudUtilService.FindPlayerByNameHash(hashedCid);
if (string.IsNullOrEmpty(name))
return LightfinderDisplayName;
var world = dalamudUtilService.GetWorldNameFromPlayerAddress(address);
return string.IsNullOrEmpty(world) ? name : $"{name} ({world})";
}
protected override void DrawInternal()
{
try
@@ -300,7 +323,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
? Pair.UserData.Alias!
: _isLightfinderContext ? "Lightfinder Session" : noteText ?? string.Empty;
bool hasVanityAlias = userData.HasVanity && !string.IsNullOrWhiteSpace(userData.Alias);
bool hasVanityAlias = !_isLightfinderContext && userData.HasVanity && !string.IsNullOrWhiteSpace(userData.Alias);
Vector4? vanityTextColor = null;
Vector4? vanityGlowColor = null;
@@ -314,10 +337,12 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
}
bool useVanityColors = vanityTextColor.HasValue || vanityGlowColor.HasValue;
string primaryHeaderText = hasVanityAlias ? userData.Alias! : userData.UID;
string primaryHeaderText = _isLightfinderContext
? _lightfinderDisplayName
: hasVanityAlias ? userData.Alias! : userData.UID;
List<(string Text, bool UseVanityColor, bool Disabled)> secondaryHeaderLines = new();
if (hasVanityAlias)
if (!_isLightfinderContext && hasVanityAlias)
{
secondaryHeaderLines.Add((userData.UID, useVanityColors, false));
@@ -1232,4 +1257,4 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
bool Emphasis,
IReadOnlyList<string>? Tooltip = null,
string? TooltipTitle = null);
}
}