Translate phase 1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Numerics;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
@@ -12,6 +13,7 @@ using MareSynchronos.Services;
|
||||
using MareSynchronos.Services.Mediator;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
using MareSynchronos.WebAPI;
|
||||
using MareSynchronos.Localization;
|
||||
|
||||
namespace MareSynchronos.UI.Components;
|
||||
|
||||
@@ -22,6 +24,13 @@ public class DrawGroupPair : DrawPairBase
|
||||
private readonly GroupFullInfoDto _group;
|
||||
private readonly CharaDataManager _charaDataManager;
|
||||
|
||||
private static string L(string key, string fallback, params object[] args)
|
||||
{
|
||||
var safeArgs = args ?? Array.Empty<object>();
|
||||
return LocalizationService.Instance?.GetString(key, fallback, safeArgs)
|
||||
?? string.Format(System.Globalization.CultureInfo.CurrentCulture, fallback, safeArgs);
|
||||
}
|
||||
|
||||
public DrawGroupPair(string id, Pair entry, ApiController apiController,
|
||||
MareMediator mareMediator, GroupFullInfoDto group, GroupPairFullInfoDto fullInfoDto,
|
||||
UidDisplayHandler handler, UiSharedService uiSharedService, CharaDataManager charaDataManager)
|
||||
@@ -41,20 +50,20 @@ public class DrawGroupPair : DrawPairBase
|
||||
var entryIsPinned = _fullInfoDto.GroupPairStatusInfo.IsPinned();
|
||||
var presenceIcon = _pair.IsVisible ? FontAwesomeIcon.Eye : FontAwesomeIcon.CloudMoon;
|
||||
var presenceColor = (_pair.IsOnline || _pair.IsVisible) ? new Vector4(0.63f, 0.25f, 1f, 1f) : ImGuiColors.DalamudGrey;
|
||||
var presenceText = entryUID + " is offline";
|
||||
var presenceText = L("GroupPair.Presence.Offline", "{0} is offline", entryUID);
|
||||
|
||||
ImGui.SetCursorPosY(textPosY);
|
||||
bool drewPrefixIcon = false;
|
||||
|
||||
if (_pair.IsPaused)
|
||||
{
|
||||
presenceText = entryUID + " online status is unknown (paused)";
|
||||
presenceText = L("GroupPair.Presence.Paused", "{0} online status is unknown (paused)", entryUID);
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
UiSharedService.ColorText(FontAwesomeIcon.PauseCircle.ToIconString(), ImGuiColors.DalamudYellow);
|
||||
ImGui.PopFont();
|
||||
|
||||
UiSharedService.AttachToolTip("Pairing status with " + entryUID + " is paused");
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.Paused", "Pairing status with {0} is paused", entryUID));
|
||||
drewPrefixIcon = true;
|
||||
}
|
||||
else
|
||||
@@ -66,7 +75,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
UiSharedService.ColorText(FontAwesomeIcon.Moon.ToIconString(), violet);
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("You are individually paired with " + entryUID);
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.IndividuallyPaired", "You are individually paired with {0}", entryUID));
|
||||
drewPrefixIcon = true;
|
||||
}
|
||||
}
|
||||
@@ -78,8 +87,10 @@ public class DrawGroupPair : DrawPairBase
|
||||
UiSharedService.ColorText(presenceIcon.ToIconString(), presenceColor);
|
||||
ImGui.PopFont();
|
||||
|
||||
if (_pair.IsOnline && !_pair.IsVisible) presenceText = entryUID + " is online";
|
||||
else if (_pair.IsOnline && _pair.IsVisible) presenceText = entryUID + " is visible: " + _pair.PlayerName + Environment.NewLine + "Click to target this player";
|
||||
if (_pair.IsOnline && !_pair.IsVisible)
|
||||
presenceText = L("GroupPair.Presence.Online", "{0} is online", entryUID);
|
||||
else if (_pair.IsOnline && _pair.IsVisible)
|
||||
presenceText = L("GroupPair.Presence.Visible", "{0} is visible: {1}\nClick to target this player", entryUID, _pair.PlayerName);
|
||||
|
||||
if (_pair.IsVisible)
|
||||
{
|
||||
@@ -90,16 +101,19 @@ public class DrawGroupPair : DrawPairBase
|
||||
if (_pair.LastAppliedDataBytes >= 0)
|
||||
{
|
||||
presenceText += UiSharedService.TooltipSeparator;
|
||||
presenceText += ((!_pair.IsVisible) ? "(Last) " : string.Empty) + "Mods Info" + Environment.NewLine;
|
||||
presenceText += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
||||
presenceText += (!_pair.IsVisible ? L("GroupPair.Presence.LastPrefix", "(Last) ") : string.Empty)
|
||||
+ L("GroupPair.Presence.ModsInfo", "Mods Info") + Environment.NewLine;
|
||||
presenceText += L("GroupPair.Presence.FilesSize", "Files Size: {0}", UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true));
|
||||
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
||||
{
|
||||
presenceText += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
||||
presenceText += Environment.NewLine + L("GroupPair.Presence.Vram", "Approx. VRAM Usage: {0}", UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true));
|
||||
}
|
||||
if (_pair.LastAppliedDataTris >= 0)
|
||||
{
|
||||
presenceText += Environment.NewLine + "Triangle Count (excl. Vanilla): "
|
||||
+ (_pair.LastAppliedDataTris > 1000 ? (_pair.LastAppliedDataTris / 1000d).ToString("0.0'k'") : _pair.LastAppliedDataTris);
|
||||
var trisValue = _pair.LastAppliedDataTris > 1000
|
||||
? (_pair.LastAppliedDataTris / 1000d).ToString("0.0'k'", System.Globalization.CultureInfo.CurrentCulture)
|
||||
: _pair.LastAppliedDataTris.ToString(System.Globalization.CultureInfo.CurrentCulture);
|
||||
presenceText += Environment.NewLine + L("GroupPair.Presence.Tris", "Triangle Count (excl. Vanilla): {0}", trisValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +127,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString());
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("User is owner of this Syncshell");
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.Owner", "User is owner of this Syncshell"));
|
||||
}
|
||||
else if (entryIsMod)
|
||||
{
|
||||
@@ -122,7 +136,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.UserShield.ToIconString());
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("User is moderator of this Syncshell");
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.Moderator", "User is moderator of this Syncshell"));
|
||||
}
|
||||
else if (entryIsPinned)
|
||||
{
|
||||
@@ -131,7 +145,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.Thumbtack.ToIconString());
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("User is pinned in this Syncshell");
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.Pinned", "User is pinned in this Syncshell"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,9 +190,10 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Running);
|
||||
|
||||
UiSharedService.AttachToolTip($"This user has shared {sharedData!.Count} Character Data Sets with you." + UiSharedService.TooltipSeparator
|
||||
+ "Click to open the Character Data Hub and show the entries.");
|
||||
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Tooltip.SharedData", "This user has shared {0} Character Data Sets with you.", sharedData!.Count)
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("GroupPair.Tooltip.SharedData.OpenHub", "Click to open the Character Data Hub and show the entries."));
|
||||
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
_mediator.Publish(new OpenCharaDataHubWithFilterMessage(_pair.UserData));
|
||||
@@ -186,7 +201,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
if (individualAnimDisabled || individualSoundsDisabled)
|
||||
if (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled)
|
||||
{
|
||||
ImGui.SetCursorPosY(textPosY);
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
|
||||
@@ -196,46 +211,52 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
|
||||
ImGui.TextUnformatted("Individual User permissions");
|
||||
ImGui.TextUnformatted(L("GroupPair.Tooltip.IndividualHeader", "Individual User permissions"));
|
||||
|
||||
if (individualSoundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userSoundsText = L("GroupPair.Tooltip.SoundWith", "Sound sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.VolumeOff);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableSounds() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableSounds() ? "Disabled" : "Enabled"));
|
||||
ImGui.TextUnformatted(L("GroupPair.Tooltip.YouThey", "You: {0}, They: {1}",
|
||||
_pair.UserPair!.OwnPermissions.IsDisableSounds() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled"),
|
||||
_pair.UserPair!.OtherPermissions.IsDisableSounds() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled")));
|
||||
}
|
||||
|
||||
if (individualAnimDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userAnimText = L("GroupPair.Tooltip.AnimWith", "Animation sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Stop);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled"));
|
||||
ImGui.TextUnformatted(L("GroupPair.Tooltip.YouThey", "You: {0}, They: {1}",
|
||||
_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled"),
|
||||
_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled")));
|
||||
}
|
||||
|
||||
if (individualVFXDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userVFXText = L("GroupPair.Tooltip.VfxWith", "VFX sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Circle);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled"));
|
||||
ImGui.TextUnformatted(L("GroupPair.Tooltip.YouThey", "You: {0}, They: {1}",
|
||||
_pair.UserPair!.OwnPermissions.IsDisableVFX() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled"),
|
||||
_pair.UserPair!.OtherPermissions.IsDisableVFX() ? L("GroupPair.Toggle.Disabled", "Disabled") : L("GroupPair.Toggle.Enabled", "Enabled")));
|
||||
}
|
||||
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
}
|
||||
else if ((animDisabled || soundsDisabled))
|
||||
else if ((animDisabled || soundsDisabled || vfxDisabled))
|
||||
{
|
||||
ImGui.SetCursorPosY(textPosY);
|
||||
_uiSharedService.IconText(permIcon);
|
||||
@@ -243,11 +264,11 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
|
||||
ImGui.TextUnformatted("Syncshell User permissions");
|
||||
ImGui.TextUnformatted(L("GroupPair.Tooltip.SyncshellHeader", "Syncshell User permissions"));
|
||||
|
||||
if (soundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync disabled by " + _pair.UserData.AliasOrUID;
|
||||
var userSoundsText = L("GroupPair.Tooltip.SoundBy", "Sound sync disabled by {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.VolumeOff);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
@@ -255,7 +276,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
|
||||
if (animDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync disabled by " + _pair.UserData.AliasOrUID;
|
||||
var userAnimText = L("GroupPair.Tooltip.AnimBy", "Animation sync disabled by {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Stop);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
@@ -263,7 +284,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
|
||||
if (vfxDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync disabled by " + _pair.UserData.AliasOrUID;
|
||||
var userVFXText = L("GroupPair.Tooltip.VfxBy", "VFX sync disabled by {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Circle);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
@@ -282,7 +303,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
_ = _apiController.UserAddPair(new UserDto(new(_pair.UserData.UID)));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Pair with " + entryUID + " individually");
|
||||
UiSharedService.AttachToolTip(L("GroupPair.Popup.PairIndividually", "Pair with {0} individually", entryUID));
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
@@ -383,4 +404,4 @@ public class DrawGroupPair : DrawPairBase
|
||||
|
||||
return pos - spacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,15 @@ using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
using MareSynchronos.Localization;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
using MareSynchronos.Services;
|
||||
using MareSynchronos.Services.Mediator;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
using MareSynchronos.WebAPI;
|
||||
using System.Numerics;
|
||||
using System.Globalization;
|
||||
using System;
|
||||
|
||||
namespace MareSynchronos.UI.Components;
|
||||
|
||||
@@ -21,6 +24,13 @@ public class DrawUserPair : DrawPairBase
|
||||
private readonly SelectGroupForPairUi _selectGroupForPairUi;
|
||||
private readonly CharaDataManager _charaDataManager;
|
||||
|
||||
private static string L(string key, string fallback, params object[] args)
|
||||
{
|
||||
var safeArgs = args ?? Array.Empty<object>();
|
||||
return LocalizationService.Instance?.GetString(key, fallback, safeArgs)
|
||||
?? string.Format(CultureInfo.CurrentCulture, fallback, safeArgs);
|
||||
}
|
||||
|
||||
public DrawUserPair(string id, Pair entry, UidDisplayHandler displayHandler, ApiController apiController,
|
||||
MareMediator mareMediator, SelectGroupForPairUi selectGroupForPairUi,
|
||||
UiSharedService uiSharedService, CharaDataManager charaDataManager)
|
||||
@@ -47,8 +57,8 @@ public class DrawUserPair : DrawPairBase
|
||||
UiSharedService.ColorText(FontAwesomeIcon.Moon.ToIconString(), online ? Violet : offlineGrey);
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip(online
|
||||
? "User is online"
|
||||
: "User is offline");
|
||||
? L("UserPair.Status.Online", "User is online")
|
||||
: L("UserPair.Status.Offline", "User is offline"));
|
||||
if (!(_pair.UserPair!.OwnPermissions.IsPaired() && _pair.UserPair!.OtherPermissions.IsPaired()))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
@@ -56,7 +66,7 @@ public class DrawUserPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
UiSharedService.ColorText(FontAwesomeIcon.ArrowUp.ToIconString(), ImGuiColors.DalamudRed);
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip(_pair.UserData.AliasOrUID + " has not added you back");
|
||||
UiSharedService.AttachToolTip(L("UserPair.Tooltip.NotAddedBack", "{0} has not added you back", _pair.UserData.AliasOrUID));
|
||||
}
|
||||
else if (_pair.UserPair!.OwnPermissions.IsPaused() || _pair.UserPair!.OtherPermissions.IsPaused())
|
||||
{
|
||||
@@ -65,7 +75,7 @@ public class DrawUserPair : DrawPairBase
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
UiSharedService.ColorText(FontAwesomeIcon.PauseCircle.ToIconString(), ImGuiColors.DalamudYellow);
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("Pairing with " + _pair.UserData.AliasOrUID + " is paused");
|
||||
UiSharedService.AttachToolTip(L("UserPair.Tooltip.Paused", "Pairing with {0} is paused", _pair.UserData.AliasOrUID));
|
||||
}
|
||||
if (_pair is { IsOnline: true, IsVisible: true })
|
||||
{
|
||||
@@ -78,20 +88,23 @@ public class DrawUserPair : DrawPairBase
|
||||
_mediator.Publish(new TargetPairMessage(_pair));
|
||||
}
|
||||
ImGui.PopFont();
|
||||
var visibleTooltip = _pair.UserData.AliasOrUID + " is visible: " + _pair.PlayerName! + Environment.NewLine + "Click to target this player";
|
||||
var visibleTooltip = L("UserPair.Tooltip.Visible", "{0} is visible: {1}\nClick to target this player", _pair.UserData.AliasOrUID, _pair.PlayerName!);
|
||||
if (_pair.LastAppliedDataBytes >= 0)
|
||||
{
|
||||
visibleTooltip += UiSharedService.TooltipSeparator;
|
||||
visibleTooltip += ((!_pair.IsVisible) ? "(Last) " : string.Empty) + "Mods Info" + Environment.NewLine;
|
||||
visibleTooltip += "Files Size: " + UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true);
|
||||
visibleTooltip += (!_pair.IsVisible ? L("UserPair.Tooltip.Visible.LastPrefix", "(Last) ") : string.Empty)
|
||||
+ L("UserPair.Tooltip.Visible.ModsInfo", "Mods Info") + Environment.NewLine;
|
||||
visibleTooltip += L("UserPair.Tooltip.Visible.FilesSize", "Files Size: {0}", UiSharedService.ByteToString(_pair.LastAppliedDataBytes, true));
|
||||
if (_pair.LastAppliedApproximateVRAMBytes >= 0)
|
||||
{
|
||||
visibleTooltip += Environment.NewLine + "Approx. VRAM Usage: " + UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true);
|
||||
visibleTooltip += Environment.NewLine + L("UserPair.Tooltip.Visible.Vram", "Approx. VRAM Usage: {0}", UiSharedService.ByteToString(_pair.LastAppliedApproximateVRAMBytes, true));
|
||||
}
|
||||
if (_pair.LastAppliedDataTris >= 0)
|
||||
{
|
||||
visibleTooltip += Environment.NewLine + "Triangle Count (excl. Vanilla): "
|
||||
+ (_pair.LastAppliedDataTris > 1000 ? (_pair.LastAppliedDataTris / 1000d).ToString("0.0'k'") : _pair.LastAppliedDataTris);
|
||||
var trisValue = _pair.LastAppliedDataTris > 1000
|
||||
? (_pair.LastAppliedDataTris / 1000d).ToString("0.0'k'", CultureInfo.CurrentCulture)
|
||||
: _pair.LastAppliedDataTris.ToString(CultureInfo.CurrentCulture);
|
||||
visibleTooltip += Environment.NewLine + L("UserPair.Tooltip.Visible.Tris", "Triangle Count (excl. Vanilla): {0}", trisValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +149,8 @@ public class DrawUserPair : DrawPairBase
|
||||
_ = _apiController.UserSetPairPermissions(new(_pair.UserData, perm));
|
||||
}
|
||||
UiSharedService.AttachToolTip(!_pair.UserPair!.OwnPermissions.IsPaused()
|
||||
? "Pause pairing with " + entryUID
|
||||
: "Resume pairing with " + entryUID);
|
||||
? L("UserPair.Tooltip.Pause", "Pause pairing with {0}", entryUID)
|
||||
: L("UserPair.Tooltip.Resume", "Resume pairing with {0}", entryUID));
|
||||
|
||||
|
||||
var individualSoundsDisabled = (_pair.UserPair?.OwnPermissions.IsDisableSounds() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableSounds() ?? false);
|
||||
@@ -158,39 +171,57 @@ public class DrawUserPair : DrawPairBase
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
|
||||
ImGui.TextUnformatted("Individual User permissions");
|
||||
ImGui.TextUnformatted(L("UserPair.Tooltip.Permission.Header", "Individual user permissions"));
|
||||
|
||||
if (individualSoundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userSoundsText = L("UserPair.Tooltip.Permission.Sound", "Sound sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.VolumeOff);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableSounds() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableSounds() ? "Disabled" : "Enabled"));
|
||||
var youStatus = _pair.UserPair!.OwnPermissions.IsDisableSounds()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
var theyStatus = _pair.UserPair!.OtherPermissions.IsDisableSounds()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
ImGui.TextUnformatted(L("UserPair.Tooltip.Permission.Status", "You: {0}, They: {1}", youStatus, theyStatus));
|
||||
}
|
||||
|
||||
if (individualAnimDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userAnimText = L("UserPair.Tooltip.Permission.Animation", "Animation sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Stop);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled"));
|
||||
var youStatus = _pair.UserPair!.OwnPermissions.IsDisableAnimations()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
var theyStatus = _pair.UserPair!.OtherPermissions.IsDisableAnimations()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
ImGui.TextUnformatted(L("UserPair.Tooltip.Permission.Status", "You: {0}, They: {1}", youStatus, theyStatus));
|
||||
}
|
||||
|
||||
if (individualVFXDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID;
|
||||
var userVFXText = L("UserPair.Tooltip.Permission.Vfx", "VFX sync disabled with {0}", _pair.UserData.AliasOrUID);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Circle);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
ImGui.NewLine();
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled"));
|
||||
var youStatus = _pair.UserPair!.OwnPermissions.IsDisableVFX()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
var theyStatus = _pair.UserPair!.OtherPermissions.IsDisableVFX()
|
||||
? L("UserPair.Tooltip.Permission.State.Disabled", "Disabled")
|
||||
: L("UserPair.Tooltip.Permission.State.Enabled", "Enabled");
|
||||
ImGui.TextUnformatted(L("UserPair.Tooltip.Permission.Status", "You: {0}, They: {1}", youStatus, theyStatus));
|
||||
}
|
||||
|
||||
ImGui.EndTooltip();
|
||||
@@ -205,8 +236,9 @@ public class DrawUserPair : DrawPairBase
|
||||
ImGui.SameLine(rightSidePos);
|
||||
_uiSharedService.IconText(icon);
|
||||
|
||||
UiSharedService.AttachToolTip($"This user has shared {sharedData.Count} Character Data Sets with you." + UiSharedService.TooltipSeparator
|
||||
+ "Click to open the Character Data Hub and show the entries.");
|
||||
UiSharedService.AttachToolTip(L("UserPair.Tooltip.SharedData", "This user has shared {0} Character Data Sets with you.", sharedData.Count)
|
||||
+ UiSharedService.TooltipSeparator
|
||||
+ L("UserPair.Tooltip.SharedData.OpenHub", "Click to open the Character Data Hub and show the entries."));
|
||||
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
@@ -221,7 +253,7 @@ public class DrawUserPair : DrawPairBase
|
||||
{
|
||||
if (entry.IsVisible)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Eye, "Target player"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Eye, L("UserPair.Menu.Target", "Target player")))
|
||||
{
|
||||
_mediator.Publish(new TargetPairMessage(entry));
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -229,44 +261,46 @@ public class DrawUserPair : DrawPairBase
|
||||
}
|
||||
if (!entry.IsPaused)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.User, "Open Profile"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.User, L("UserPair.Menu.OpenProfile", "Open Profile")))
|
||||
{
|
||||
_displayHandler.OpenProfile(entry);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
UiSharedService.AttachToolTip("Opens the profile for this user in a new window");
|
||||
UiSharedService.AttachToolTip(L("UserPair.Menu.OpenProfile.Tooltip", "Opens the profile for this user in a new window"));
|
||||
}
|
||||
if (entry.IsVisible)
|
||||
{
|
||||
#if DEBUG
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Open Analysis"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PersonCircleQuestion, L("UserPair.Menu.OpenAnalysis", "Open Analysis")))
|
||||
{
|
||||
_displayHandler.OpenAnalysis(_pair);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
#endif
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Sync, "Reload last data"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Sync, L("UserPair.Menu.ReloadData", "Reload last data")))
|
||||
{
|
||||
entry.ApplyLastReceivedData(forced: true);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
UiSharedService.AttachToolTip("This reapplies the last received character data to this character");
|
||||
UiSharedService.AttachToolTip(L("UserPair.Menu.ReloadData.Tooltip", "This reapplies the last received character data to this character"));
|
||||
}
|
||||
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Cycle pause state"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, L("UserPair.Menu.CyclePause", "Cycle pause state")))
|
||||
{
|
||||
_ = _apiController.CyclePause(entry.UserData);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
var entryUID = entry.UserData.AliasOrUID;
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Folder, "Pair Groups"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Folder, L("UserPair.Menu.PairGroups", "Pair Groups")))
|
||||
{
|
||||
_selectGroupForPairUi.Open(entry);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Choose pair groups for " + entryUID);
|
||||
UiSharedService.AttachToolTip(L("UserPair.Menu.PairGroups.Tooltip", "Choose pair groups for {0}", entryUID));
|
||||
|
||||
var isDisableSounds = entry.UserPair!.OwnPermissions.IsDisableSounds();
|
||||
string disableSoundsText = isDisableSounds ? "Enable sound sync" : "Disable sound sync";
|
||||
string disableSoundsText = isDisableSounds
|
||||
? L("UserPair.Menu.EnableSoundSync", "Enable sound sync")
|
||||
: L("UserPair.Menu.DisableSoundSync", "Disable sound sync");
|
||||
var disableSoundsIcon = isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute;
|
||||
if (_uiSharedService.IconTextButton(disableSoundsIcon, disableSoundsText))
|
||||
{
|
||||
@@ -276,7 +310,9 @@ public class DrawUserPair : DrawPairBase
|
||||
}
|
||||
|
||||
var isDisableAnims = entry.UserPair!.OwnPermissions.IsDisableAnimations();
|
||||
string disableAnimsText = isDisableAnims ? "Enable animation sync" : "Disable animation sync";
|
||||
string disableAnimsText = isDisableAnims
|
||||
? L("UserPair.Menu.EnableAnimationSync", "Enable animation sync")
|
||||
: L("UserPair.Menu.DisableAnimationSync", "Disable animation sync");
|
||||
var disableAnimsIcon = isDisableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop;
|
||||
if (_uiSharedService.IconTextButton(disableAnimsIcon, disableAnimsText))
|
||||
{
|
||||
@@ -286,7 +322,9 @@ public class DrawUserPair : DrawPairBase
|
||||
}
|
||||
|
||||
var isDisableVFX = entry.UserPair!.OwnPermissions.IsDisableVFX();
|
||||
string disableVFXText = isDisableVFX ? "Enable VFX sync" : "Disable VFX sync";
|
||||
string disableVFXText = isDisableVFX
|
||||
? L("UserPair.Menu.EnableVfxSync", "Enable VFX sync")
|
||||
: L("UserPair.Menu.DisableVfxSync", "Disable VFX sync");
|
||||
var disableVFXIcon = isDisableVFX ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle;
|
||||
if (_uiSharedService.IconTextButton(disableVFXIcon, disableVFXText))
|
||||
{
|
||||
@@ -295,10 +333,10 @@ public class DrawUserPair : DrawPairBase
|
||||
_ = _apiController.UserSetPairPermissions(new UserPermissionsDto(entry.UserData, permissions));
|
||||
}
|
||||
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently") && UiSharedService.CtrlPressed())
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, L("UserPair.Menu.Unpair", "Unpair Permanently")) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.UserRemovePair(new(entry.UserData));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold CTRL and click to unpair permanently from " + entryUID);
|
||||
UiSharedService.AttachToolTip(L("UserPair.Menu.Unpair.Tooltip", "Hold CTRL and click to unpair permanently from {0}", entryUID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ using MareSynchronos.Services.ServerConfiguration;
|
||||
using MareSynchronos.UI.Components;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
using MareSynchronos.WebAPI;
|
||||
using MareSynchronos.Localization;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -40,6 +42,7 @@ internal sealed class GroupPanel
|
||||
private string _editGroupComment = string.Empty;
|
||||
private string _editGroupEntry = string.Empty;
|
||||
private bool _errorGroupCreate = false;
|
||||
private string _errorGroupCreateMessage = string.Empty;
|
||||
private bool _errorGroupJoin;
|
||||
private bool _isPasswordValid;
|
||||
private GroupPasswordDto? _lastCreatedGroup = null;
|
||||
@@ -53,9 +56,30 @@ internal sealed class GroupPanel
|
||||
private bool _showModalCreateGroup;
|
||||
private bool _showModalEnterPassword;
|
||||
private string _newSyncShellAlias = string.Empty;
|
||||
private bool _createIsTemporary = false;
|
||||
private int _tempSyncshellDurationHours = 24;
|
||||
private readonly int[] _temporaryDurationOptions = new[]
|
||||
{
|
||||
1,
|
||||
12,
|
||||
24,
|
||||
48,
|
||||
72,
|
||||
96,
|
||||
120,
|
||||
144,
|
||||
168
|
||||
};
|
||||
private string _syncShellPassword = string.Empty;
|
||||
private string _syncShellToJoin = string.Empty;
|
||||
|
||||
private static string L(string key, string fallback, params object[] args)
|
||||
{
|
||||
var safeArgs = args ?? Array.Empty<object>();
|
||||
return LocalizationService.Instance?.GetString(key, fallback, safeArgs)
|
||||
?? string.Format(CultureInfo.CurrentCulture, fallback, safeArgs);
|
||||
}
|
||||
|
||||
public GroupPanel(CompactUi mainUi, UiSharedService uiShared, PairManager pairManager, ChatService chatServivce,
|
||||
UidDisplayHandler uidDisplayHandler, MareConfigService mareConfig, ServerConfigurationManager serverConfigurationManager,
|
||||
CharaDataManager charaDataManager)
|
||||
@@ -83,13 +107,15 @@ 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, 50);
|
||||
ImGui.InputTextWithHint("##syncshellid", L("GroupPanel.Join.InputHint", "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;
|
||||
bool userCanCreateMoreGroups = _pairManager.GroupPairs.Count(u => string.Equals(u.Key.Owner.UID, ApiController.UID, StringComparison.Ordinal)) < ApiController.ServerInfo.MaxGroupsCreatedByUser;
|
||||
bool alreadyInGroup = _pairManager.GroupPairs.Select(p => p.Key).Any(p => string.Equals(p.Group.Alias, _syncShellToJoin, StringComparison.Ordinal)
|
||||
|| string.Equals(p.Group.GID, _syncShellToJoin, StringComparison.Ordinal));
|
||||
var enterPasswordPopupTitle = L("GroupPanel.Join.PasswordPopup", "Enter Syncshell Password");
|
||||
var createPopupTitle = L("GroupPanel.Create.PopupTitle", "Create Syncshell");
|
||||
|
||||
if (alreadyInGroup) ImGui.BeginDisabled();
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Plus))
|
||||
@@ -100,7 +126,7 @@ internal sealed class GroupPanel
|
||||
{
|
||||
_errorGroupJoin = false;
|
||||
_showModalEnterPassword = true;
|
||||
ImGui.OpenPopup("Enter Syncshell Password");
|
||||
ImGui.OpenPopup(enterPasswordPopupTitle);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -110,31 +136,41 @@ internal sealed class GroupPanel
|
||||
_lastCreatedGroup = null;
|
||||
_errorGroupCreate = false;
|
||||
_newSyncShellAlias = string.Empty;
|
||||
_createIsTemporary = false;
|
||||
_tempSyncshellDurationHours = 24;
|
||||
_errorGroupCreateMessage = string.Empty;
|
||||
_showModalCreateGroup = true;
|
||||
ImGui.OpenPopup("Create Syncshell");
|
||||
ImGui.OpenPopup(createPopupTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
UiSharedService.AttachToolTip(_syncShellToJoin.IsNullOrEmpty()
|
||||
? (userCanCreateMoreGroups ? "Create Syncshell" : $"You cannot create more than {ApiController.ServerInfo.MaxGroupsCreatedByUser} Syncshells")
|
||||
: (userCanJoinMoreGroups ? "Join Syncshell" + _syncShellToJoin : $"You cannot join more than {ApiController.ServerInfo.MaxGroupsJoinedByUser} Syncshells"));
|
||||
? (userCanCreateMoreGroups
|
||||
? L("GroupPanel.Create.Tooltip", "Create Syncshell")
|
||||
: L("GroupPanel.Create.TooMany", "You cannot create more than {0} Syncshells", ApiController.ServerInfo.MaxGroupsCreatedByUser))
|
||||
: (userCanJoinMoreGroups
|
||||
? L("GroupPanel.Join.Tooltip", "Join Syncshell {0}", _syncShellToJoin)
|
||||
: L("GroupPanel.Join.TooMany", "You cannot join more than {0} Syncshells", ApiController.ServerInfo.MaxGroupsJoinedByUser)));
|
||||
|
||||
if (alreadyInGroup) ImGui.EndDisabled();
|
||||
|
||||
if (ImGui.BeginPopupModal("Enter Syncshell Password", ref _showModalEnterPassword, UiSharedService.PopupWindowFlags))
|
||||
if (ImGui.BeginPopupModal(enterPasswordPopupTitle, ref _showModalEnterPassword, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
UiSharedService.TextWrapped("Before joining any Syncshells please be aware that you will be automatically paired with everyone in the Syncshell.");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Join.Warning", "Before joining any Syncshells please be aware that you will be automatically paired with everyone in the Syncshell."));
|
||||
ImGui.Separator();
|
||||
UiSharedService.TextWrapped("Enter the password for Syncshell " + _syncShellToJoin + ":");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Join.EnterPassword", "Enter the password for Syncshell {0}:", _syncShellToJoin));
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
ImGui.InputTextWithHint("##password", _syncShellToJoin + " Password", ref _syncShellPassword, 255, ImGuiInputTextFlags.Password);
|
||||
ImGui.InputTextWithHint("##password", L("GroupPanel.Join.PasswordHint", "{0} Password", _syncShellToJoin), ref _syncShellPassword, 255, ImGuiInputTextFlags.Password);
|
||||
if (_errorGroupJoin)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped($"An error occured during joining of this Syncshell: you either have joined the maximum amount of Syncshells ({ApiController.ServerInfo.MaxGroupsJoinedByUser}), " +
|
||||
$"it does not exist, the password you entered is wrong, you already joined the Syncshell, the Syncshell is full ({ApiController.ServerInfo.MaxGroupUserCount} users) or the Syncshell has closed invites.",
|
||||
UiSharedService.ColorTextWrapped(
|
||||
L("GroupPanel.Join.Error",
|
||||
"An error occured during joining of this Syncshell: you either have joined the maximum amount of Syncshells ({0}), it does not exist, the password you entered is wrong, you already joined the Syncshell, the Syncshell is full ({1} users) or the Syncshell has closed invites.",
|
||||
ApiController.ServerInfo.MaxGroupsJoinedByUser,
|
||||
ApiController.ServerInfo.MaxGroupUserCount),
|
||||
new Vector4(1, 0, 0, 1));
|
||||
}
|
||||
if (ImGui.Button("Join " + _syncShellToJoin))
|
||||
if (ImGui.Button(L("GroupPanel.Join.Button", "Join {0}", _syncShellToJoin)))
|
||||
{
|
||||
var shell = _syncShellToJoin;
|
||||
var pw = _syncShellPassword;
|
||||
@@ -150,28 +186,100 @@ internal sealed class GroupPanel
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopupModal("Create Syncshell", ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
|
||||
if (ImGui.BeginPopupModal(createPopupTitle, ref _showModalCreateGroup, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
UiSharedService.TextWrapped("Donnez un nom à votre Syncshell (optionnel) puis créez-la.");
|
||||
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.");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.ChooseType", "Choisissez le type de Syncshell à créer."));
|
||||
bool showPermanent = !_createIsTemporary;
|
||||
if (ImGui.RadioButton(L("GroupPanel.Create.Permanent", "Permanente"), showPermanent))
|
||||
{
|
||||
_createIsTemporary = false;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
if (ImGui.RadioButton(L("GroupPanel.Create.Temporary", "Temporaire"), _createIsTemporary))
|
||||
{
|
||||
_createIsTemporary = true;
|
||||
_newSyncShellAlias = string.Empty;
|
||||
}
|
||||
|
||||
if (!_createIsTemporary)
|
||||
{
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.AliasPrompt", "Donnez un nom à votre Syncshell (optionnel) puis créez-la."));
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
ImGui.InputTextWithHint("##syncshellalias", L("GroupPanel.Create.AliasHint", "Nom du Syncshell"), ref _newSyncShellAlias, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
_newSyncShellAlias = string.Empty;
|
||||
}
|
||||
|
||||
if (_createIsTemporary)
|
||||
{
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.TempMaxDuration", "Durée maximale d'une Syncshell temporaire : 7 jours."));
|
||||
if (_tempSyncshellDurationHours > 168) _tempSyncshellDurationHours = 168;
|
||||
for (int i = 0; i < _temporaryDurationOptions.Length; i++)
|
||||
{
|
||||
var option = _temporaryDurationOptions[i];
|
||||
var isSelected = _tempSyncshellDurationHours == option;
|
||||
string label = option switch
|
||||
{
|
||||
>= 24 when option % 24 == 0 => option == 24
|
||||
? L("GroupPanel.Create.Duration.SingleDay", "24h")
|
||||
: L("GroupPanel.Create.Duration.Days", "{0}j", option / 24),
|
||||
_ => L("GroupPanel.Create.Duration.Hours", "{0}h", option)
|
||||
};
|
||||
|
||||
if (ImGui.RadioButton(label, isSelected))
|
||||
{
|
||||
_tempSyncshellDurationHours = option;
|
||||
}
|
||||
|
||||
if ((i + 1) % 3 == 0)
|
||||
{
|
||||
ImGui.NewLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.SameLine();
|
||||
}
|
||||
}
|
||||
|
||||
var expiresLocal = DateTime.Now.AddHours(_tempSyncshellDurationHours);
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.TempExpires", "Expiration le {0:g} (heure locale).", expiresLocal));
|
||||
}
|
||||
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.Instruction", "Appuyez sur le bouton ci-dessous pour créer une nouvelle Syncshell."));
|
||||
ImGui.SetNextItemWidth(200 * ImGuiHelpers.GlobalScale);
|
||||
if (ImGui.Button("Create Syncshell"))
|
||||
if (ImGui.Button(L("GroupPanel.Create.Button", "Create Syncshell")))
|
||||
{
|
||||
try
|
||||
{
|
||||
var aliasInput = string.IsNullOrWhiteSpace(_newSyncShellAlias) ? null : _newSyncShellAlias.Trim();
|
||||
_lastCreatedGroup = ApiController.GroupCreate(aliasInput).Result;
|
||||
if (_lastCreatedGroup != null)
|
||||
if (_createIsTemporary)
|
||||
{
|
||||
_newSyncShellAlias = string.Empty;
|
||||
var expiresAtUtc = DateTime.UtcNow.AddHours(_tempSyncshellDurationHours);
|
||||
_lastCreatedGroup = ApiController.GroupCreateTemporary(expiresAtUtc).Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
var aliasInput = string.IsNullOrWhiteSpace(_newSyncShellAlias) ? null : _newSyncShellAlias.Trim();
|
||||
_lastCreatedGroup = ApiController.GroupCreate(aliasInput).Result;
|
||||
if (_lastCreatedGroup != null)
|
||||
{
|
||||
_newSyncShellAlias = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
_lastCreatedGroup = null;
|
||||
_errorGroupCreate = true;
|
||||
if (ex.Message.Contains("name is already in use", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_errorGroupCreateMessage = L("GroupPanel.Create.Error.NameInUse", "Le nom de la Syncshell est déjà utilisé.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorGroupCreateMessage = ex.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,25 +287,33 @@ internal sealed class GroupPanel
|
||||
{
|
||||
ImGui.Separator();
|
||||
_errorGroupCreate = false;
|
||||
_errorGroupCreateMessage = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(_lastCreatedGroup.Group.Alias))
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell Name: " + _lastCreatedGroup.Group.Alias);
|
||||
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Name", "Syncshell Name: {0}", _lastCreatedGroup.Group.Alias));
|
||||
}
|
||||
ImGui.TextUnformatted("Syncshell ID: " + _lastCreatedGroup.Group.GID);
|
||||
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Id", "Syncshell ID: {0}", _lastCreatedGroup.Group.GID));
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Syncshell Password: " + _lastCreatedGroup.Password);
|
||||
ImGui.TextUnformatted(L("GroupPanel.Create.Result.Password", "Syncshell Password: {0}", _lastCreatedGroup.Password));
|
||||
ImGui.SameLine();
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Copy))
|
||||
{
|
||||
ImGui.SetClipboardText(_lastCreatedGroup.Password);
|
||||
}
|
||||
UiSharedService.TextWrapped("You can change the Syncshell password later at any time.");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.Result.ChangeLater", "You can change the Syncshell password later at any time."));
|
||||
if (_lastCreatedGroup.IsTemporary && _lastCreatedGroup.ExpiresAt != null)
|
||||
{
|
||||
var expiresLocal = _lastCreatedGroup.ExpiresAt.Value.ToLocalTime();
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Create.Result.TempExpires", "Cette Syncshell expirera le {0:g} (heure locale).", expiresLocal));
|
||||
}
|
||||
}
|
||||
|
||||
if (_errorGroupCreate)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells.",
|
||||
new Vector4(1, 0, 0, 1));
|
||||
var msg = string.IsNullOrWhiteSpace(_errorGroupCreateMessage)
|
||||
? L("GroupPanel.Create.Error.Generic", "You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells.")
|
||||
: _errorGroupCreateMessage;
|
||||
UiSharedService.ColorTextWrapped(msg, new Vector4(1, 0, 0, 1));
|
||||
}
|
||||
|
||||
UiSharedService.SetScaledWindowSize(350);
|
||||
@@ -234,7 +350,7 @@ internal sealed class GroupPanel
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString());
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("You are the owner of Syncshell " + groupName);
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.OwnerTooltip", "You are the owner of Syncshell {0}", groupName));
|
||||
ImGui.SameLine();
|
||||
}
|
||||
else if (groupDto.GroupUserInfo.IsModerator())
|
||||
@@ -242,7 +358,7 @@ internal sealed class GroupPanel
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.UserShield.ToIconString());
|
||||
ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("You are a moderator of Syncshell " + groupName);
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.ModeratorTooltip", "You are a moderator of Syncshell {0}", groupName));
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
@@ -257,18 +373,38 @@ internal sealed class GroupPanel
|
||||
if (!string.Equals(_editGroupEntry, groupDto.GID, StringComparison.Ordinal))
|
||||
{
|
||||
var shellConfig = _serverConfigurationManager.GetShellConfigForGid(groupDto.GID);
|
||||
if (!_mareConfig.Current.DisableSyncshellChat && shellConfig.Enabled)
|
||||
{
|
||||
ImGui.TextUnformatted($"[{shellNumber}]");
|
||||
UiSharedService.AttachToolTip("Chat command prefix: /ss" + shellNumber);
|
||||
}
|
||||
var totalMembers = pairsInGroup.Count + 1;
|
||||
var connectedMembers = pairsInGroup.Count(p => p.IsOnline) + 1;
|
||||
var maxCapacity = ApiController.ServerInfo.MaxGroupUserCount;
|
||||
ImGui.TextUnformatted(L("GroupPanel.Syncshell.MemberCount", "{0}/{1}", connectedMembers, totalMembers));
|
||||
UiSharedService.AttachToolTip(
|
||||
L("GroupPanel.Syncshell.MemberCountTooltip",
|
||||
"Membres connectés / membres totaux\nCapacité maximale : {0}\nSyncshell ID: {1}",
|
||||
maxCapacity,
|
||||
groupDto.Group.GID));
|
||||
if (textIsGid) ImGui.PushFont(UiBuilder.MonoFont);
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(groupName);
|
||||
if (textIsGid) ImGui.PopFont();
|
||||
UiSharedService.AttachToolTip("Left click to switch between GID display and comment" + Environment.NewLine +
|
||||
"Right click to change comment for " + groupName + Environment.NewLine + Environment.NewLine
|
||||
+ "Users: " + (pairsInGroup.Count + 1) + ", Owner: " + groupDto.OwnerAliasOrUID);
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.NameTooltip",
|
||||
"Left click to switch between GID display and comment\nRight click to change comment for {0}\n\nUsers: {1}, Owner: {2}",
|
||||
groupName,
|
||||
pairsInGroup.Count + 1,
|
||||
groupDto.OwnerAliasOrUID));
|
||||
if (groupDto.IsTemporary)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
UiSharedService.ColorText(L("GroupPanel.Syncshell.TempTag", "(Temp)"), ImGuiColors.DalamudOrange);
|
||||
if (groupDto.ExpiresAt != null)
|
||||
{
|
||||
var tempExpireLocal = groupDto.ExpiresAt.Value.ToLocalTime();
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.TempExpires", "Expire le {0:g}", tempExpireLocal));
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Syncshell.TempTooltip", "Syncshell temporaire"));
|
||||
}
|
||||
}
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
|
||||
{
|
||||
var prevState = textIsGid;
|
||||
@@ -292,7 +428,7 @@ internal sealed class GroupPanel
|
||||
{
|
||||
var buttonSizes = _uiShared.GetIconButtonSize(FontAwesomeIcon.Bars).X + _uiShared.GetIconButtonSize(FontAwesomeIcon.LockOpen).X;
|
||||
ImGui.SetNextItemWidth(UiSharedService.GetWindowContentRegionWidth() - ImGui.GetCursorPosX() - buttonSizes - ImGui.GetStyle().ItemSpacing.X * 2);
|
||||
if (ImGui.InputTextWithHint("", "Comment/Notes", ref _editGroupComment, 255, ImGuiInputTextFlags.EnterReturnsTrue))
|
||||
if (ImGui.InputTextWithHint("", L("GroupPanel.CommentHint", "Comment/Notes"), ref _editGroupComment, 255, ImGuiInputTextFlags.EnterReturnsTrue))
|
||||
{
|
||||
_serverConfigurationManager.SetNoteForGid(groupDto.GID, _editGroupComment);
|
||||
_editGroupEntry = string.Empty;
|
||||
@@ -303,7 +439,7 @@ internal sealed class GroupPanel
|
||||
{
|
||||
_editGroupEntry = string.Empty;
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hit ENTER to save\nRight click to cancel");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.CommentTooltip", "Hit ENTER to save\nRight click to cancel"));
|
||||
}
|
||||
|
||||
|
||||
@@ -312,26 +448,26 @@ internal sealed class GroupPanel
|
||||
if (_showModalBanList && !_modalBanListOpened)
|
||||
{
|
||||
_modalBanListOpened = true;
|
||||
ImGui.OpenPopup("Manage Banlist for " + groupDto.GID);
|
||||
ImGui.OpenPopup(L("GroupPanel.Banlist.Title", "Manage Banlist for {0}", groupDto.GID));
|
||||
}
|
||||
|
||||
if (!_showModalBanList) _modalBanListOpened = false;
|
||||
|
||||
if (ImGui.BeginPopupModal("Manage Banlist for " + groupDto.GID, ref _showModalBanList, UiSharedService.PopupWindowFlags))
|
||||
if (ImGui.BeginPopupModal(L("GroupPanel.Banlist.Title", "Manage Banlist for {0}", groupDto.GID), ref _showModalBanList, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Retweet, L("GroupPanel.Banlist.Refresh", "Refresh Banlist from Server")))
|
||||
{
|
||||
_bannedUsers = ApiController.GroupGetBannedUsers(groupDto).Result;
|
||||
}
|
||||
|
||||
if (ImGui.BeginTable("bannedusertable" + groupDto.GID, 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY))
|
||||
{
|
||||
ImGui.TableSetupColumn("UID", ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn("Alias", ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn("By", ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn("Date", ImGuiTableColumnFlags.None, 2);
|
||||
ImGui.TableSetupColumn("Reason", ImGuiTableColumnFlags.None, 3);
|
||||
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Uid", "UID"), ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Alias", "Alias"), ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.By", "By"), ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Date", "Date"), ImGuiTableColumnFlags.None, 2);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Reason", "Reason"), ImGuiTableColumnFlags.None, 3);
|
||||
ImGui.TableSetupColumn(L("GroupPanel.Banlist.Column.Actions", "Actions"), ImGuiTableColumnFlags.None, 1);
|
||||
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
@@ -348,7 +484,7 @@ internal sealed class GroupPanel
|
||||
ImGui.TableNextColumn();
|
||||
UiSharedService.TextWrapped(bannedUser.Reason);
|
||||
ImGui.TableNextColumn();
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Check, "Unban#" + bannedUser.UID))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Check, L("GroupPanel.Banlist.Unban", "Unban") + "#" + bannedUser.UID))
|
||||
{
|
||||
_ = ApiController.GroupUnbanUser(bannedUser);
|
||||
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
|
||||
@@ -364,18 +500,18 @@ internal sealed class GroupPanel
|
||||
if (_showModalChangePassword && !_modalChangePwOpened)
|
||||
{
|
||||
_modalChangePwOpened = true;
|
||||
ImGui.OpenPopup("Change Syncshell Password");
|
||||
ImGui.OpenPopup(L("GroupPanel.Password.Title", "Change Syncshell Password"));
|
||||
}
|
||||
|
||||
if (!_showModalChangePassword) _modalChangePwOpened = false;
|
||||
|
||||
if (ImGui.BeginPopupModal("Change Syncshell Password", ref _showModalChangePassword, UiSharedService.PopupWindowFlags))
|
||||
if (ImGui.BeginPopupModal(L("GroupPanel.Password.Title", "Change Syncshell Password"), ref _showModalChangePassword, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
UiSharedService.TextWrapped("Enter the new Syncshell password for Syncshell " + name + " here.");
|
||||
UiSharedService.TextWrapped("This action is irreversible");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Password.Description", "Enter the new Syncshell password for Syncshell {0} here.", name));
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Password.Warning", "This action is irreversible"));
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
ImGui.InputTextWithHint("##changepw", "New password for " + name, ref _newSyncShellPassword, 255);
|
||||
if (ImGui.Button("Change password"))
|
||||
ImGui.InputTextWithHint("##changepw", L("GroupPanel.Password.Hint", "New password for {0}", name), ref _newSyncShellPassword, 255);
|
||||
if (ImGui.Button(L("GroupPanel.Password.Button", "Change password")))
|
||||
{
|
||||
var pw = _newSyncShellPassword;
|
||||
_isPasswordValid = ApiController.GroupChangePassword(new(groupDto.Group, pw)).Result;
|
||||
@@ -385,7 +521,7 @@ internal sealed class GroupPanel
|
||||
|
||||
if (!_isPasswordValid)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("The selected password is too short. It must be at least 10 characters.", new Vector4(1, 0, 0, 1));
|
||||
UiSharedService.ColorTextWrapped(L("GroupPanel.Password.Error.TooShort", "The selected password is too short. It must be at least 10 characters."), new Vector4(1, 0, 0, 1));
|
||||
}
|
||||
|
||||
UiSharedService.SetScaledWindowSize(290);
|
||||
@@ -395,29 +531,28 @@ internal sealed class GroupPanel
|
||||
if (_showModalBulkOneTimeInvites && !_modalBulkOneTimeInvitesOpened)
|
||||
{
|
||||
_modalBulkOneTimeInvitesOpened = true;
|
||||
ImGui.OpenPopup("Create Bulk One-Time Invites");
|
||||
ImGui.OpenPopup(L("GroupPanel.Invites.Title", "Create Bulk One-Time Invites"));
|
||||
}
|
||||
|
||||
if (!_showModalBulkOneTimeInvites) _modalBulkOneTimeInvitesOpened = false;
|
||||
|
||||
if (ImGui.BeginPopupModal("Create Bulk One-Time Invites", ref _showModalBulkOneTimeInvites, UiSharedService.PopupWindowFlags))
|
||||
if (ImGui.BeginPopupModal(L("GroupPanel.Invites.Title", "Create Bulk One-Time Invites"), ref _showModalBulkOneTimeInvites, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
UiSharedService.TextWrapped("This allows you to create up to 100 one-time invites at once for the Syncshell " + name + "." + Environment.NewLine
|
||||
+ "The invites are valid for 24h after creation and will automatically expire.");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Invites.Description", "This allows you to create up to 100 one-time invites at once for the Syncshell {0}.\nThe invites are valid for 24h after creation and will automatically expire.", name));
|
||||
ImGui.Separator();
|
||||
if (_bulkOneTimeInvites.Count == 0)
|
||||
{
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
ImGui.SliderInt("Amount##bulkinvites", ref _bulkInviteCount, 1, 100);
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.MailBulk, "Create invites"))
|
||||
ImGui.SliderInt(L("GroupPanel.Invites.AmountLabel", "Amount") + "##bulkinvites", ref _bulkInviteCount, 1, 100);
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.MailBulk, L("GroupPanel.Invites.CreateButton", "Create invites")))
|
||||
{
|
||||
_bulkOneTimeInvites = ApiController.GroupCreateTempInvite(groupDto, _bulkInviteCount).Result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.TextWrapped("A total of " + _bulkOneTimeInvites.Count + " invites have been created.");
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, "Copy invites to clipboard"))
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Invites.Result", "A total of {0} invites have been created.", _bulkOneTimeInvites.Count));
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, L("GroupPanel.Invites.Copy", "Copy invites to clipboard")))
|
||||
{
|
||||
ImGui.SetClipboardText(string.Join(Environment.NewLine, _bulkOneTimeInvites));
|
||||
}
|
||||
@@ -464,14 +599,14 @@ internal sealed class GroupPanel
|
||||
|
||||
if (visibleUsers.Count > 0)
|
||||
{
|
||||
ImGui.TextUnformatted("Visible");
|
||||
ImGui.TextUnformatted(L("GroupPanel.List.Visible", "Visible"));
|
||||
ImGui.Separator();
|
||||
_uidDisplayHandler.RenderPairList(visibleUsers);
|
||||
}
|
||||
|
||||
if (onlineUsers.Count > 0)
|
||||
{
|
||||
ImGui.TextUnformatted("Online");
|
||||
ImGui.TextUnformatted(L("GroupPanel.List.Online", "Online"));
|
||||
ImGui.Separator();
|
||||
_uidDisplayHandler.RenderPairList(onlineUsers);
|
||||
}
|
||||
@@ -479,12 +614,12 @@ internal sealed class GroupPanel
|
||||
if (offlineUsers.Count > 0)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
|
||||
ImGui.TextUnformatted("Offline/Unknown");
|
||||
ImGui.TextUnformatted(L("GroupPanel.List.Offline", "Offline/Unknown"));
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.Separator();
|
||||
if (hideOfflineUsers)
|
||||
{
|
||||
UiSharedService.ColorText($" {offlineUsers.Count} offline users omitted from display.", ImGuiColors.DalamudGrey);
|
||||
UiSharedService.ColorText(L("GroupPanel.List.OfflineOmitted", " {0} offline users omitted from display.", offlineUsers.Count), ImGuiColors.DalamudGrey);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -539,11 +674,11 @@ internal sealed class GroupPanel
|
||||
ImGui.BeginTooltip();
|
||||
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell permissions");
|
||||
ImGui.TextUnformatted(L("GroupPanel.Permissions.Header", "Syncshell permissions"));
|
||||
|
||||
if (!invitesEnabled)
|
||||
{
|
||||
var lockedText = "Syncshell is closed for joining";
|
||||
var lockedText = L("GroupPanel.Permissions.InvitesDisabled", "Syncshell is closed for joining");
|
||||
_uiShared.IconText(lockedIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(lockedText);
|
||||
@@ -551,7 +686,7 @@ internal sealed class GroupPanel
|
||||
|
||||
if (soundsDisabled)
|
||||
{
|
||||
var soundsText = "Sound sync disabled through owner";
|
||||
var soundsText = L("GroupPanel.Permissions.SoundDisabledOwner", "Sound sync disabled through owner");
|
||||
_uiShared.IconText(soundsIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(soundsText);
|
||||
@@ -559,7 +694,7 @@ internal sealed class GroupPanel
|
||||
|
||||
if (animDisabled)
|
||||
{
|
||||
var animText = "Animation sync disabled through owner";
|
||||
var animText = L("GroupPanel.Permissions.AnimationDisabledOwner", "Animation sync disabled through owner");
|
||||
_uiShared.IconText(animIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(animText);
|
||||
@@ -567,7 +702,7 @@ internal sealed class GroupPanel
|
||||
|
||||
if (vfxDisabled)
|
||||
{
|
||||
var vfxText = "VFX sync disabled through owner";
|
||||
var vfxText = L("GroupPanel.Permissions.VfxDisabledOwner", "VFX sync disabled through owner");
|
||||
_uiShared.IconText(vfxIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(vfxText);
|
||||
@@ -579,11 +714,11 @@ internal sealed class GroupPanel
|
||||
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.TextUnformatted("Your permissions");
|
||||
ImGui.TextUnformatted(L("GroupPanel.Permissions.OwnHeader", "Your permissions"));
|
||||
|
||||
if (userSoundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync disabled through you";
|
||||
var userSoundsText = L("GroupPanel.Permissions.SoundDisabledSelf", "Sound sync disabled through you");
|
||||
_uiShared.IconText(userSoundsIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
@@ -591,7 +726,7 @@ internal sealed class GroupPanel
|
||||
|
||||
if (userAnimDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync disabled through you";
|
||||
var userAnimText = L("GroupPanel.Permissions.AnimationDisabledSelf", "Animation sync disabled through you");
|
||||
_uiShared.IconText(userAnimIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
@@ -599,14 +734,14 @@ internal sealed class GroupPanel
|
||||
|
||||
if (userVFXDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync disabled through you";
|
||||
var userVFXText = L("GroupPanel.Permissions.VfxDisabledSelf", "VFX sync disabled through you");
|
||||
_uiShared.IconText(userVFXIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
}
|
||||
|
||||
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
|
||||
UiSharedService.TextWrapped("Note that syncshell permissions for disabling take precedence over your own set permissions");
|
||||
UiSharedService.TextWrapped(L("GroupPanel.Permissions.NotePriority", "Note that syncshell permissions for disabling take precedence over your own set permissions"));
|
||||
}
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
@@ -618,7 +753,8 @@ internal sealed class GroupPanel
|
||||
var userPerm = groupDto.GroupUserPermissions ^ GroupUserPermissions.Paused;
|
||||
_ = ApiController.GroupChangeIndividualPermissionState(new GroupPairUserPermissionDto(groupDto.Group, new UserData(ApiController.UID), userPerm));
|
||||
}
|
||||
UiSharedService.AttachToolTip((groupDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " pairing with all users in this Syncshell");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.PauseToggle.Tooltip", "{0} pairing with all users in this Syncshell",
|
||||
groupDto.GroupUserPermissions.IsPaused() ? L("GroupPanel.PauseToggle.Resume", "Resume") : L("GroupPanel.PauseToggle.Pause", "Pause")));
|
||||
ImGui.SameLine();
|
||||
|
||||
if (_uiShared.IconButton(FontAwesomeIcon.Bars))
|
||||
@@ -628,28 +764,32 @@ internal sealed class GroupPanel
|
||||
|
||||
if (ImGui.BeginPopup("ShellPopup"))
|
||||
{
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell") && UiSharedService.CtrlPressed())
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, L("GroupPanel.Popup.Leave", "Leave Syncshell")) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = ApiController.GroupLeave(groupDto);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold CTRL and click to leave this Syncshell" + (!string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal) ? string.Empty : Environment.NewLine
|
||||
+ "WARNING: This action is irreversible" + Environment.NewLine + "Leaving an owned Syncshell will transfer the ownership to a random person in the Syncshell."));
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.LeaveTooltip", "Hold CTRL and click to leave this Syncshell{0}",
|
||||
!string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal)
|
||||
? string.Empty
|
||||
: Environment.NewLine + L("GroupPanel.Popup.LeaveWarning", "WARNING: This action is irreversible\nLeaving an owned Syncshell will transfer the ownership to a random person in the Syncshell.")));
|
||||
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, "Copy ID"))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Copy, L("GroupPanel.Popup.CopyId", "Copy ID")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(groupDto.GroupAliasOrGID);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copy Syncshell ID to Clipboard");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.CopyIdTooltip", "Copy Syncshell ID to Clipboard"));
|
||||
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes"))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.StickyNote, L("GroupPanel.Popup.CopyNotes", "Copy Notes")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(UiSharedService.GetNotes(groupPairs));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copies all your notes for all users in this Syncshell to the clipboard." + Environment.NewLine + "They can be imported via Settings -> General -> Notes -> Import notes from clipboard");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.CopyNotesTooltip", "Copies all your notes for all users in this Syncshell to the clipboard.\nThey can be imported via Settings -> General -> Notes -> Import notes from clipboard"));
|
||||
|
||||
var soundsText = userSoundsDisabled ? "Enable sound sync" : "Disable sound sync";
|
||||
var soundsText = userSoundsDisabled
|
||||
? L("GroupPanel.Popup.EnableSound", "Enable sound sync")
|
||||
: L("GroupPanel.Popup.DisableSound", "Disable sound sync");
|
||||
if (_uiShared.IconTextButton(userSoundsIcon, soundsText))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -657,12 +797,11 @@ internal sealed class GroupPanel
|
||||
perm.SetDisableSounds(!perm.IsDisableSounds());
|
||||
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Sets your allowance for sound synchronization for users of this syncshell."
|
||||
+ Environment.NewLine + "Disabling the synchronization will stop applying sound modifications for users of this syncshell."
|
||||
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
|
||||
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.SoundTooltip", "Sets your allowance for sound synchronization for users of this syncshell.\nDisabling the synchronization will stop applying sound modifications for users of this syncshell.\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
|
||||
|
||||
var animText = userAnimDisabled ? "Enable animations sync" : "Disable animations sync";
|
||||
var animText = userAnimDisabled
|
||||
? L("GroupPanel.Popup.EnableAnimations", "Enable animations sync")
|
||||
: L("GroupPanel.Popup.DisableAnimations", "Disable animations sync");
|
||||
if (_uiShared.IconTextButton(userAnimIcon, animText))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -670,13 +809,11 @@ internal sealed class GroupPanel
|
||||
perm.SetDisableAnimations(!perm.IsDisableAnimations());
|
||||
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Sets your allowance for animations synchronization for users of this syncshell."
|
||||
+ Environment.NewLine + "Disabling the synchronization will stop applying animations modifications for users of this syncshell."
|
||||
+ Environment.NewLine + "Note: this setting might also affect sound synchronization"
|
||||
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
|
||||
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.AnimTooltip", "Sets your allowance for animations synchronization for users of this syncshell.\nDisabling the synchronization will stop applying animations modifications for users of this syncshell.\nNote: this setting might also affect sound synchronization\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
|
||||
|
||||
var vfxText = userVFXDisabled ? "Enable VFX sync" : "Disable VFX sync";
|
||||
var vfxText = userVFXDisabled
|
||||
? L("GroupPanel.Popup.EnableVfx", "Enable VFX sync")
|
||||
: L("GroupPanel.Popup.DisableVfx", "Disable VFX sync");
|
||||
if (_uiShared.IconTextButton(userVFXIcon, vfxText))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -684,16 +821,12 @@ internal sealed class GroupPanel
|
||||
perm.SetDisableVFX(!perm.IsDisableVFX());
|
||||
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Sets your allowance for VFX synchronization for users of this syncshell."
|
||||
+ Environment.NewLine + "Disabling the synchronization will stop applying VFX modifications for users of this syncshell."
|
||||
+ Environment.NewLine + "Note: this setting might also affect animation synchronization to some degree"
|
||||
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
|
||||
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
|
||||
UiSharedService.AttachToolTip(L("GroupPanel.Popup.VfxTooltip", "Sets your allowance for VFX synchronization for users of this syncshell.\nDisabling the synchronization will stop applying VFX modifications for users of this syncshell.\nNote: this setting might also affect animation synchronization to some degree\nNote: this setting can be forcefully overridden to 'disabled' through the syncshell owner.\nNote: this setting does not apply to individual pairs that are also in the syncshell."));
|
||||
|
||||
if (isOwner || groupDto.GroupUserInfo.IsModerator())
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel"))
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Cog, L("GroupPanel.Popup.OpenAdmin", "Open Admin Panel")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_mainUi.Mediator.Publish(new OpenSyncshellAdminPanel(groupDto));
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using System;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
using MareSynchronos.WebAPI;
|
||||
using MareSynchronos.Localization;
|
||||
|
||||
namespace MareSynchronos.UI.Components;
|
||||
|
||||
@@ -17,6 +19,13 @@ public class PairGroupsUi
|
||||
private readonly UidDisplayHandler _uidDisplayHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
private string L(string key, string fallback, params object[] args)
|
||||
{
|
||||
var safeArgs = args ?? Array.Empty<object>();
|
||||
return LocalizationService.Instance?.GetString(key, fallback, safeArgs)
|
||||
?? string.Format(System.Globalization.CultureInfo.CurrentCulture, fallback, safeArgs);
|
||||
}
|
||||
|
||||
public PairGroupsUi(MareConfigService mareConfig, TagHandler tagHandler, UidDisplayHandler uidDisplayHandler, ApiController apiController,
|
||||
SelectPairForGroupUi selectGroupForPairUi, UiSharedService uiSharedService)
|
||||
{
|
||||
@@ -65,21 +74,21 @@ public class PairGroupsUi
|
||||
}
|
||||
if (allArePaused)
|
||||
{
|
||||
UiSharedService.AttachToolTip($"Resume pairing with all pairs in {tag}");
|
||||
UiSharedService.AttachToolTip(L("PairGroups.ResumeAll", "Resume pairing with all pairs in {0}", tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.AttachToolTip($"Pause pairing with all pairs in {tag}");
|
||||
UiSharedService.AttachToolTip(L("PairGroups.PauseAll", "Pause pairing with all pairs in {0}", tag));
|
||||
}
|
||||
|
||||
var buttonDeleteOffset = windowX + windowWidth - flyoutMenuX;
|
||||
ImGui.SameLine(buttonDeleteOffset);
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("Group Flyout Menu");
|
||||
ImGui.OpenPopup(L("PairGroups.Menu.Title", "Group Flyout Menu"));
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopup("Group Flyout Menu"))
|
||||
if (ImGui.BeginPopup(L("PairGroups.Menu.Title", "Group Flyout Menu")))
|
||||
{
|
||||
using (ImRaii.PushId($"buttons-{tag}")) DrawGroupMenu(tag);
|
||||
ImGui.EndPopup();
|
||||
@@ -132,31 +141,35 @@ public class PairGroupsUi
|
||||
|
||||
private void DrawGroupMenu(string tag)
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Users, "Add people to " + tag))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Users, L("PairGroups.Menu.AddPeople", "Add people to {0}", tag)))
|
||||
{
|
||||
_selectGroupForPairUi.Open(tag);
|
||||
}
|
||||
UiSharedService.AttachToolTip($"Add more users to Group {tag}");
|
||||
UiSharedService.AttachToolTip(L("PairGroups.Menu.AddPeople.Tooltip", "Add more users to Group {0}", tag));
|
||||
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete " + tag) && UiSharedService.CtrlPressed())
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, L("PairGroups.Menu.Delete", "Delete {0}", tag)) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_tagHandler.RemoveTag(tag);
|
||||
}
|
||||
UiSharedService.AttachToolTip($"Delete Group {tag} (Will not delete the pairs)" + Environment.NewLine + "Hold CTRL to delete");
|
||||
UiSharedService.AttachToolTip(L("PairGroups.Menu.Delete.Tooltip", "Delete Group {0} (Will not delete the pairs)\nHold CTRL to delete", tag));
|
||||
}
|
||||
|
||||
private void DrawName(string tag, bool isSpecialTag, int visible, int online, int? total)
|
||||
{
|
||||
string displayedName = tag switch
|
||||
{
|
||||
TagHandler.CustomUnpairedTag => "Unpaired",
|
||||
TagHandler.CustomOfflineTag => "Offline",
|
||||
TagHandler.CustomOnlineTag => _mareConfig.Current.ShowOfflineUsersSeparately ? "Online" : "Contacts",
|
||||
TagHandler.CustomVisibleTag => "Visible",
|
||||
TagHandler.CustomUnpairedTag => L("PairGroups.Tag.Unpaired", "Unpaired"),
|
||||
TagHandler.CustomOfflineTag => L("PairGroups.Tag.Offline", "Offline"),
|
||||
TagHandler.CustomOnlineTag => _mareConfig.Current.ShowOfflineUsersSeparately
|
||||
? L("PairGroups.Tag.Online", "Online")
|
||||
: L("PairGroups.Tag.Contacts", "Contacts"),
|
||||
TagHandler.CustomVisibleTag => L("PairGroups.Tag.Visible", "Visible"),
|
||||
_ => tag
|
||||
};
|
||||
|
||||
string resultFolderName = !isSpecialTag ? $"{displayedName} ({visible}/{online}/{total} Pairs)" : $"{displayedName} ({online} Pairs)";
|
||||
string resultFolderName = !isSpecialTag
|
||||
? L("PairGroups.Header.WithCounts", "{0} ({1}/{2}/{3} Pairs)", displayedName, visible, online, total ?? 0)
|
||||
: L("PairGroups.Header.Special", "{0} ({1} Pairs)", displayedName, online);
|
||||
var icon = _tagHandler.IsTagOpen(tag) ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight;
|
||||
_uiSharedService.IconText(icon);
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
|
||||
@@ -173,11 +186,11 @@ public class PairGroupsUi
|
||||
if (!isSpecialTag && ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted($"Group {tag}");
|
||||
ImGui.TextUnformatted(L("PairGroups.Tooltip.Title", "Group {0}", tag));
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted($"{visible} Pairs visible");
|
||||
ImGui.TextUnformatted($"{online} Pairs online/paused");
|
||||
ImGui.TextUnformatted($"{total} Pairs total");
|
||||
ImGui.TextUnformatted(L("PairGroups.Tooltip.Visible", "{0} Pairs visible", visible));
|
||||
ImGui.TextUnformatted(L("PairGroups.Tooltip.Online", "{0} Pairs online/paused", online));
|
||||
ImGui.TextUnformatted(L("PairGroups.Tooltip.Total", "{0} Pairs total", total ?? 0));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -247,4 +260,4 @@ public class PairGroupsUi
|
||||
bool open = !_tagHandler.IsTagOpen(tag);
|
||||
_tagHandler.SetTagOpen(tag, open);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
UiSharedService.TextWrapped("User " + (_reportedPair.UserData.AliasOrUID) + " will be banned and removed from this Syncshell.");
|
||||
ImGui.InputTextWithHint("##banreason", "Ban Reason", ref _banReason, 255);
|
||||
UiSharedService.TextWrapped(_uiSharedService.Localize("Popup.BanUser.Description", "User {0} will be banned and removed from this Syncshell.", _reportedPair.UserData.AliasOrUID));
|
||||
ImGui.InputTextWithHint("##banreason", _uiSharedService.Localize("Popup.BanUser.ReasonHint", "Ban Reason"), ref _banReason, 255);
|
||||
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, "Ban User"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, _uiSharedService.Localize("Popup.BanUser.Button", "Ban User")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _banReason;
|
||||
_ = _apiController.GroupBanUser(new GroupPairDto(_group.Group, _reportedPair.UserData), reason);
|
||||
_banReason = string.Empty;
|
||||
}
|
||||
UiSharedService.TextWrapped("The reason will be displayed in the banlist. The current server-side alias if present (Vanity ID) will automatically be attached to the reason.");
|
||||
UiSharedService.TextWrapped(_uiSharedService.Localize("Popup.BanUser.ReasonNote", "The reason will be displayed in the banlist. The current server-side alias if present (Vanity ID) will automatically be attached to the reason."));
|
||||
}
|
||||
|
||||
public void Open(OpenBanUserPopupMessage message)
|
||||
@@ -47,4 +47,4 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
_group = message.GroupFullInfoDto;
|
||||
_banReason = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +72,10 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
if (_currentHandler.ShowClose)
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Times, _uiSharedService.Localize("Popup.Generic.Close", "Close")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,23 +29,21 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
public void DrawContent()
|
||||
{
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
UiSharedService.TextWrapped("Report " + _reportedPair!.UserData.AliasOrUID + " Profile");
|
||||
UiSharedService.TextWrapped(_uiSharedService.Localize("Popup.Report.Title", "Report {0} Profile", _reportedPair!.UserData.AliasOrUID));
|
||||
|
||||
ImGui.InputTextMultiline("##reportReason", ref _reportReason, 500, new Vector2(500 - ImGui.GetStyle().ItemSpacing.X * 2, 200));
|
||||
UiSharedService.TextWrapped($"Note: Sending a report will disable the offending profile globally.{Environment.NewLine}" +
|
||||
$"The report will be sent to the team of your currently connected server.{Environment.NewLine}" +
|
||||
$"Depending on the severity of the offense the users profile or account can be permanently disabled or banned.");
|
||||
UiSharedService.ColorTextWrapped("Report spam and wrong reports will not be tolerated and can lead to permanent account suspension.", ImGuiColors.DalamudRed);
|
||||
UiSharedService.ColorTextWrapped("This is not for reporting misbehavior but solely for the actual profile. " +
|
||||
"Reports that are not solely for the profile will be ignored.", ImGuiColors.DalamudYellow);
|
||||
UiSharedService.TextWrapped(_uiSharedService.Localize("Popup.Report.Note", "Note: Sending a report will disable the offending profile globally.\nThe report will be sent to the team of your currently connected server.\nDepending on the severity of the offense the users profile or account can be permanently disabled or banned."));
|
||||
UiSharedService.ColorTextWrapped(_uiSharedService.Localize("Popup.Report.Warning", "Report spam and wrong reports will not be tolerated and can lead to permanent account suspension."), ImGuiColors.DalamudRed);
|
||||
UiSharedService.ColorTextWrapped(_uiSharedService.Localize("Popup.Report.Scope", "This is not for reporting misbehavior but solely for the actual profile. Reports that are not solely for the profile will be ignored."), ImGuiColors.DalamudYellow);
|
||||
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_reportReason)))
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, "Send Report"))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, _uiSharedService.Localize("Popup.Report.Button", "Send Report")))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _reportReason;
|
||||
_ = _apiController.UserReportProfile(new(_reportedPair.UserData, reason));
|
||||
_reportReason = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,4 +53,4 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
_reportedPair = msg.PairToReport;
|
||||
_reportReason = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SelectGroupForPairUi
|
||||
}
|
||||
|
||||
var name = PairName(_pair);
|
||||
var popupName = $"Choose Groups for {name}";
|
||||
var popupName = _uiSharedService.Localize("PairGroups.Popup.Title", "Choose Groups for {0}", name);
|
||||
if (_show)
|
||||
{
|
||||
ImGui.OpenPopup(popupName);
|
||||
@@ -49,7 +49,7 @@ public class SelectGroupForPairUi
|
||||
var childHeight = tags.Count != 0 ? tags.Count * 25 : 1;
|
||||
var childSize = new Vector2(0, childHeight > 100 ? 100 : childHeight) * ImGuiHelpers.GlobalScale;
|
||||
|
||||
ImGui.TextUnformatted($"Select the groups you want {name} to be in.");
|
||||
ImGui.TextUnformatted(_uiSharedService.Localize("PairGroups.Popup.SelectPrompt", "Select the groups you want {0} to be in.", name));
|
||||
if (ImGui.BeginChild(name + "##listGroups", childSize))
|
||||
{
|
||||
foreach (var tag in tags)
|
||||
@@ -60,13 +60,13 @@ public class SelectGroupForPairUi
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted($"Create a new group for {name}.");
|
||||
ImGui.TextUnformatted(_uiSharedService.Localize("PairGroups.Popup.CreatePrompt", "Create a new group for {0}.", name));
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
HandleAddTag();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.InputTextWithHint("##category_name", "New Group", ref _tagNameToAdd, 40);
|
||||
ImGui.InputTextWithHint("##category_name", _uiSharedService.Localize("PairGroups.Popup.NewGroupHint", "New Group"), ref _tagNameToAdd, 40);
|
||||
if (ImGui.IsKeyDown(ImGuiKey.Enter))
|
||||
{
|
||||
HandleAddTag();
|
||||
@@ -119,4 +119,4 @@ public class SelectGroupForPairUi
|
||||
{
|
||||
return _uidDisplayHandler.GetPlayerText(pair).text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Utility;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
using MareSynchronos.UI;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -15,11 +16,13 @@ public class SelectPairForGroupUi
|
||||
private HashSet<string> _peopleInGroup = new(StringComparer.Ordinal);
|
||||
private bool _show = false;
|
||||
private string _tag = string.Empty;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
public SelectPairForGroupUi(TagHandler tagHandler, UidDisplayHandler uidDisplayHandler)
|
||||
public SelectPairForGroupUi(TagHandler tagHandler, UidDisplayHandler uidDisplayHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_tagHandler = tagHandler;
|
||||
_uidDisplayHandler = uidDisplayHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw(List<Pair> pairs)
|
||||
@@ -28,7 +31,7 @@ public class SelectPairForGroupUi
|
||||
var minSize = new Vector2(300, workHeight < 400 ? workHeight : 400) * ImGuiHelpers.GlobalScale;
|
||||
var maxSize = new Vector2(300, 1000) * ImGuiHelpers.GlobalScale;
|
||||
|
||||
var popupName = $"Choose Users for Group {_tag}";
|
||||
var popupName = _uiSharedService.Localize("PairGroups.SelectPairs.Title", "Choose Users for Group {0}", _tag);
|
||||
|
||||
if (!_show)
|
||||
{
|
||||
@@ -46,9 +49,9 @@ public class SelectPairForGroupUi
|
||||
ImGui.SetNextWindowSizeConstraints(minSize, maxSize);
|
||||
if (ImGui.BeginPopupModal(popupName, ref _show, ImGuiWindowFlags.Popup | ImGuiWindowFlags.Modal))
|
||||
{
|
||||
ImGui.TextUnformatted($"Select users for group {_tag}");
|
||||
ImGui.TextUnformatted(_uiSharedService.Localize("PairGroups.SelectPairs.SelectPrompt", "Select users for group {0}", _tag));
|
||||
|
||||
ImGui.InputTextWithHint("##filter", "Filter", ref _filter, 255, ImGuiInputTextFlags.None);
|
||||
ImGui.InputTextWithHint("##filter", _uiSharedService.Localize("PairGroups.SelectPairs.FilterHint", "Filter"), ref _filter, 255, ImGuiInputTextFlags.None);
|
||||
foreach (var item in pairs
|
||||
.Where(p => string.IsNullOrEmpty(_filter) || PairName(p).Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderBy(p => PairName(p), StringComparer.OrdinalIgnoreCase)
|
||||
@@ -89,4 +92,4 @@ public class SelectPairForGroupUi
|
||||
{
|
||||
return _uidDisplayHandler.GetPlayerText(pair).text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user