Fix UI & Rotate Salt

This commit is contained in:
2025-09-19 22:33:40 +02:00
parent 1755b5cb54
commit 612e7c88a2
7 changed files with 92 additions and 35 deletions

View File

@@ -12,6 +12,7 @@ using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Services.ServerConfiguration;
using MareSynchronos.Services.AutoDetect;
using MareSynchronos.UI.Components;
using MareSynchronos.UI.Handlers;
using MareSynchronos.WebAPI;
@@ -44,7 +45,8 @@ public class CompactUi : WindowMediatorSubscriberBase
private readonly ServerConfigurationManager _serverManager;
private readonly Stopwatch _timeout = new();
private readonly CharaDataManager _charaDataManager;
private readonly Services.AutoDetect.NearbyPendingService _nearbyPending;
private readonly NearbyPendingService _nearbyPending;
private readonly AutoDetectRequestService _autoDetectRequestService;
private readonly UidDisplayHandler _uidDisplayHandler;
private readonly UiSharedService _uiSharedService;
private bool _buttonState;
@@ -63,7 +65,8 @@ public class CompactUi : WindowMediatorSubscriberBase
public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, MareConfigService configService, ApiController apiController, PairManager pairManager, ChatService chatService,
ServerConfigurationManager serverManager, MareMediator mediator, FileUploadManager fileTransferManager, UidDisplayHandler uidDisplayHandler, CharaDataManager charaDataManager,
Services.AutoDetect.NearbyPendingService nearbyPendingService,
NearbyPendingService nearbyPendingService,
AutoDetectRequestService autoDetectRequestService,
PerformanceCollectorService performanceCollectorService)
: base(logger, mediator, "###UmbraSyncMainUI", performanceCollectorService)
{
@@ -76,6 +79,7 @@ public class CompactUi : WindowMediatorSubscriberBase
_uidDisplayHandler = uidDisplayHandler;
_charaDataManager = charaDataManager;
_nearbyPending = nearbyPendingService;
_autoDetectRequestService = autoDetectRequestService;
var tagHandler = new TagHandler(_serverManager);
_groupPanel = new(this, uiShared, _pairManager, chatService, uidDisplayHandler, _configService, _serverManager, _charaDataManager);
@@ -428,20 +432,31 @@ public class CompactUi : WindowMediatorSubscriberBase
isPaired = _pairManager.DirectPairs.Any(p => string.Equals(p.UserData.AliasOrUID, key, StringComparison.OrdinalIgnoreCase));
}
var statusText = isPaired ? "✔ Paired" : (e.AcceptPairRequests ? " Invite" : "⛔ Requests disabled");
var statusSize = ImGui.CalcTextSize(statusText);
ImGui.SetCursorPosX(right - statusSize.X);
var statusButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.UserPlus);
ImGui.SetCursorPosX(right - statusButtonSize.X);
if (isPaired || !e.AcceptPairRequests)
if (isPaired)
{
ImGui.TextUnformatted(statusText);
_uiSharedService.IconText(FontAwesomeIcon.Check, ImGuiColors.ParsedGreen);
UiSharedService.AttachToolTip("Déjà apparié sur Umbra");
}
else if (!e.AcceptPairRequests)
{
_uiSharedService.IconText(FontAwesomeIcon.Ban, ImGuiColors.DalamudGrey3);
UiSharedService.AttachToolTip("Les demandes sont désactivées pour ce joueur");
}
else if (!string.IsNullOrEmpty(e.Token))
{
if (_uiSharedService.IconButton(FontAwesomeIcon.UserPlus))
{
_ = _autoDetectRequestService.SendRequestAsync(e.Token!);
}
UiSharedService.AttachToolTip("Envoyer une invitation Umbra");
}
else
{
if (_uiSharedService.IconTextButton(FontAwesomeIcon.UserPlus, "Invite", statusSize.X))
{
Mediator.Publish(new UiToggleMessage(typeof(AutoDetectUi)));
}
_uiSharedService.IconText(FontAwesomeIcon.QuestionCircle, ImGuiColors.DalamudGrey3);
UiSharedService.AttachToolTip("Impossible d'inviter ce joueur");
}
}
}

View File

