Update 0.1.8.1 - Changement UI & Ajout "vue sous" (cf.Suggestion Discord)

This commit is contained in:
2025-09-23 23:41:45 +02:00
parent 78089a9fc7
commit bf770f19d9
4 changed files with 117 additions and 42 deletions

View File

@@ -19,7 +19,7 @@ public class MareConfig : IMareConfiguration
public bool UseColorsInDtr { get; set; } = true; public bool UseColorsInDtr { get; set; } = true;
public DtrEntry.Colors DtrColorsDefault { get; set; } = default; public DtrEntry.Colors DtrColorsDefault { get; set; } = default;
public DtrEntry.Colors DtrColorsNotConnected { get; set; } = new(Glow: 0x0428FFu); public DtrEntry.Colors DtrColorsNotConnected { get; set; } = new(Glow: 0x0428FFu);
public DtrEntry.Colors DtrColorsPairsInRange { get; set; } = new(Glow: 0xFFBA47u); public DtrEntry.Colors DtrColorsPairsInRange { get; set; } = new(Glow: 0x8D37C0u);
public bool UseNameColors { get; set; } = false; public bool UseNameColors { get; set; } = false;
public DtrEntry.Colors NameColors { get; set; } = new(Foreground: 0x67EBF5u, Glow: 0x00303Cu); public DtrEntry.Colors NameColors { get; set; } = new(Foreground: 0x67EBF5u, Glow: 0x00303Cu);
public DtrEntry.Colors BlockedNameColors { get; set; } = new(Foreground: 0x8AADC7, Glow: 0x000080u); public DtrEntry.Colors BlockedNameColors { get; set; } = new(Foreground: 0x8AADC7, Glow: 0x000080u);

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<AssemblyName>UmbraSync</AssemblyName> <AssemblyName>UmbraSync</AssemblyName>
<RootNamespace>UmbraSync</RootNamespace> <RootNamespace>UmbraSync</RootNamespace>
<Version>0.1.8.0</Version> <Version>0.1.8.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,4 +1,4 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
@@ -61,6 +61,7 @@ public class CompactUi : WindowMediatorSubscriberBase
private bool _showSyncShells; private bool _showSyncShells;
private bool _wasOpen; private bool _wasOpen;
private bool _nearbyOpen = true; private bool _nearbyOpen = true;
private bool _pendingOpen = true;
private List<Services.Mediator.NearbyEntry> _nearbyEntries = new(); private List<Services.Mediator.NearbyEntry> _nearbyEntries = new();
public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController, PairManager pairManager, ChatService chatService, public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController, PairManager pairManager, ChatService chatService,
@@ -102,7 +103,20 @@ public class CompactUi : WindowMediatorSubscriberBase
Mediator.Subscribe<CutsceneEndMessage>(this, (_) => UiSharedService_GposeEnd()); Mediator.Subscribe<CutsceneEndMessage>(this, (_) => UiSharedService_GposeEnd());
Mediator.Subscribe<DownloadStartedMessage>(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus); Mediator.Subscribe<DownloadStartedMessage>(this, (msg) => _currentDownloads[msg.DownloadId] = msg.DownloadStatus);
Mediator.Subscribe<DownloadFinishedMessage>(this, (msg) => _currentDownloads.TryRemove(msg.DownloadId, out _)); Mediator.Subscribe<DownloadFinishedMessage>(this, (msg) => _currentDownloads.TryRemove(msg.DownloadId, out _));
Mediator.Subscribe<DiscoveryListUpdated>(this, (msg) => _nearbyEntries = msg.Entries); Mediator.Subscribe<DiscoveryListUpdated>(this, (msg) =>
{
_nearbyEntries = msg.Entries;
// Update last-seen character names for matched entries
foreach (var e in _nearbyEntries.Where(x => x.IsMatch))
{
var uid = e.Uid;
var lastSeen = e.DisplayName ?? e.Name;
if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(lastSeen))
{
_serverManager.SetNameForUid(uid, lastSeen);
}
}
});
Flags |= ImGuiWindowFlags.NoDocking; Flags |= ImGuiWindowFlags.NoDocking;
@@ -370,15 +384,85 @@ public class CompactUi : WindowMediatorSubscriberBase
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY(); : (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
var users = GetFilteredUsers().OrderBy(u => u.GetPairSortKey(), StringComparer.Ordinal); var users = GetFilteredUsers().OrderBy(u => u.GetPairSortKey(), StringComparer.Ordinal);
ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false);
try
{
var inbox = _nearbyPending;
if (inbox != null && inbox.Pending.Count > 0)
{
ImGuiHelpers.ScaledDummy(6);
_uiSharedService.BigText("Incoming requests");
foreach (var kv in inbox.Pending)
{
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"{kv.Value} [{kv.Key}]");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Check))
{
_ = inbox.AcceptAsync(kv.Key);
}
UiSharedService.AttachToolTip("Accept and add as pair");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Times))
{
inbox.Remove(kv.Key);
}
UiSharedService.AttachToolTip("Dismiss request");
}
ImGui.Separator();
}
}
catch { }
// Add the "En attente" category
using (ImRaii.PushId("group-Pending"))
{
var icon = _pendingOpen ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight;
_uiSharedService.IconText(icon);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) _pendingOpen = !_pendingOpen;
ImGui.SameLine();
ImGui.TextUnformatted($"En attente ({_nearbyPending?.Pending.Count ?? 0})");
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) _pendingOpen = !_pendingOpen;
if (_pendingOpen)
{
ImGui.Indent();
if (_nearbyPending != null && _nearbyPending.Pending.Count > 0)
{
foreach (var kv in _nearbyPending.Pending)
{
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"{kv.Value} [{kv.Key}]");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Check))
{
_ = _nearbyPending.AcceptAsync(kv.Key);
}
UiSharedService.AttachToolTip("Accept and add as pair");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Times))
{
_nearbyPending.Remove(kv.Key);
}
UiSharedService.AttachToolTip("Dismiss request");
}
}
else
{
UiSharedService.ColorTextWrapped("Aucune invitation en attente.", ImGuiColors.DalamudGrey3);
}
ImGui.Unindent();
ImGui.Separator();
}
}
var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList(); var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList(); var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
var offlineUsers = users.Where(u => !u.UserPair!.OtherPermissions.IsPaired() || (!u.IsOnline && !u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Offline" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList(); var offlineUsers = users.Where(u => !u.UserPair!.OtherPermissions.IsPaired() || (!u.IsOnline && !u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Offline" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false);
_pairGroupsUi.Draw(visibleUsers, onlineUsers, offlineUsers); _pairGroupsUi.Draw(visibleUsers, onlineUsers, offlineUsers);
// Always show a Nearby group when detection is enabled, even if empty
if (_configService.Current.EnableAutoDetectDiscovery) if (_configService.Current.EnableAutoDetectDiscovery)
{ {
using (ImRaii.PushId("group-Nearby")) using (ImRaii.PushId("group-Nearby"))
@@ -409,7 +493,7 @@ public class CompactUi : WindowMediatorSubscriberBase
.ToList(); .ToList();
if (nearby.Count == 0) if (nearby.Count == 0)
{ {
UiSharedService.ColorTextWrapped("No nearby players detected.", ImGuiColors.DalamudGrey3); UiSharedService.ColorTextWrapped("Aucun joueur detecté.", ImGuiColors.DalamudGrey3);
} }
else else
{ {
@@ -438,7 +522,7 @@ public class CompactUi : WindowMediatorSubscriberBase
if (isPaired) if (isPaired)
{ {
_uiSharedService.IconText(FontAwesomeIcon.Check, ImGuiColors.ParsedGreen); _uiSharedService.IconText(FontAwesomeIcon.Check, ImGuiColors.ParsedGreen);
UiSharedService.AttachToolTip("Déjà apparié sur Umbra"); UiSharedService.AttachToolTip("Déjà appairé");
} }
else if (!e.AcceptPairRequests) else if (!e.AcceptPairRequests)
{ {
@@ -451,7 +535,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{ {
_ = _autoDetectRequestService.SendRequestAsync(e.Token!); _ = _autoDetectRequestService.SendRequestAsync(e.Token!);
} }
UiSharedService.AttachToolTip("Envoyer une invitation Umbra"); UiSharedService.AttachToolTip("Envoyer une invitation d'apparaige");
} }
else else
{ {
@@ -460,33 +544,6 @@ public class CompactUi : WindowMediatorSubscriberBase
} }
} }
} }
try
{
var inbox = _nearbyPending;
if (inbox != null && inbox.Pending.Count > 0)
{
ImGuiHelpers.ScaledDummy(6);
_uiSharedService.BigText("Incoming requests");
foreach (var kv in inbox.Pending)
{
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted($"{kv.Value} [{kv.Key}]");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Check))
{
_ = inbox.AcceptAsync(kv.Key);
}
UiSharedService.AttachToolTip("Accept and add as pair");
ImGui.SameLine();
if (_uiSharedService.IconButton(FontAwesomeIcon.Times))
{
inbox.Remove(kv.Key);
}
UiSharedService.AttachToolTip("Dismiss request");
}
}
}
catch { }
ImGui.Unindent(); ImGui.Unindent();
ImGui.Separator(); ImGui.Separator();
} }
@@ -670,8 +727,8 @@ public class CompactUi : WindowMediatorSubscriberBase
ImGui.TextColored(GetUidColor(), uidText); ImGui.TextColored(GetUidColor(), uidText);
if (_apiController.ServerState is not ServerState.Connected) if (_apiController.ServerState is not ServerState.Connected)
{
UiSharedService.ColorTextWrapped(GetServerError(), GetUidColor()); UiSharedService.ColorTextWrapped(GetServerError(), GetUidColor());
{
if (_apiController.ServerState is ServerState.NoSecretKey) if (_apiController.ServerState is ServerState.NoSecretKey)
{ {
DrawAddCharacter(); DrawAddCharacter();
@@ -716,7 +773,7 @@ public class CompactUi : WindowMediatorSubscriberBase
{ {
ServerState.Connecting => ImGuiColors.DalamudYellow, ServerState.Connecting => ImGuiColors.DalamudYellow,
ServerState.Reconnecting => ImGuiColors.DalamudRed, ServerState.Reconnecting => ImGuiColors.DalamudRed,
ServerState.Connected => new Vector4(0.63f, 0.25f, 1f, 1f), // custom violet ServerState.Connected => new Vector4(0.63f, 0.25f, 1f, 1f),
ServerState.Disconnected => ImGuiColors.DalamudYellow, ServerState.Disconnected => ImGuiColors.DalamudYellow,
ServerState.Disconnecting => ImGuiColors.DalamudYellow, ServerState.Disconnecting => ImGuiColors.DalamudYellow,
ServerState.Unauthorized => ImGuiColors.DalamudRed, ServerState.Unauthorized => ImGuiColors.DalamudRed,

View File

@@ -77,9 +77,21 @@ public class UidDisplayHandler
if (_popupTime > DateTime.UtcNow || !_mareConfigService.Current.ProfilesShow) if (_popupTime > DateTime.UtcNow || !_mareConfigService.Current.ProfilesShow)
{ {
ImGui.SetTooltip("Left click to switch between UID display and nick" + Environment.NewLine // Build tooltip; prepend last-seen when player is offline or not visible
string tooltip = "Left click to switch between UID display and nick" + Environment.NewLine
+ "Right click to change nick for " + pair.UserData.AliasOrUID + Environment.NewLine + "Right click to change nick for " + pair.UserData.AliasOrUID + Environment.NewLine
+ "Middle Mouse Button to open their profile in a separate window"); + "Middle Mouse Button to open their profile in a separate window";
if (!pair.IsOnline || !pair.IsVisible)
{
var lastSeen = _serverManager.GetNameForUid(pair.UserData.UID);
if (!string.IsNullOrEmpty(lastSeen))
{
tooltip = "Vu sous : " + lastSeen + Environment.NewLine + tooltip;
}
}
ImGui.SetTooltip(tooltip);
} }
else if (_popupTime < DateTime.UtcNow && !_popupShown) else if (_popupTime < DateTime.UtcNow && !_popupShown)
{ {
@@ -142,6 +154,12 @@ public class UidDisplayHandler
public (bool isUid, string text) GetPlayerText(Pair pair) public (bool isUid, string text) GetPlayerText(Pair pair)
{ {
// When the user is offline or not visible, always show the raw UID (no alias/note/character name)
if (!pair.IsOnline || !pair.IsVisible)
{
return (true, pair.UserData.UID);
}
var textIsUid = true; var textIsUid = true;
bool showUidInsteadOfName = ShowUidInsteadOfName(pair); bool showUidInsteadOfName = ShowUidInsteadOfName(pair);
string? playerText = _serverManager.GetNoteForUid(pair.UserData.UID); string? playerText = _serverManager.GetNoteForUid(pair.UserData.UID);