@@ -16,6 +16,7 @@ namespace MareSynchronos.UI.Components;
public class DrawUserPair : DrawPairBase
{
private static readonly Vector4 Violet = new(0.63f, 0.25f, 1f, 1f);
protected readonly MareMediator _mediator;
private readonly SelectGroupForPairUi _selectGroupForPairUi;
private readonly CharaDataManager _charaDataManager;
@@ -39,12 +40,11 @@ public class DrawUserPair : DrawPairBase
protected override void DrawLeftSide(float textPosY, float originalY)
{
var online = _pair.IsOnline;
var violet = new Vector4(0.69f, 0.27f, 0.93f, 1f);
var offlineGrey = ImGuiColors.DalamudGrey3;
ImGui.SetCursorPosY(textPosY);
ImGui.PushFont(UiBuilder.IconFont);
UiSharedService.ColorText(FontAwesomeIcon.Moon.ToIconString(), online ? violet : offlineGrey);
UiSharedService.ColorText(FontAwesomeIcon.Moon.ToIconString(), online ? Violet : offlineGrey);
ImGui.PopFont();
UiSharedService.AttachToolTip(online
? "User is online"
@@ -72,7 +72,7 @@ public class DrawUserPair : DrawPairBase
ImGui.SameLine();
ImGui.SetCursorPosY(textPosY);
ImGui.PushFont(UiBuilder.IconFont);
UiSharedService.ColorText(FontAwesomeIcon.Eye.ToIconString(), ImGuiColors.ParsedGreen);
UiSharedService.ColorText(FontAwesomeIcon.Eye.ToIconString(), Violet);
if (ImGui.IsItemClicked())
{
_mediator.Publish(new TargetPairMessage(_pair));
@@ -301,4 +301,4 @@ public class DrawUserPair : DrawPairBase
}
UiSharedService.AttachToolTip("Hold CTRL and click to unpair permanently from " + entryUID);
}
}
}

View File

@@ -52,6 +52,7 @@ internal sealed class GroupPanel
private bool _showModalChangePassword;
private bool _showModalCreateGroup;
private bool _showModalEnterPassword;
private string _newSyncShellAlias = string.Empty;
private string _syncShellPassword = string.Empty;
private string _syncShellToJoin = string.Empty;
@@ -82,7 +83,7 @@ internal sealed class GroupPanel
{
var buttonSize = _uiShared.GetIconButtonSize(FontAwesomeIcon.Plus);
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonSize.X);
ImGui.InputTextWithHint("##syncshellid", "Syncshell GID/Alias (leave empty to create)", ref _syncShellToJoin, 20);
ImGui.InputTextWithHint("##syncshellid", "Syncshell GID/Alias (leave empty to create)", ref _syncShellToJoin, 50);
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - buttonSize.X);
bool userCanJoinMoreGroups = _pairManager.GroupPairs.Count < ApiController.ServerInfo.MaxGroupsJoinedByUser;
@@ -108,6 +109,7 @@ internal sealed class GroupPanel
{
_lastCreatedGroup = null;
_errorGroupCreate = false;
_newSyncShellAlias = string.Empty;
_showModalCreateGroup = true;
ImGui.OpenPopup("Create Syncshell");
}
@@ -150,13 +152,21 @@ internal sealed class GroupPanel
if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
{
UiSharedService.TextWrapped("Press the button below to create a new Syncshell.");
UiSharedService.TextWrapped("Donnez un nom à votre Syncshell (optionnel) puis créez-la. Le préfixe 'UMB-' reste inchangé.");
ImGui.SetNextItemWidth(-1);
ImGui.InputTextWithHint("##syncshellalias", "Nom du Syncshell", ref _newSyncShellAlias, 50);
UiSharedService.TextWrapped("Appuyez sur le bouton ci-dessous pour créer une nouvelle Syncshell.");
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
if (ImGui.Button("Create Syncshell"))
{
try
{
_lastCreatedGroup = ApiController.GroupCreate().Result;
var aliasInput = string.IsNullOrWhiteSpace(_newSyncShellAlias) ? null : _newSyncShellAlias.Trim();
_lastCreatedGroup = ApiController.GroupCreate(aliasInput).Result;
if (_lastCreatedGroup != null)
{
_newSyncShellAlias = string.Empty;
}
}
catch
{
@@ -169,6 +179,10 @@ internal sealed class GroupPanel
{
ImGui.Separator();
_errorGroupCreate = false;
if (!string.IsNullOrWhiteSpace(_lastCreatedGroup.Group.Alias))
{
ImGui.TextUnformatted("Syncshell Name: " + _lastCreatedGroup.Group.Alias);
}
ImGui.TextUnformatted("Syncshell ID: " + _lastCreatedGroup.Group.GID);
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted("Syncshell Password: " + _lastCreatedGroup.Password);
@@ -702,4 +716,4 @@ internal sealed class GroupPanel
}
ImGui.EndChild();
}
}
}