minor refactoring
This commit is contained in:
@@ -34,7 +34,7 @@ public class FileReplacementComparer : IEqualityComparer<FileReplacement>
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int GetOrderIndependentHashCode<T>(IEnumerable<T> source)
|
||||
private static int GetOrderIndependentHashCode<T>(IEnumerable<T> source) where T : notnull
|
||||
{
|
||||
int hash = 0;
|
||||
foreach (T element in source)
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FileReplacementDataComparer : IEqualityComparer<FileReplacementData
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int GetOrderIndependentHashCode<T>(IEnumerable<T> source)
|
||||
private static int GetOrderIndependentHashCode<T>(IEnumerable<T> source) where T : notnull
|
||||
{
|
||||
int hash = 0;
|
||||
foreach (T element in source)
|
||||
|
||||
@@ -74,9 +74,11 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
||||
});
|
||||
});
|
||||
|
||||
Mediator.Subscribe<CustomizePlusMessage>(this, async (msg) =>
|
||||
Mediator.Subscribe<CustomizePlusMessage>(this, (msg) =>
|
||||
{
|
||||
if (_isZoning) return;
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
foreach (var item in _playerRelatedObjects
|
||||
.Where(item => string.IsNullOrEmpty(msg.ProfileName)
|
||||
|| string.Equals(item.Value.Name, msg.ProfileName, StringComparison.Ordinal)).Select(k => k.Key))
|
||||
@@ -85,13 +87,14 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
||||
await AddPlayerCacheToCreate(item).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
Mediator.Subscribe<HeelsOffsetMessage>(this, async (_) =>
|
||||
});
|
||||
Mediator.Subscribe<HeelsOffsetMessage>(this, (msg) =>
|
||||
{
|
||||
if (_isZoning) return;
|
||||
Logger.LogDebug("Received Heels Offset change, updating player");
|
||||
await AddPlayerCacheToCreate().ConfigureAwait(false);
|
||||
_ = AddPlayerCacheToCreate();
|
||||
});
|
||||
Mediator.Subscribe<GlamourerChangedMessage>(this, async (msg) =>
|
||||
Mediator.Subscribe<GlamourerChangedMessage>(this, (msg) =>
|
||||
{
|
||||
if (_isZoning) return;
|
||||
var changedType = _playerRelatedObjects.FirstOrDefault(f => f.Value.Address == msg.Address);
|
||||
@@ -119,10 +122,10 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
||||
MoodlesChanged();
|
||||
}
|
||||
});
|
||||
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, async (msg) =>
|
||||
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, (msg) =>
|
||||
{
|
||||
Logger.LogDebug("Received Penumbra Mod settings change, updating player");
|
||||
await AddPlayerCacheToCreate().ConfigureAwait(false);
|
||||
_ = AddPlayerCacheToCreate();
|
||||
});
|
||||
|
||||
Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (msg) => ProcessCacheCreation());
|
||||
|
||||
@@ -57,14 +57,14 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
||||
.Where(w => w.IsPublic && !w.Name.RawData.IsEmpty)
|
||||
.ToDictionary(w => (ushort)w.RowId, w => w.Name.ToString());
|
||||
});
|
||||
mediator.Subscribe<TargetPairMessage>(this, async (msg) =>
|
||||
mediator.Subscribe<TargetPairMessage>(this, (msg) =>
|
||||
{
|
||||
if (clientState.IsPvP) return;
|
||||
var name = msg.Pair.PlayerName;
|
||||
if (string.IsNullOrEmpty(name)) return;
|
||||
var addr = _playerCharas.FirstOrDefault(f => string.Equals(f.Value.Name, name, StringComparison.Ordinal)).Value.Address;
|
||||
if (addr == nint.Zero) return;
|
||||
await RunOnFrameworkThread(() =>
|
||||
_ = RunOnFrameworkThread(() =>
|
||||
{
|
||||
targetManager.Target = CreateGameObject(addr);
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private readonly ServerConfigurationManager _serverManager;
|
||||
private readonly TopTabMenu _tabMenu;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly UiSharedService _uiShared;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private List<IDrawFolder> _drawFolders;
|
||||
private Pair? _lastAddedUser;
|
||||
private string _lastAddedUserComment = string.Empty;
|
||||
@@ -58,7 +58,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
PerformanceCollectorService performanceCollectorService)
|
||||
: base(logger, mediator, "###MareSynchronosMainUI", performanceCollectorService)
|
||||
{
|
||||
_uiShared = uiShared;
|
||||
_uiSharedService = uiShared;
|
||||
_configService = configService;
|
||||
_apiController = apiController;
|
||||
_pairManager = pairManager;
|
||||
@@ -68,7 +68,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_drawEntityFactory = drawEntityFactory;
|
||||
_selectGroupForPairUi = selectTagForPairUi;
|
||||
_selectPairsForGroupUi = selectPairForTagUi;
|
||||
_tabMenu = new TopTabMenu(Mediator, _apiController, _pairManager);
|
||||
_tabMenu = new TopTabMenu(Mediator, _apiController, _pairManager, _uiSharedService);
|
||||
|
||||
AllowPinning = false;
|
||||
AllowClickthrough = false;
|
||||
@@ -141,7 +141,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
var ver = _apiController.CurrentClientVersion;
|
||||
var unsupported = "UNSUPPORTED VERSION";
|
||||
using (ImRaii.PushFont(_uiShared.UidFont, _uiShared.UidFontBuilt))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
{
|
||||
var uidTextSize = ImGui.CalcTextSize(unsupported);
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMax().X + ImGui.GetWindowContentRegionMin().X) / 2 - uidTextSize.X / 2);
|
||||
@@ -188,7 +188,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
UiSharedService.TextWrapped($"You have successfully added {_lastAddedUser.UserData.AliasOrUID}. Set a local note for the user in the field below:");
|
||||
ImGui.InputTextWithHint("##noteforuser", $"Note for {_lastAddedUser.UserData.AliasOrUID}", ref _lastAddedUserComment, 100);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Save, "Save Note"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Save, "Save Note"))
|
||||
{
|
||||
_serverManager.SetNoteForUid(_lastAddedUser.UserData.UID, _lastAddedUserComment);
|
||||
_lastAddedUser = null;
|
||||
@@ -217,12 +217,12 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
if (keys.Any())
|
||||
{
|
||||
if (_secretKeyIdx == -1) _secretKeyIdx = keys.First().Key;
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add current character with secret key"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add current character with secret key"))
|
||||
{
|
||||
_serverManager.CurrentServer!.Authentications.Add(new MareConfiguration.Models.Authentication()
|
||||
{
|
||||
CharacterName = _uiShared.PlayerName,
|
||||
WorldId = _uiShared.WorldId,
|
||||
CharacterName = _uiSharedService.PlayerName,
|
||||
WorldId = _uiSharedService.WorldId,
|
||||
SecretKeyIdx = _secretKeyIdx
|
||||
});
|
||||
|
||||
@@ -231,7 +231,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_ = _apiController.CreateConnections();
|
||||
}
|
||||
|
||||
_uiShared.DrawCombo("Secret Key##addCharacterSecretKey", keys, (f) => f.Value.FriendlyName, (f) => _secretKeyIdx = f.Key);
|
||||
_uiSharedService.DrawCombo("Secret Key##addCharacterSecretKey", keys, (f) => f.Value.FriendlyName, (f) => _secretKeyIdx = f.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -257,7 +257,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
private void DrawServerStatus()
|
||||
{
|
||||
var buttonSize = UiSharedService.NormalizedIconButtonSize(FontAwesomeIcon.Link);
|
||||
var buttonSize = _uiSharedService.IconButtonSize(FontAwesomeIcon.Link);
|
||||
var userCount = _apiController.OnlineUsers.ToString(CultureInfo.InvariantCulture);
|
||||
var userSize = ImGui.CalcTextSize(userCount);
|
||||
var textSize = ImGui.CalcTextSize("Users Online");
|
||||
@@ -309,7 +309,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconButton(connectedIcon))
|
||||
if (UiSharedService.IconButton(connectedIcon))
|
||||
{
|
||||
_serverManager.CurrentServer.FullPause = !_serverManager.CurrentServer.FullPause;
|
||||
_serverManager.Save();
|
||||
@@ -324,7 +324,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private void DrawTransfers()
|
||||
{
|
||||
var currentUploads = _fileTransferManager.CurrentUploads.ToList();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Upload);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Upload);
|
||||
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
|
||||
|
||||
if (currentUploads.Any())
|
||||
@@ -349,7 +349,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
var currentDownloads = _currentDownloads.SelectMany(d => d.Value.Values).ToList();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Download);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Download);
|
||||
ImGui.SameLine(35 * ImGuiHelpers.GlobalScale);
|
||||
|
||||
if (currentDownloads.Any())
|
||||
@@ -378,7 +378,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
var uidText = GetUidText();
|
||||
|
||||
using (ImRaii.PushFont(_uiShared.UidFont, _uiShared.UidFontBuilt))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
{
|
||||
var uidTextSize = ImGui.CalcTextSize(uidText);
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X) / 2 - (uidTextSize.X / 2));
|
||||
@@ -498,7 +498,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
if (_configService.Current.GroupUpSyncshells)
|
||||
drawFolders.Add(new DrawGroupedGroupFolder(groupFolders, _tagHandler));
|
||||
drawFolders.Add(new DrawGroupedGroupFolder(groupFolders, _tagHandler, _uiSharedService));
|
||||
else
|
||||
drawFolders.AddRange(groupFolders);
|
||||
|
||||
|
||||
@@ -13,17 +13,19 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
protected readonly string _id;
|
||||
protected readonly IImmutableList<Pair> _allPairs;
|
||||
protected readonly TagHandler _tagHandler;
|
||||
protected readonly UiSharedService _uiSharedService;
|
||||
private float _menuWidth = -1;
|
||||
public int OnlinePairs => DrawPairs.Count(u => u.Pair.IsOnline);
|
||||
public int TotalPairs => _allPairs.Count;
|
||||
|
||||
protected DrawFolderBase(string id, IImmutableList<DrawUserPair> drawPairs,
|
||||
IImmutableList<Pair> allPairs, TagHandler tagHandler)
|
||||
IImmutableList<Pair> allPairs, TagHandler tagHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_id = id;
|
||||
DrawPairs = drawPairs;
|
||||
_allPairs = allPairs;
|
||||
_tagHandler = tagHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
protected abstract bool RenderIfEmpty { get; }
|
||||
@@ -40,7 +42,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
_tagHandler.SetTagOpen(_id, !_tagHandler.IsTagOpen(_id));
|
||||
@@ -60,7 +62,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
// if opened draw content
|
||||
if (_tagHandler.IsTagOpen(_id))
|
||||
{
|
||||
using var indent = ImRaii.PushIndent(UiSharedService.GetIconData(FontAwesomeIcon.Bars).NormalizedIconScale.Y + ImGui.GetStyle().ItemSpacing.X, false);
|
||||
using var indent = ImRaii.PushIndent(_uiSharedService.GetIconData(FontAwesomeIcon.Bars).X + ImGui.GetStyle().ItemSpacing.X, false);
|
||||
if (DrawPairs.Any())
|
||||
{
|
||||
foreach (var item in DrawPairs)
|
||||
@@ -87,7 +89,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
|
||||
private float DrawRightSideInternal()
|
||||
{
|
||||
var barButtonSize = UiSharedService.NormalizedIconButtonSize(FontAwesomeIcon.Bars);
|
||||
var barButtonSize = _uiSharedService.IconButtonSize(FontAwesomeIcon.Bars);
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth();
|
||||
|
||||
@@ -97,7 +99,7 @@ public abstract class DrawFolderBase : IDrawFolder
|
||||
if (RenderMenu)
|
||||
{
|
||||
ImGui.SameLine(windowEndX - barButtonSize.X);
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Bars))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("User Flyout Menu");
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
|
||||
public DrawFolderGroup(string id, GroupFullInfoDto groupFullInfoDto, ApiController apiController,
|
||||
IImmutableList<DrawUserPair> drawPairs, IImmutableList<Pair> allPairs, TagHandler tagHandler, IdDisplayHandler idDisplayHandler,
|
||||
MareMediator mareMediator) :
|
||||
base(id, drawPairs, allPairs, tagHandler)
|
||||
MareMediator mareMediator, UiSharedService uiSharedService) :
|
||||
base(id, drawPairs, allPairs, tagHandler, uiSharedService)
|
||||
{
|
||||
_groupFullInfoDto = groupFullInfoDto;
|
||||
_apiController = apiController;
|
||||
@@ -41,7 +41,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(_groupFullInfoDto.GroupPermissions.IsDisableInvites() ? FontAwesomeIcon.Lock : FontAwesomeIcon.Users);
|
||||
_uiSharedService.IconText(_groupFullInfoDto.GroupPermissions.IsDisableInvites() ? FontAwesomeIcon.Lock : FontAwesomeIcon.Users);
|
||||
if (_groupFullInfoDto.GroupPermissions.IsDisableInvites())
|
||||
{
|
||||
UiSharedService.AttachToolTip("Syncshell " + _groupFullInfoDto.GroupAliasOrGID + " is closed for invites");
|
||||
@@ -60,19 +60,19 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
if (IsOwner)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Crown);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Crown);
|
||||
UiSharedService.AttachToolTip("You are the owner of " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
else if (IsModerator)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UserShield);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield);
|
||||
UiSharedService.AttachToolTip("You are a moderator in " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
else if (IsPinned)
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Thumbtack);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
||||
UiSharedService.AttachToolTip("You are pinned in " + _groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
ImGui.SameLine();
|
||||
@@ -85,21 +85,21 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.TextUnformatted("General Syncshell Actions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Copy, "Copy ID", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Copy, "Copy ID", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(_groupFullInfoDto.GroupAliasOrGID);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copy Syncshell ID to Clipboard");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Copy Notes", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
ImGui.SetClipboardText(UiSharedService.GetNotes(DrawPairs.Select(k => k.Pair).ToList()));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Copies all your notes for all users in this Syncshell to the clipboard." + Environment.NewLine + "They can be imported via Settings -> Privacy -> Import Notes from Clipboard");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowCircleLeft, "Leave Syncshell", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.GroupLeave(_groupFullInfoDto);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -117,7 +117,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
if ((_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != disableAnims
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableSounds() != disableSounds
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableVFX() != disableVfx)
|
||||
&& UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Align with suggested permissions", menuWidth, true))
|
||||
&& UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Align with suggested permissions", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableVFX(_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX());
|
||||
perm.SetDisableSounds(_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds());
|
||||
@@ -126,24 +126,21 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeOff, disableSounds ? "Enable Sound Sync" : "Disable Sound Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeOff, disableSounds ? "Enable Sound Sync" : "Disable Sound Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableSounds(!disableSounds);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop, disableAnims ? "Enable Animation Sync" : "Disable Animation Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop, disableAnims ? "Enable Animation Sync" : "Disable Animation Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableAnimations(!disableAnims);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle, disableVfx ? "Enable VFX Sync" : "Disable VFX Sync",
|
||||
menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle, disableVfx ? "Enable VFX Sync" : "Disable VFX Sync", menuWidth, true))
|
||||
{
|
||||
perm.SetDisableVFX(!disableVfx);
|
||||
_ = _apiController.GroupChangeIndividualPermissionState(new(_groupFullInfoDto.Group, new(_apiController.UID), perm));
|
||||
@@ -154,7 +151,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted("Syncshell Admin Functions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Cog, "Open Admin Panel", menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_mareMediator.Publish(new OpenSyncshellAdminPanel(_groupFullInfoDto));
|
||||
@@ -172,9 +169,9 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
|
||||
FontAwesomeIcon pauseIcon = _groupFullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseButtonSize = UiSharedService.NormalizedIconButtonSize(pauseIcon);
|
||||
var pauseButtonSize = _uiSharedService.IconButtonSize(pauseIcon);
|
||||
|
||||
var userCogButtonSize = UiSharedService.GetIconData(FontAwesomeIcon.UsersCog).NormalizedIconScale;
|
||||
var userCogButtonSize = _uiSharedService.GetIconData(FontAwesomeIcon.UsersCog);
|
||||
|
||||
var individualSoundsDisabled = _groupFullInfoDto.GroupUserPermissions.IsDisableSounds();
|
||||
var individualAnimDisabled = _groupFullInfoDto.GroupUserPermissions.IsDisableAnimations();
|
||||
@@ -186,7 +183,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UsersCog, (_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != individualAnimDisabled
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UsersCog, (_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations() != individualAnimDisabled
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableSounds() != individualSoundsDisabled
|
||||
|| _groupFullInfoDto.GroupPermissions.IsPreferDisableVFX() != individualVFXDisabled) ? ImGuiColors.DalamudYellow : null);
|
||||
if (ImGui.IsItemHovered())
|
||||
@@ -196,17 +193,17 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.TextUnformatted("Syncshell Permissions");
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualSoundsDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualSoundsDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Sound Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualAnimDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualAnimDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Animation Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!individualVFXDisabled, inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!individualVFXDisabled, inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("VFX Sync");
|
||||
@@ -217,17 +214,17 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
ImGui.TextUnformatted("Suggested Permissions");
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableSounds(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Sound Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableAnimations(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Animation Sync");
|
||||
|
||||
UiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX(), inline: false);
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupFullInfoDto.GroupPermissions.IsPreferDisableVFX(), inline: false);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("VFX Sync");
|
||||
@@ -236,7 +233,7 @@ public class DrawFolderGroup : DrawFolderBase
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconButton(pauseIcon))
|
||||
if (UiSharedService.IconButton(pauseIcon))
|
||||
{
|
||||
var perm = _groupFullInfoDto.GroupUserPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
|
||||
@@ -15,8 +15,8 @@ public class DrawFolderTag : DrawFolderBase
|
||||
private readonly SelectPairForTagUi _selectPairForTagUi;
|
||||
|
||||
public DrawFolderTag(string id, IImmutableList<DrawUserPair> drawPairs, IImmutableList<Pair> allPairs,
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi)
|
||||
: base(id, drawPairs, allPairs, tagHandler)
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi, UiSharedService uiSharedService)
|
||||
: base(id, drawPairs, allPairs, tagHandler, uiSharedService)
|
||||
{
|
||||
_apiController = apiController;
|
||||
_selectPairForTagUi = selectPairForTagUi;
|
||||
@@ -80,7 +80,7 @@ public class DrawFolderTag : DrawFolderBase
|
||||
};
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
|
||||
if (RenderCount)
|
||||
{
|
||||
@@ -100,12 +100,12 @@ public class DrawFolderTag : DrawFolderBase
|
||||
protected override void DrawMenu(float menuWidth)
|
||||
{
|
||||
ImGui.TextUnformatted("Group Menu");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, true))
|
||||
{
|
||||
_selectPairForTagUi.Open(_id);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Select Individual Pairs for this Pair Group");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_tagHandler.RemoveTag(_id);
|
||||
}
|
||||
@@ -137,11 +137,11 @@ public class DrawFolderTag : DrawFolderBase
|
||||
|
||||
var allArePaused = _allPairs.All(pair => pair.UserPair!.OwnPermissions.IsPaused());
|
||||
var pauseButton = allArePaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseButtonX = UiSharedService.NormalizedIconButtonSize(pauseButton).X;
|
||||
var pauseButtonX = _uiSharedService.IconButtonSize(pauseButton).X;
|
||||
|
||||
var buttonPauseOffset = currentRightSideX - pauseButtonX;
|
||||
ImGui.SameLine(buttonPauseOffset);
|
||||
if (UiSharedService.NormalizedIconButton(pauseButton))
|
||||
if (UiSharedService.IconButton(pauseButton))
|
||||
{
|
||||
if (allArePaused)
|
||||
{
|
||||
|
||||
@@ -11,14 +11,17 @@ public class DrawGroupedGroupFolder : IDrawFolder
|
||||
{
|
||||
private readonly IEnumerable<IDrawFolder> _groups;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
public IImmutableList<DrawUserPair> DrawPairs => throw new NotSupportedException();
|
||||
public int OnlinePairs => _groups.SelectMany(g => g.DrawPairs).Where(g => g.Pair.IsOnline).DistinctBy(g => g.Pair.UserData.UID).Count();
|
||||
public int TotalPairs => _groups.Sum(g => g.TotalPairs);
|
||||
|
||||
public DrawGroupedGroupFolder(IEnumerable<IDrawFolder> groups, TagHandler tagHandler)
|
||||
public DrawGroupedGroupFolder(IEnumerable<IDrawFolder> groups, TagHandler tagHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_groups = groups;
|
||||
_tagHandler = tagHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -33,14 +36,14 @@ public class DrawGroupedGroupFolder : IDrawFolder
|
||||
ImGui.SameLine();
|
||||
|
||||
var icon = _tagHandler.IsTagOpen(_id) ? FontAwesomeIcon.CaretDown : FontAwesomeIcon.CaretRight;
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
_tagHandler.SetTagOpen(_id, !_tagHandler.IsTagOpen(_id));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UsersRectangle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UsersRectangle);
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemSpacing with { X = ImGui.GetStyle().ItemSpacing.X / 2f }))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
|
||||
@@ -25,13 +25,15 @@ public class DrawUserPair
|
||||
private readonly string _id;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||
private float _menuRenderWidth = -1;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private float _menuWidth = -1;
|
||||
|
||||
public DrawUserPair(string id, Pair entry, List<GroupFullInfoDto> syncedGroups,
|
||||
GroupFullInfoDto? currentGroup,
|
||||
ApiController apiController, IdDisplayHandler uIDDisplayHandler,
|
||||
MareMediator mareMediator, SelectTagForPairUi selectTagForPairUi,
|
||||
ServerConfigurationManager serverConfigurationManager)
|
||||
ServerConfigurationManager serverConfigurationManager,
|
||||
UiSharedService uiSharedService)
|
||||
{
|
||||
_id = id;
|
||||
_pair = entry;
|
||||
@@ -42,6 +44,7 @@ public class DrawUserPair
|
||||
_mediator = mareMediator;
|
||||
_selectTagForPairUi = selectTagForPairUi;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public Pair Pair => _pair;
|
||||
@@ -62,7 +65,7 @@ public class DrawUserPair
|
||||
{
|
||||
if (!_pair.IsPaused)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.User, "Open Profile", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.User, "Open Profile", _menuWidth, true))
|
||||
{
|
||||
_displayHandler.OpenProfile(_pair);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -71,7 +74,7 @@ public class DrawUserPair
|
||||
}
|
||||
if (_pair.IsVisible)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Sync, "Reload last data", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Sync, "Reload last data", _menuWidth, true))
|
||||
{
|
||||
_pair.ApplyLastReceivedData(forced: true);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -79,7 +82,7 @@ public class DrawUserPair
|
||||
UiSharedService.AttachToolTip("This reapplies the last received character data to this character");
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PlayCircle, "Cycle pause state", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Cycle pause state", _menuWidth, true))
|
||||
{
|
||||
_ = _apiController.CyclePause(_pair.UserData);
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -87,7 +90,7 @@ public class DrawUserPair
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.TextUnformatted("Pair Permission Functions");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.WindowMaximize, "Open Permissions Window", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.WindowMaximize, "Open Permissions Window", _menuWidth, true))
|
||||
{
|
||||
_mediator.Publish(new OpenPermissionWindow(_pair));
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -97,7 +100,7 @@ public class DrawUserPair
|
||||
var isSticky = _pair.UserPair!.OwnPermissions.IsSticky();
|
||||
string stickyText = isSticky ? "Disable Preferred Permissions" : "Enable Preferred Permissions";
|
||||
var stickyIcon = isSticky ? FontAwesomeIcon.ArrowCircleDown : FontAwesomeIcon.ArrowCircleUp;
|
||||
if (UiSharedService.NormalizedIconTextButton(stickyIcon, stickyText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(stickyIcon, stickyText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetSticky(!isSticky);
|
||||
@@ -113,7 +116,7 @@ public class DrawUserPair
|
||||
var isDisableSounds = _pair.UserPair!.OwnPermissions.IsDisableSounds();
|
||||
string disableSoundsText = isDisableSounds ? "Enable sound sync" : "Disable sound sync";
|
||||
var disableSoundsIcon = isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableSoundsIcon, disableSoundsText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableSoundsIcon, disableSoundsText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableSounds(!isDisableSounds);
|
||||
@@ -124,7 +127,7 @@ public class DrawUserPair
|
||||
var isDisableAnims = _pair.UserPair!.OwnPermissions.IsDisableAnimations();
|
||||
string disableAnimsText = isDisableAnims ? "Enable animation sync" : "Disable animation sync";
|
||||
var disableAnimsIcon = isDisableAnims ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableAnimsIcon, disableAnimsText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableAnimsIcon, disableAnimsText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableAnimations(!isDisableAnims);
|
||||
@@ -135,7 +138,7 @@ public class DrawUserPair
|
||||
var isDisableVFX = _pair.UserPair!.OwnPermissions.IsDisableVFX();
|
||||
string disableVFXText = isDisableVFX ? "Enable VFX sync" : "Disable VFX sync";
|
||||
var disableVFXIcon = isDisableVFX ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle;
|
||||
if (UiSharedService.NormalizedIconTextButton(disableVFXIcon, disableVFXText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(disableVFXIcon, disableVFXText, _menuWidth, true))
|
||||
{
|
||||
var permissions = _pair.UserPair.OwnPermissions;
|
||||
permissions.SetDisableVFX(!isDisableVFX);
|
||||
@@ -147,7 +150,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted("Pair reporting");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ExclamationTriangle, "Report Mare Profile", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, "Report Mare Profile", _menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_mediator.Publish(new OpenReportPopupMessage(_pair));
|
||||
@@ -163,12 +166,12 @@ public class DrawUserPair
|
||||
|
||||
if (_pair.IndividualPairStatus != API.Data.Enum.IndividualPairStatus.None)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Folder, "Pair Groups", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Folder, "Pair Groups", _menuWidth, true))
|
||||
{
|
||||
_selectTagForPairUi.Open(_pair);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Choose pair groups for " + entryUID);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently", _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently", _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_ = _apiController.UserRemovePair(new(_pair.UserData));
|
||||
}
|
||||
@@ -176,7 +179,7 @@ public class DrawUserPair
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Pair individually", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Pair individually", _menuWidth, true))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new(_pair.UserData));
|
||||
}
|
||||
@@ -193,13 +196,13 @@ public class DrawUserPair
|
||||
if (_pair.IsPaused)
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.PauseCircle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.PauseCircle);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is paused";
|
||||
}
|
||||
else if (!_pair.IsOnline)
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
UiSharedService.NormalizedIcon(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.OneSided
|
||||
_uiSharedService.IconText(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.OneSided
|
||||
? FontAwesomeIcon.ArrowsLeftRight
|
||||
: (_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
? FontAwesomeIcon.User : FontAwesomeIcon.Users));
|
||||
@@ -207,7 +210,7 @@ public class DrawUserPair
|
||||
}
|
||||
else if (_pair.IsVisible)
|
||||
{
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Eye, ImGuiColors.ParsedGreen);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Eye, ImGuiColors.ParsedGreen);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is visible: " + _pair.PlayerName + Environment.NewLine + "Click to target this player";
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
@@ -217,7 +220,7 @@ public class DrawUserPair
|
||||
else
|
||||
{
|
||||
using var _ = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
|
||||
UiSharedService.NormalizedIcon(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
_uiSharedService.IconText(_pair.IndividualPairStatus == API.Data.Enum.IndividualPairStatus.Bidirectional
|
||||
? FontAwesomeIcon.User : FontAwesomeIcon.Users);
|
||||
userPairText = _pair.UserData.AliasOrUID + " is online";
|
||||
}
|
||||
@@ -286,22 +289,22 @@ public class DrawUserPair
|
||||
private float DrawRightSide()
|
||||
{
|
||||
var pauseIcon = _pair.UserPair!.OwnPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseIconSize = UiSharedService.NormalizedIconButtonSize(pauseIcon);
|
||||
var barButtonSize = UiSharedService.NormalizedIconButtonSize(FontAwesomeIcon.Bars);
|
||||
var pauseIconSize = _uiSharedService.IconButtonSize(pauseIcon);
|
||||
var barButtonSize = _uiSharedService.IconButtonSize(FontAwesomeIcon.Bars);
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth();
|
||||
float currentRightSide = windowEndX - barButtonSize.X;
|
||||
|
||||
ImGui.SameLine(currentRightSide);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Bars))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("User Flyout Menu");
|
||||
}
|
||||
|
||||
currentRightSide -= (pauseIconSize.X + spacingX);
|
||||
ImGui.SameLine(currentRightSide);
|
||||
if (UiSharedService.NormalizedIconButton(pauseIcon))
|
||||
if (UiSharedService.IconButton(pauseIcon))
|
||||
{
|
||||
var perm = _pair.UserPair!.OwnPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
@@ -321,11 +324,11 @@ public class DrawUserPair
|
||||
|
||||
if (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled || individualIsSticky)
|
||||
{
|
||||
currentRightSide -= (UiSharedService.GetIconData(individualIcon).NormalizedIconScale.X + spacingX);
|
||||
currentRightSide -= (_uiSharedService.GetIconData(individualIcon).X + spacingX);
|
||||
|
||||
ImGui.SameLine(currentRightSide);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow, individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled))
|
||||
UiSharedService.NormalizedIcon(individualIcon);
|
||||
_uiSharedService.IconText(individualIcon);
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
@@ -335,7 +338,7 @@ public class DrawUserPair
|
||||
|
||||
if (individualIsSticky)
|
||||
{
|
||||
UiSharedService.NormalizedIcon(individualIcon);
|
||||
_uiSharedService.IconText(individualIcon);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Preferred permissions enabled");
|
||||
@@ -346,7 +349,7 @@ public class DrawUserPair
|
||||
if (individualSoundsDisabled)
|
||||
{
|
||||
var userSoundsText = "Sound sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.VolumeOff);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.VolumeOff);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userSoundsText);
|
||||
@@ -354,17 +357,17 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableSounds());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableSounds());
|
||||
}
|
||||
|
||||
if (individualAnimDisabled)
|
||||
{
|
||||
var userAnimText = "Animation sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Stop);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Stop);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userAnimText);
|
||||
@@ -372,17 +375,17 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableAnimations());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableAnimations());
|
||||
}
|
||||
|
||||
if (individualVFXDisabled)
|
||||
{
|
||||
var userVFXText = "VFX sync";
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Circle);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Circle);
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(userVFXText);
|
||||
@@ -390,11 +393,11 @@ public class DrawUserPair
|
||||
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("You");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OwnPermissions.IsDisableVFX());
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("They");
|
||||
UiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_pair.UserPair!.OtherPermissions.IsDisableVFX());
|
||||
}
|
||||
|
||||
ImGui.EndTooltip();
|
||||
@@ -427,9 +430,9 @@ public class DrawUserPair
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
currentRightSide -= (UiSharedService.GetIconData(icon).NormalizedIconScale.X + spacingX);
|
||||
currentRightSide -= (_uiSharedService.GetIconData(icon).X + spacingX);
|
||||
ImGui.SameLine(currentRightSide);
|
||||
UiSharedService.NormalizedIcon(icon);
|
||||
_uiSharedService.IconText(icon);
|
||||
UiSharedService.AttachToolTip(text);
|
||||
}
|
||||
}
|
||||
@@ -442,9 +445,9 @@ public class DrawUserPair
|
||||
DrawCommonClientMenu();
|
||||
ImGui.Separator();
|
||||
DrawPairedClientMenu();
|
||||
if (_menuRenderWidth <= 0)
|
||||
if (_menuWidth <= 0)
|
||||
{
|
||||
_menuRenderWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
_menuWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +463,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell Moderator Functions");
|
||||
var pinText = userIsPinned ? "Unpin user" : "Pin user";
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Thumbtack, pinText, _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Thumbtack, pinText, _menuWidth, true))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (!group.GroupPairUserInfos.TryGetValue(_pair.UserData.UID, out var userinfo))
|
||||
@@ -475,14 +478,14 @@ public class DrawUserPair
|
||||
}
|
||||
UiSharedService.AttachToolTip("Pin this user to the Syncshell. Pinned users will not be deleted in case of a manually initiated Syncshell clean");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Remove user", _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Remove user", _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_ = _apiController.GroupRemoveUser(new(group.Group, _pair.UserData));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold CTRL and click to remove user " + (_pair.UserData.AliasOrUID) + " from Syncshell");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserSlash, "Ban User", _menuRenderWidth, true))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, "Ban User", _menuWidth, true))
|
||||
{
|
||||
_mediator.Publish(new OpenBanUserPopupMessage(_pair, group));
|
||||
ImGui.CloseCurrentPopup();
|
||||
@@ -496,7 +499,7 @@ public class DrawUserPair
|
||||
{
|
||||
ImGui.TextUnformatted("Syncshell Owner Functions");
|
||||
string modText = userIsModerator ? "Demod user" : "Mod user";
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserShield, modText, _menuRenderWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserShield, modText, _menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (!group.GroupPairUserInfos.TryGetValue(_pair.UserData.UID, out var userinfo))
|
||||
@@ -513,7 +516,7 @@ public class DrawUserPair
|
||||
UiSharedService.AttachToolTip("Hold CTRL to change the moderator status for " + (_pair.UserData.AliasOrUID) + Environment.NewLine +
|
||||
"Moderators can kick, ban/unban, pin/unpin users and clear the Syncshell.");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Crown, "Transfer Ownership", _menuRenderWidth, true) && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Crown, "Transfer Ownership", _menuWidth, true) && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
_ = _apiController.GroupChangeOwnership(new(group.Group, _pair.UserData));
|
||||
|
||||
@@ -11,13 +11,15 @@ namespace MareSynchronos.UI.Components.Popup;
|
||||
public class BanUserPopupHandler : IPopupHandler
|
||||
{
|
||||
private readonly ApiController _apiController;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private string _banReason = string.Empty;
|
||||
private GroupFullInfoDto _group = null!;
|
||||
private Pair _reportedPair = null!;
|
||||
|
||||
public BanUserPopupHandler(ApiController apiController)
|
||||
public BanUserPopupHandler(ApiController apiController, UiSharedService uiSharedService)
|
||||
{
|
||||
_apiController = apiController;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public Vector2 PopupSize => new(500, 250);
|
||||
@@ -29,7 +31,7 @@ public class BanUserPopupHandler : IPopupHandler
|
||||
UiSharedService.TextWrapped("User " + (_reportedPair.UserData.AliasOrUID) + " will be banned and removed from this Syncshell.");
|
||||
ImGui.InputTextWithHint("##banreason", "Ban Reason", ref _banReason, 255);
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserSlash, "Ban User"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserSlash, "Ban User"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _banReason;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.Services.ServerConfiguration;
|
||||
using System.Numerics;
|
||||
@@ -25,7 +24,7 @@ public class CensusPopupHandler : IPopupHandler
|
||||
public void DrawContent()
|
||||
{
|
||||
var start = 0f;
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
{
|
||||
start = ImGui.GetCursorPosY() - ImGui.CalcTextSize("Mare Census Data").Y;
|
||||
UiSharedService.TextWrapped("Mare Census Participation");
|
||||
|
||||
@@ -13,9 +13,11 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
{
|
||||
protected bool _openPopup = false;
|
||||
private readonly HashSet<IPopupHandler> _handlers;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private IPopupHandler? _currentHandler = null;
|
||||
|
||||
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers, PerformanceCollectorService performanceCollectorService)
|
||||
public PopupHandler(ILogger<PopupHandler> logger, MareMediator mediator, IEnumerable<IPopupHandler> popupHandlers, PerformanceCollectorService performanceCollectorService,
|
||||
UiSharedService uiSharedService)
|
||||
: base(logger, mediator, "MarePopupHandler", performanceCollectorService)
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoBringToFrontOnFocus
|
||||
@@ -52,6 +54,7 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
_currentHandler = _handlers.OfType<CensusPopupHandler>().Single();
|
||||
IsOpen = true;
|
||||
});
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
protected override void DrawInternal()
|
||||
@@ -73,7 +76,7 @@ public class PopupHandler : WindowMediatorSubscriberBase
|
||||
if (_currentHandler.ShowClose)
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Times, "Close"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
|
||||
public void DrawContent()
|
||||
{
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
UiSharedService.TextWrapped("Report " + _reportedPair!.UserData.AliasOrUID + " Mare Profile");
|
||||
|
||||
ImGui.InputTextMultiline("##reportReason", ref _reportReason, 500, new Vector2(500 - ImGui.GetStyle().ItemSpacing.X * 2, 200));
|
||||
@@ -42,7 +42,7 @@ internal class ReportPopupHandler : IPopupHandler
|
||||
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_reportReason)))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ExclamationTriangle, "Send Report"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ExclamationTriangle, "Send Report"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
var reason = _reportReason;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
using MareSynchronos.UI.Handlers;
|
||||
@@ -48,7 +47,8 @@ public class SelectPairForTagUi
|
||||
ImGui.SetNextWindowSizeConstraints(minSize, maxSize);
|
||||
if (ImGui.BeginPopupModal(popupName, ref _show, ImGuiWindowFlags.Popup | ImGuiWindowFlags.Modal))
|
||||
{
|
||||
UiSharedService.FontText($"Select users for group {_tag}", UiBuilder.DefaultFont);
|
||||
ImGui.TextUnformatted($"Select users for group {_tag}");
|
||||
|
||||
ImGui.InputTextWithHint("##filter", "Filter", ref _filter, 255, ImGuiInputTextFlags.None);
|
||||
foreach (var item in pairs
|
||||
.Where(p => string.IsNullOrEmpty(_filter) || PairName(p).Contains(_filter, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -14,6 +14,7 @@ public class SelectTagForPairUi
|
||||
{
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly IdDisplayHandler _uidDisplayHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
|
||||
/// <summary>
|
||||
/// The group UI is always open for a specific pair. This defines which pair the UI is open for.
|
||||
@@ -31,12 +32,13 @@ public class SelectTagForPairUi
|
||||
/// </summary>
|
||||
private string _tagNameToAdd = "";
|
||||
|
||||
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler)
|
||||
public SelectTagForPairUi(TagHandler tagHandler, IdDisplayHandler uidDisplayHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_show = false;
|
||||
_pair = null;
|
||||
_tagHandler = tagHandler;
|
||||
_uidDisplayHandler = uidDisplayHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -61,7 +63,7 @@ public class SelectTagForPairUi
|
||||
var childHeight = tags.Count != 0 ? tags.Count * 25 : 1;
|
||||
var childSize = new Vector2(0, childHeight > 100 ? 100 : childHeight) * ImGuiHelpers.GlobalScale;
|
||||
|
||||
UiSharedService.FontText($"Select the groups you want {name} to be in.", UiBuilder.DefaultFont);
|
||||
ImGui.TextUnformatted($"Select the groups you want {name} to be in.");
|
||||
if (ImGui.BeginChild(name + "##listGroups", childSize))
|
||||
{
|
||||
foreach (var tag in tags)
|
||||
@@ -72,8 +74,8 @@ public class SelectTagForPairUi
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.FontText($"Create a new group for {name}.", UiBuilder.DefaultFont);
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Plus))
|
||||
ImGui.TextUnformatted($"Create a new group for {name}.");
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
{
|
||||
HandleAddTag();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
@@ -38,12 +37,12 @@ public class CreateSyncshellUI : WindowMediatorSubscriberBase
|
||||
|
||||
protected override void DrawInternal()
|
||||
{
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
ImGui.TextUnformatted("Create new Syncshell");
|
||||
|
||||
if (_lastCreatedGroup == null)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Create Syncshell"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Create Syncshell"))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -70,13 +69,13 @@ public class CreateSyncshellUI : WindowMediatorSubscriberBase
|
||||
ImGui.TextUnformatted("Your current Syncshell preferred permissions are:");
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Animations");
|
||||
UiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupAnimations);
|
||||
_uiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupAnimations);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Sounds");
|
||||
UiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupSounds);
|
||||
_uiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupSounds);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- VFX");
|
||||
UiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupVFX);
|
||||
_uiSharedService.BooleanToColoredIcon(!_apiController.DefaultPermissions!.DisableGroupVFX);
|
||||
UiSharedService.TextWrapped("(Those preferred permissions can be changed anytime after Syncshell creation, your defaults can be changed anytime in the Mare Settings)");
|
||||
}
|
||||
else
|
||||
@@ -86,7 +85,7 @@ public class CreateSyncshellUI : WindowMediatorSubscriberBase
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Syncshell Password: " + _lastCreatedGroup.Password);
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Copy))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Copy))
|
||||
{
|
||||
ImGui.SetClipboardText(_lastCreatedGroup.Password);
|
||||
}
|
||||
@@ -96,13 +95,13 @@ public class CreateSyncshellUI : WindowMediatorSubscriberBase
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.TextWrapped("Suggest Animation sync:");
|
||||
UiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableAnimations());
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.TextWrapped("Suggest Sounds sync:");
|
||||
UiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableSounds());
|
||||
ImGui.AlignTextToFramePadding();
|
||||
UiSharedService.TextWrapped("Suggest VFX sync:");
|
||||
UiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_lastCreatedGroup.GroupUserPreferredPermissions.IsDisableVFX());
|
||||
}
|
||||
|
||||
if (_errorGroupCreate)
|
||||
|
||||
@@ -17,6 +17,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
private readonly CharacterAnalyzer _characterAnalyzer;
|
||||
private readonly Progress<(string, int)> _conversionProgress = new();
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private readonly Dictionary<string, string[]> _texturesToConvert = new(StringComparer.Ordinal);
|
||||
private Dictionary<ObjectKind, Dictionary<string, CharacterAnalyzer.FileDataEntry>>? _cachedAnalysis;
|
||||
private CancellationTokenSource _conversionCancellationTokenSource = new();
|
||||
@@ -31,11 +32,13 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
private ObjectKind _selectedObjectTab;
|
||||
private bool _showModal = false;
|
||||
|
||||
public DataAnalysisUi(ILogger<DataAnalysisUi> logger, MareMediator mediator, CharacterAnalyzer characterAnalyzer, IpcManager ipcManager, PerformanceCollectorService performanceCollectorService)
|
||||
public DataAnalysisUi(ILogger<DataAnalysisUi> logger, MareMediator mediator, CharacterAnalyzer characterAnalyzer, IpcManager ipcManager, PerformanceCollectorService performanceCollectorService,
|
||||
UiSharedService uiSharedService)
|
||||
: base(logger, mediator, "Mare Character Data Analysis", performanceCollectorService)
|
||||
{
|
||||
_characterAnalyzer = characterAnalyzer;
|
||||
_ipcManager = ipcManager;
|
||||
_uiSharedService = uiSharedService;
|
||||
Mediator.Subscribe<CharacterDataAnalyzedMessage>(this, (_) =>
|
||||
{
|
||||
_hasUpdate = true;
|
||||
@@ -66,7 +69,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.TextUnformatted("BC7 Conversion in progress: " + _conversionCurrentFileProgress + "/" + _texturesToConvert.Count);
|
||||
UiSharedService.TextWrapped("Current file: " + _conversionCurrentFileName);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StopCircle, "Cancel conversion"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StopCircle, "Cancel conversion"))
|
||||
{
|
||||
_conversionCancellationTokenSource.Cancel();
|
||||
}
|
||||
@@ -108,7 +111,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
UiSharedService.ColorTextWrapped($"Analyzing {_characterAnalyzer.CurrentFile}/{_characterAnalyzer.TotalFiles}",
|
||||
ImGuiColors.DalamudYellow);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StopCircle, "Cancel analysis"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StopCircle, "Cancel analysis"))
|
||||
{
|
||||
_characterAnalyzer.CancelAnalyze();
|
||||
}
|
||||
@@ -119,14 +122,14 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("Some entries in the analysis have file size not determined yet, press the button below to analyze your current data",
|
||||
ImGuiColors.DalamudYellow);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PlayCircle, "Start analysis (missing entries)"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Start analysis (missing entries)"))
|
||||
{
|
||||
_ = _characterAnalyzer.ComputeAnalysis(print: false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PlayCircle, "Start analysis (recalculate all entries)"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Start analysis (recalculate all entries)"))
|
||||
{
|
||||
_ = _characterAnalyzer.ComputeAnalysis(print: false, recalculate: true);
|
||||
}
|
||||
@@ -260,7 +263,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
Environment.NewLine + "- Conversion will convert all found texture duplicates (entries with more than 1 file path) automatically." +
|
||||
Environment.NewLine + "- Converting textures to BC7 is a very expensive operation and, depending on the amount of textures to convert, will take a while to complete."
|
||||
, ImGuiColors.DalamudYellow);
|
||||
if (_texturesToConvert.Count > 0 && UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PlayCircle, "Start conversion of " + _texturesToConvert.Count + " texture(s)"))
|
||||
if (_texturesToConvert.Count > 0 && UiSharedService.IconTextButton(FontAwesomeIcon.PlayCircle, "Start conversion of " + _texturesToConvert.Count + " texture(s)"))
|
||||
{
|
||||
_conversionCancellationTokenSource = _conversionCancellationTokenSource.CancelRecreate();
|
||||
_conversionTask = _ipcManager.Penumbra.ConvertTextureFiles(_logger, _texturesToConvert, _conversionProgress, _conversionCancellationTokenSource.Token);
|
||||
@@ -293,7 +296,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted($"(and {filePaths.Count - 1} more)");
|
||||
ImGui.SameLine();
|
||||
UiSharedService.FontText(FontAwesomeIcon.InfoCircle.ToIconString(), UiBuilder.IconFont);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
|
||||
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, filePaths.Skip(1)));
|
||||
}
|
||||
|
||||
@@ -306,7 +309,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted($"(and {gamepaths.Count - 1} more)");
|
||||
ImGui.SameLine();
|
||||
UiSharedService.FontText(FontAwesomeIcon.InfoCircle.ToIconString(), UiBuilder.IconFont);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
|
||||
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, gamepaths.Skip(1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
|
||||
try
|
||||
{
|
||||
if (_uiShared.UidFontBuilt && _configService.Current.ShowUploadingBigText) ImGui.PushFont(_uiShared.UidFont);
|
||||
using var _ = _uiShared.UidFont.Push();
|
||||
var uploadText = "Uploading";
|
||||
|
||||
var textSize = ImGui.CalcTextSize(uploadText);
|
||||
@@ -205,10 +205,6 @@ public class DownloadUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
// ignore errors thrown on UI
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_uiShared.UidFontBuilt && _configService.Current.ShowUploadingBigText) ImGui.PopFont();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class DrawEntityFactory
|
||||
private readonly MareMediator _mediator;
|
||||
private readonly SelectPairForTagUi _selectPairForTagUi;
|
||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly IdDisplayHandler _uidDisplayHandler;
|
||||
@@ -24,7 +25,7 @@ public class DrawEntityFactory
|
||||
public DrawEntityFactory(ILogger<DrawEntityFactory> logger, ApiController apiController, IdDisplayHandler uidDisplayHandler,
|
||||
SelectTagForPairUi selectTagForPairUi, MareMediator mediator,
|
||||
TagHandler tagHandler, SelectPairForTagUi selectPairForTagUi,
|
||||
ServerConfigurationManager serverConfigurationManager)
|
||||
ServerConfigurationManager serverConfigurationManager, UiSharedService uiSharedService)
|
||||
{
|
||||
_logger = logger;
|
||||
_apiController = apiController;
|
||||
@@ -34,6 +35,7 @@ public class DrawEntityFactory
|
||||
_tagHandler = tagHandler;
|
||||
_selectPairForTagUi = selectPairForTagUi;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public DrawFolderGroup CreateDrawGroupFolder(GroupFullInfoDto groupFullInfoDto,
|
||||
@@ -42,7 +44,7 @@ public class DrawEntityFactory
|
||||
{
|
||||
return new DrawFolderGroup(groupFullInfoDto.Group.GID, groupFullInfoDto, _apiController,
|
||||
filteredPairs.Select(p => CreateDrawPair(groupFullInfoDto.Group.GID + p.Key.UserData.UID, p.Key, p.Value, groupFullInfoDto)).ToImmutableList(),
|
||||
allPairs, _tagHandler, _uidDisplayHandler, _mediator);
|
||||
allPairs, _tagHandler, _uidDisplayHandler, _mediator, _uiSharedService);
|
||||
}
|
||||
|
||||
public DrawFolderTag CreateDrawTagFolder(string tag,
|
||||
@@ -50,12 +52,12 @@ public class DrawEntityFactory
|
||||
IImmutableList<Pair> allPairs)
|
||||
{
|
||||
return new(tag, filteredPairs.Select(u => CreateDrawPair(tag, u.Key, u.Value, null)).ToImmutableList(),
|
||||
allPairs, _tagHandler, _apiController, _selectPairForTagUi);
|
||||
allPairs, _tagHandler, _apiController, _selectPairForTagUi, _uiSharedService);
|
||||
}
|
||||
|
||||
public DrawUserPair CreateDrawPair(string id, Pair user, List<GroupFullInfoDto> groups, GroupFullInfoDto? currentGroup)
|
||||
{
|
||||
return new DrawUserPair(id + user.UserData.UID, user, groups, currentGroup, _apiController, _uidDisplayHandler,
|
||||
_mediator, _selectTagForPairUi, _serverConfigurationManager);
|
||||
_mediator, _selectTagForPairUi, _serverConfigurationManager, _uiSharedService);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.ImGuiFileDialog;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
@@ -93,7 +92,8 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
|
||||
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
||||
ImGuiHelpers.ScaledRelativeSameLine(256, spacing);
|
||||
ImGui.PushFont(_uiBuilder.GetGameFontHandle(new GameFontStyle(GameFontFamilyAndSize.Axis12)).ImFont);
|
||||
using (_uiSharedService.GameFont.Push())
|
||||
{
|
||||
var descriptionTextSize = ImGui.CalcTextSize(profile.Description, 256f);
|
||||
var childFrame = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 256);
|
||||
if (descriptionTextSize.Y > childFrame.Y)
|
||||
@@ -113,7 +113,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.TextWrapped(profile.Description);
|
||||
}
|
||||
ImGui.EndChildFrame();
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
var nsfw = profile.IsNSFW;
|
||||
ImGui.BeginDisabled();
|
||||
@@ -133,7 +133,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
ImGui.Separator();
|
||||
_uiSharedService.BigText("Profile Settings");
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FileUpload, "Upload new profile picture"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.FileUpload, "Upload new profile picture"))
|
||||
{
|
||||
_fileDialogManager.OpenFileDialog("Select new Profile picture", ".png", (success, file) =>
|
||||
{
|
||||
@@ -164,7 +164,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
UiSharedService.AttachToolTip("Select and upload a new profile picture");
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Clear uploaded profile picture"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear uploaded profile picture"))
|
||||
{
|
||||
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, "", Description: null));
|
||||
}
|
||||
@@ -178,20 +178,20 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, isNsfw, ProfilePictureBase64: null, Description: null));
|
||||
}
|
||||
UiSharedService.DrawHelpText("If your profile description or image can be considered NSFW, toggle this to ON");
|
||||
_uiSharedService.DrawHelpText("If your profile description or image can be considered NSFW, toggle this to ON");
|
||||
var widthTextBox = 400;
|
||||
var posX = ImGui.GetCursorPosX();
|
||||
ImGui.TextUnformatted($"Description {_descriptionText.Length}/1500");
|
||||
ImGui.SetCursorPosX(posX);
|
||||
ImGuiHelpers.ScaledRelativeSameLine(widthTextBox, ImGui.GetStyle().ItemSpacing.X);
|
||||
ImGui.TextUnformatted("Preview (approximate)");
|
||||
ImGui.PushFont(_uiBuilder.GetGameFontHandle(new GameFontStyle(GameFontFamilyAndSize.Axis12)).ImFont);
|
||||
using (_uiSharedService.GameFont.Push())
|
||||
ImGui.InputTextMultiline("##description", ref _descriptionText, 1500, ImGuiHelpers.ScaledVector2(widthTextBox, 200));
|
||||
ImGui.PopFont();
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGui.PushFont(_uiBuilder.GetGameFontHandle(new GameFontStyle(GameFontFamilyAndSize.Axis12)).ImFont);
|
||||
using (_uiSharedService.GameFont.Push())
|
||||
{
|
||||
var descriptionTextSizeLocal = ImGui.CalcTextSize(_descriptionText, 256f);
|
||||
var childFrameLocal = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 200);
|
||||
if (descriptionTextSizeLocal.Y > childFrameLocal.Y)
|
||||
@@ -211,15 +211,15 @@ public class EditProfileUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.TextWrapped(_descriptionText);
|
||||
}
|
||||
ImGui.EndChildFrame();
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Save, "Save Description"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Save, "Save Description"))
|
||||
{
|
||||
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, ProfilePictureBase64: null, _descriptionText));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Sets your profile description text");
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Clear Description"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear Description"))
|
||||
{
|
||||
_ = _apiController.UserSetProfile(new UserProfileDto(new UserData(_apiController.UID), Disabled: false, IsNSFW: null, ProfilePictureBase64: null, ""));
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ internal class EventViewerUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.Disabled(!_eventAggregator.NewEventsAvailable))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowsToCircle, "Refresh events"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowsToCircle, "Refresh events"))
|
||||
{
|
||||
CurrentEvents = _eventAggregator.EventList.Value.OrderByDescending(f => f.EventTime).ToList();
|
||||
}
|
||||
@@ -113,10 +113,10 @@ internal class EventViewerUI : WindowMediatorSubscriberBase
|
||||
UiSharedService.ColorTextWrapped("New events are available, press refresh to update", ImGuiColors.DalamudYellow);
|
||||
}
|
||||
|
||||
var buttonSize = UiSharedService.GetNormalizedIconTextButtonSize(FontAwesomeIcon.FolderOpen, "Open EventLog Folder");
|
||||
var dist = ImGui.GetWindowContentRegionMax().X - buttonSize.X;
|
||||
var buttonSize = UiSharedService.GetIconTextButtonSize(FontAwesomeIcon.FolderOpen, "Open EventLog Folder");
|
||||
var dist = ImGui.GetWindowContentRegionMax().X - buttonSize;
|
||||
ImGui.SameLine(dist);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FolderOpen, "Open EventLog folder"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.FolderOpen, "Open EventLog folder"))
|
||||
{
|
||||
ProcessStartInfo ps = new()
|
||||
{
|
||||
@@ -127,11 +127,11 @@ internal class EventViewerUI : WindowMediatorSubscriberBase
|
||||
Process.Start(ps);
|
||||
}
|
||||
|
||||
UiSharedService.FontText("Last Events", _uiSharedService.UidFont);
|
||||
_uiSharedService.BigText("Last Events");
|
||||
var foldOut = ImRaii.TreeNode("Filter");
|
||||
if (foldOut)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Ban, "Clear Filters"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Ban, "Clear Filters"))
|
||||
{
|
||||
ClearFilters();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ internal class EventViewerUI : WindowMediatorSubscriberBase
|
||||
};
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
UiSharedService.NormalizedIcon(icon, iconColor == new Vector4() ? null : iconColor);
|
||||
_uiSharedService.IconText(icon, iconColor == new Vector4() ? null : iconColor);
|
||||
UiSharedService.AttachToolTip(ev.EventSeverity.ToString());
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace MareSynchronos.UI;
|
||||
public class GposeUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
private readonly MareConfigService _configService;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private readonly DalamudUtilService _dalamudUtil;
|
||||
private readonly FileDialogManager _fileDialogManager;
|
||||
private readonly MareCharaFileManager _mareCharaFileManager;
|
||||
@@ -20,14 +21,15 @@ public class GposeUi : WindowMediatorSubscriberBase
|
||||
|
||||
public GposeUi(ILogger<GposeUi> logger, MareCharaFileManager mareCharaFileManager,
|
||||
DalamudUtilService dalamudUtil, FileDialogManager fileDialogManager, MareConfigService configService,
|
||||
MareMediator mediator, PerformanceCollectorService performanceCollectorService)
|
||||
MareMediator mediator, PerformanceCollectorService performanceCollectorService,
|
||||
UiSharedService uiSharedService)
|
||||
: base(logger, mediator, "Mare Synchronos Gpose Import UI###MareSynchronosGposeUI", performanceCollectorService)
|
||||
{
|
||||
_mareCharaFileManager = mareCharaFileManager;
|
||||
_dalamudUtil = dalamudUtil;
|
||||
_fileDialogManager = fileDialogManager;
|
||||
_configService = configService;
|
||||
|
||||
_uiSharedService = uiSharedService;
|
||||
Mediator.Subscribe<GposeStartMessage>(this, (_) => StartGpose());
|
||||
Mediator.Subscribe<GposeEndMessage>(this, (_) => EndGpose());
|
||||
IsOpen = _dalamudUtil.IsInGpose;
|
||||
@@ -44,7 +46,7 @@ public class GposeUi : WindowMediatorSubscriberBase
|
||||
|
||||
if (!_mareCharaFileManager.CurrentlyWorking)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FolderOpen, "Load MCDF"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.FolderOpen, "Load MCDF"))
|
||||
{
|
||||
_fileDialogManager.OpenFileDialog("Pick MCDF file", ".mcdf", (success, paths) =>
|
||||
{
|
||||
@@ -62,7 +64,7 @@ public class GposeUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
UiSharedService.TextWrapped("Loaded file: " + _mareCharaFileManager.LoadedCharaFile.FilePath);
|
||||
UiSharedService.TextWrapped("File Description: " + _mareCharaFileManager.LoadedCharaFile.CharaFileData.Description);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Apply loaded MCDF"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Apply loaded MCDF"))
|
||||
{
|
||||
_applicationTask = Task.Run(async () => await _mareCharaFileManager.ApplyMareCharaFile(_dalamudUtil.GposeTargetGameObject, _expectedLength!.GetAwaiter().GetResult()).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
@@ -91,10 +91,12 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
else if (!_configService.Current.AcceptedAgreement && _readFirstPage)
|
||||
{
|
||||
if (_uiShared.UidFontBuilt) ImGui.PushFont(_uiShared.UidFont);
|
||||
var textSize = ImGui.CalcTextSize(Strings.ToS.LanguageLabel);
|
||||
Vector2 textSize;
|
||||
using (_uiShared.UidFont.Push())
|
||||
{
|
||||
textSize = ImGui.CalcTextSize(Strings.ToS.LanguageLabel);
|
||||
ImGui.TextUnformatted(Strings.ToS.AgreementLabel);
|
||||
if (_uiShared.UidFontBuilt) ImGui.PopFont();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
var languageSize = ImGui.CalcTextSize(Strings.ToS.LanguageLabel);
|
||||
@@ -145,9 +147,9 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
|| !_configService.Current.InitialScanComplete
|
||||
|| !Directory.Exists(_configService.Current.CacheFolder)))
|
||||
{
|
||||
if (_uiShared.UidFontBuilt) ImGui.PushFont(_uiShared.UidFont);
|
||||
using (_uiShared.UidFont.Push())
|
||||
ImGui.TextUnformatted("File Storage Setup");
|
||||
if (_uiShared.UidFontBuilt) ImGui.PopFont();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (!_uiShared.HasValidPenumbraModPath)
|
||||
@@ -191,9 +193,8 @@ public class IntroUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
else if (!_uiShared.ApiController.ServerAlive)
|
||||
{
|
||||
if (_uiShared.UidFontBuilt) ImGui.PushFont(_uiShared.UidFont);
|
||||
using (_uiShared.UidFont.Push())
|
||||
ImGui.TextUnformatted("Service Registration");
|
||||
if (_uiShared.UidFontBuilt) ImGui.PopFont();
|
||||
ImGui.Separator();
|
||||
UiSharedService.TextWrapped("To be able to use Mare Synchronos you will have to register an account.");
|
||||
UiSharedService.TextWrapped("For the official Mare Synchronos Servers the account creation will be handled on the official Mare Synchronos Discord. Due to security risks for the server, there is no way to handle this senisibly otherwise.");
|
||||
|
||||
@@ -52,7 +52,7 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
|
||||
protected override void DrawInternal()
|
||||
{
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
ImGui.TextUnformatted(_groupJoinInfo == null || !_groupJoinInfo.Success ? "Join Syncshell" : "Finalize join Syncshell " + _groupJoinInfo.GroupAliasOrGID);
|
||||
ImGui.Separator();
|
||||
|
||||
@@ -76,7 +76,7 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
ImGui.InputTextWithHint("##syncshellpw", "Password", ref _syncshellPassword, 50, ImGuiInputTextFlags.Password);
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_desiredSyncshellToJoin) || string.IsNullOrEmpty(_syncshellPassword)))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Join Syncshell"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Join Syncshell"))
|
||||
{
|
||||
_groupJoinInfo = _apiController.GroupJoin(new GroupPasswordDto(new API.Data.GroupData(_desiredSyncshellToJoin), _syncshellPassword)).Result;
|
||||
_previousPassword = _syncshellPassword;
|
||||
@@ -98,13 +98,13 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
ImGui.TextUnformatted("This Syncshell staff has set the following suggested Syncshell permissions:");
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Sounds ");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Animations");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- VFX");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
||||
|
||||
if (_groupJoinInfo.GroupPermissions.IsPreferDisableSounds() != _ownPermissions.DisableGroupSounds
|
||||
|| _groupJoinInfo.GroupPermissions.IsPreferDisableVFX() != _ownPermissions.DisableGroupVFX
|
||||
@@ -116,14 +116,14 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Sounds");
|
||||
UiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupSounds);
|
||||
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupSounds);
|
||||
ImGui.SameLine(200);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Suggested");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableSounds());
|
||||
ImGui.SameLine();
|
||||
using var id = ImRaii.PushId("suggestedSounds");
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
{
|
||||
_ownPermissions.DisableGroupSounds = _groupJoinInfo.GroupPermissions.IsPreferDisableSounds();
|
||||
}
|
||||
@@ -132,14 +132,14 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- Animations");
|
||||
UiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupAnimations);
|
||||
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupAnimations);
|
||||
ImGui.SameLine(200);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Suggested");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableAnimations());
|
||||
ImGui.SameLine();
|
||||
using var id = ImRaii.PushId("suggestedAnims");
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
{
|
||||
_ownPermissions.DisableGroupAnimations = _groupJoinInfo.GroupPermissions.IsPreferDisableAnimations();
|
||||
}
|
||||
@@ -148,14 +148,14 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("- VFX");
|
||||
UiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupVFX);
|
||||
_uiSharedService.BooleanToColoredIcon(!_ownPermissions.DisableGroupVFX);
|
||||
ImGui.SameLine(200);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Suggested");
|
||||
UiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
||||
_uiSharedService.BooleanToColoredIcon(!_groupJoinInfo.GroupPermissions.IsPreferDisableVFX());
|
||||
ImGui.SameLine();
|
||||
using var id = ImRaii.PushId("suggestedVfx");
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowRight, "Apply suggested"))
|
||||
{
|
||||
_ownPermissions.DisableGroupVFX = _groupJoinInfo.GroupPermissions.IsPreferDisableVFX();
|
||||
}
|
||||
@@ -167,7 +167,7 @@ internal class JoinSyncshellUI : WindowMediatorSubscriberBase
|
||||
UiSharedService.TextWrapped("Your default syncshell permissions on joining are in line with the suggested Syncshell permissions through the owner.");
|
||||
}
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Finalize and join " + _groupJoinInfo.GroupAliasOrGID))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Finalize and join " + _groupJoinInfo.GroupAliasOrGID))
|
||||
{
|
||||
GroupUserPreferredPermissions joinPermissions = GroupUserPreferredPermissions.NoneSet;
|
||||
joinPermissions.SetDisableSounds(_ownPermissions.DisableGroupSounds);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetSticky(sticky);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Preferred Permissions, when enabled, will exclude this user from any permission changes on any syncshells you share with this user.");
|
||||
_uiSharedService.DrawHelpText("Preferred Permissions, when enabled, will exclude this user from any permission changes on any syncshells you share with this user.");
|
||||
|
||||
ImGuiHelpers.ScaledDummy(1f);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetPaused(paused);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Pausing will completely cease any sync with this user." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Pausing will completely cease any sync with this user." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user pausing will cease sync completely.");
|
||||
var otherPerms = Pair.UserPair.OtherPermissions;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
UiSharedService.BooleanToColoredIcon(!otherIsPaused, false);
|
||||
_uiSharedService.BooleanToColoredIcon(!otherIsPaused, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(Pair.UserData.AliasOrUID + " has " + (!otherIsPaused ? "not " : string.Empty) + "paused you");
|
||||
@@ -88,11 +88,11 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetDisableSounds(disableSounds);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Disabling sounds will remove all sounds synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all sounds synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling sound sync will stop sound sync on both sides.");
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
UiSharedService.BooleanToColoredIcon(!otherDisableSounds, false);
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableSounds, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(Pair.UserData.AliasOrUID + " has " + (!otherDisableSounds ? "not " : string.Empty) + "disabled sound sync with you");
|
||||
@@ -102,11 +102,11 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetDisableAnimations(disableAnimations);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Disabling sounds will remove all animations synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all animations synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling animation sync will stop animation sync on both sides.");
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
UiSharedService.BooleanToColoredIcon(!otherDisableAnimations, false);
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableAnimations, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(Pair.UserData.AliasOrUID + " has " + (!otherDisableAnimations ? "not " : string.Empty) + "disabled animation sync with you");
|
||||
@@ -116,11 +116,11 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetDisableVFX(disableVfx);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Disabling sounds will remove all VFX synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all VFX synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling VFX sync will stop VFX sync on both sides.");
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
UiSharedService.BooleanToColoredIcon(!otherDisableVFX, false);
|
||||
_uiSharedService.BooleanToColoredIcon(!otherDisableVFX, false);
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(Pair.UserData.AliasOrUID + " has " + (!otherDisableVFX ? "not " : string.Empty) + "disabled VFX sync with you");
|
||||
@@ -133,7 +133,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
bool hasChanges = _ownPermissions != Pair.UserPair.OwnPermissions;
|
||||
|
||||
using (ImRaii.Disabled(!hasChanges))
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.Save, "Save"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Save, "Save"))
|
||||
{
|
||||
_ = _apiController.SetBulkPermissions(new(
|
||||
new(StringComparer.Ordinal)
|
||||
@@ -145,21 +145,21 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
}
|
||||
UiSharedService.AttachToolTip("Save and apply all changes");
|
||||
|
||||
var rightSideButtons = UiSharedService.GetNormalizedIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert").X +
|
||||
UiSharedService.GetNormalizedIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default").X;
|
||||
var rightSideButtons = UiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert") +
|
||||
UiSharedService.GetIconTextButtonSize(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default");
|
||||
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
|
||||
ImGui.SameLine(availableWidth - rightSideButtons);
|
||||
|
||||
using (ImRaii.Disabled(!hasChanges))
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Undo, "Revert"))
|
||||
{
|
||||
_ownPermissions = Pair.UserPair.OwnPermissions.DeepClone();
|
||||
}
|
||||
UiSharedService.AttachToolTip("Revert all changes");
|
||||
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default"))
|
||||
if (UiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.ArrowsSpin, "Reset to Default"))
|
||||
{
|
||||
var defaultPermissions = _apiController.DefaultPermissions!;
|
||||
_ownPermissions.SetSticky(Pair.IsDirectlyPaired || defaultPermissions.IndividualIsSticky);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Dalamud.Interface.Internal;
|
||||
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
@@ -111,7 +110,7 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
|
||||
var rectMin = drawList.GetClipRectMin();
|
||||
var rectMax = drawList.GetClipRectMax();
|
||||
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont, _uiSharedService.UidFontBuilt))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
UiSharedService.ColorText(_pair.UserData.AliasOrUID, ImGuiColors.HealerGreen);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(spacing.Y, spacing.Y);
|
||||
@@ -158,7 +157,7 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.PushFont(_uiSharedService.GetGameFontHandle());
|
||||
var font = _uiSharedService.GameFont.Push();
|
||||
var remaining = ImGui.GetWindowContentRegionMax().Y - ImGui.GetCursorPosY();
|
||||
var descText = mareProfile.Description;
|
||||
var textSize = ImGui.CalcTextSize(descText, 256f * ImGuiHelpers.GlobalScale);
|
||||
@@ -169,7 +168,7 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
|
||||
textSize = ImGui.CalcTextSize(descText + $"...{Environment.NewLine}[Open Full Profile for complete description]", 256f * ImGuiHelpers.GlobalScale);
|
||||
}
|
||||
UiSharedService.TextWrapped(trimmed ? descText + $"...{Environment.NewLine}[Open Full Profile for complete description]" : mareProfile.Description);
|
||||
ImGui.PopFont();
|
||||
font.Dispose();
|
||||
|
||||
var padding = ImGui.GetStyle().WindowPadding.X / 2;
|
||||
bool tallerThanWide = _textureWrap.Height >= _textureWrap.Width;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
private void DrawCurrentTransfers()
|
||||
{
|
||||
_lastTab = "Transfers";
|
||||
UiSharedService.FontText("Transfer Settings", _uiShared.UidFont);
|
||||
_uiShared.BigText("Transfer Settings");
|
||||
|
||||
int maxParallelDownloads = _configService.Current.ParallelDownloads;
|
||||
bool useAlternativeUpload = _configService.Current.UseAlternativeFileUpload;
|
||||
@@ -204,10 +204,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.UseAlternativeFileUpload = useAlternativeUpload;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will attempt to upload files in one go instead of a stream. Typically not necessary to enable. Use if you have upload issues.");
|
||||
_uiShared.DrawHelpText("This will attempt to upload files in one go instead of a stream. Typically not necessary to enable. Use if you have upload issues.");
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.FontText("Transfer UI", _uiShared.UidFont);
|
||||
_uiShared.BigText("Transfer UI");
|
||||
|
||||
bool showTransferWindow = _configService.Current.ShowTransferWindow;
|
||||
if (ImGui.Checkbox("Show separate transfer window", ref showTransferWindow))
|
||||
@@ -215,7 +215,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ShowTransferWindow = showTransferWindow;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText($"The download window will show the current progress of outstanding downloads.{Environment.NewLine}{Environment.NewLine}" +
|
||||
_uiShared.DrawHelpText($"The download window will show the current progress of outstanding downloads.{Environment.NewLine}{Environment.NewLine}" +
|
||||
$"What do W/Q/P/D stand for?{Environment.NewLine}W = Waiting for Slot (see Maximum Parallel Downloads){Environment.NewLine}" +
|
||||
$"Q = Queued on Server, waiting for queue ready signal{Environment.NewLine}" +
|
||||
$"P = Processing download (aka downloading){Environment.NewLine}" +
|
||||
@@ -236,7 +236,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ShowTransferBars = showTransferBars;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will render a progress bar during the download at the feet of the player you are downloading from.");
|
||||
_uiShared.DrawHelpText("This will render a progress bar during the download at the feet of the player you are downloading from.");
|
||||
|
||||
if (!showTransferBars) ImGui.BeginDisabled();
|
||||
ImGui.Indent();
|
||||
@@ -246,28 +246,28 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.TransferBarsShowText = transferBarShowText;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars");
|
||||
_uiShared.DrawHelpText("Shows download text (amount of MiB downloaded) in the transfer bars");
|
||||
int transferBarWidth = _configService.Current.TransferBarsWidth;
|
||||
if (ImGui.SliderInt("Transfer Bar Width", ref transferBarWidth, 10, 500))
|
||||
{
|
||||
_configService.Current.TransferBarsWidth = transferBarWidth;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)");
|
||||
_uiShared.DrawHelpText("Width of the displayed transfer bars (will never be less wide than the displayed text)");
|
||||
int transferBarHeight = _configService.Current.TransferBarsHeight;
|
||||
if (ImGui.SliderInt("Transfer Bar Height", ref transferBarHeight, 2, 50))
|
||||
{
|
||||
_configService.Current.TransferBarsHeight = transferBarHeight;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Height of the displayed transfer bars (will never be less tall than the displayed text)");
|
||||
_uiShared.DrawHelpText("Height of the displayed transfer bars (will never be less tall than the displayed text)");
|
||||
bool showUploading = _configService.Current.ShowUploading;
|
||||
if (ImGui.Checkbox("Show 'Uploading' text below players that are currently uploading", ref showUploading))
|
||||
{
|
||||
_configService.Current.ShowUploading = showUploading;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will render an 'Uploading' text at the feet of the player that is in progress of uploading data.");
|
||||
_uiShared.DrawHelpText("This will render an 'Uploading' text at the feet of the player that is in progress of uploading data.");
|
||||
|
||||
ImGui.Unindent();
|
||||
if (!showUploading) ImGui.BeginDisabled();
|
||||
@@ -278,7 +278,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ShowUploadingBigText = showUploadingBigText;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will render an 'Uploading' text in a larger font.");
|
||||
_uiShared.DrawHelpText("This will render an 'Uploading' text in a larger font.");
|
||||
|
||||
ImGui.Unindent();
|
||||
|
||||
@@ -286,7 +286,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
if (!showTransferBars) ImGui.EndDisabled();
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.FontText("Current Transfers", _uiShared.UidFont);
|
||||
_uiShared.BigText("Current Transfers");
|
||||
|
||||
if (ImGui.BeginTabBar("TransfersTabBar"))
|
||||
{
|
||||
@@ -366,7 +366,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_lastTab = "Debug";
|
||||
|
||||
UiSharedService.FontText("Debug", _uiShared.UidFont);
|
||||
_uiShared.BigText("Debug");
|
||||
#if DEBUG
|
||||
if (LastCreatedCharacterData != null && ImGui.TreeNode("Last created character data"))
|
||||
{
|
||||
@@ -378,7 +378,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.TreePop();
|
||||
}
|
||||
#endif
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Copy, "[DEBUG] Copy Last created Character Data to clipboard"))
|
||||
{
|
||||
if (LastCreatedCharacterData != null)
|
||||
{
|
||||
@@ -403,15 +403,15 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.LogPerformance = logPerformance;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended.");
|
||||
_uiShared.DrawHelpText("Enabling this can incur a (slight) performance impact. Enabling this for extended periods of time is not recommended.");
|
||||
|
||||
using var disabled = ImRaii.Disabled(!logPerformance);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats to /xllog"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats to /xllog"))
|
||||
{
|
||||
_performanceCollector.PrintPerformanceStats();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats (last 60s) to /xllog"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Print Performance Stats (last 60s) to /xllog"))
|
||||
{
|
||||
_performanceCollector.PrintPerformanceStats(60);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_lastTab = "FileCache";
|
||||
|
||||
UiSharedService.FontText("Export MCDF", _uiShared.UidFont);
|
||||
_uiShared.BigText("Export MCDF");
|
||||
|
||||
UiSharedService.TextWrapped("This feature allows you to pack your character into a MCDF file and manually send it to other people. MCDF files can officially only be imported during GPose through Mare. " +
|
||||
"Be aware that the possibility exists that people write unofficial custom exporters to extract the containing data.");
|
||||
@@ -437,7 +437,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
if (!_mareCharaFileManager.CurrentlyWorking)
|
||||
{
|
||||
ImGui.InputTextWithHint("Export Descriptor", "This description will be shown on loading the data", ref _exportDescription, 255);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Save, "Export Character as MCDF"))
|
||||
{
|
||||
string defaultFileName = string.IsNullOrEmpty(_exportDescription)
|
||||
? "export.mcdf"
|
||||
@@ -478,11 +478,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.OpenGposeImportOnGposeStart = openInGpose;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /mare gpose");
|
||||
_uiShared.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /mare gpose");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
UiSharedService.FontText("Storage", _uiShared.UidFont);
|
||||
_uiShared.BigText("Storage");
|
||||
|
||||
UiSharedService.TextWrapped("Mare stores downloaded files from paired people permanently. This is to improve loading performance and requiring less downloads. " +
|
||||
"The storage governs itself by clearing data beyond the set storage size. Please set the storage size accordingly. It is not necessary to manually clear the storage.");
|
||||
@@ -494,7 +494,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.SameLine();
|
||||
using var id = ImRaii.PushId("penumbraMonitor");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
|
||||
{
|
||||
_cacheMonitor.StartPenumbraWatcher(_ipcManager.Penumbra.ModDirectory);
|
||||
}
|
||||
@@ -506,14 +506,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.SameLine();
|
||||
using var id = ImRaii.PushId("mareMonitor");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.ArrowsToCircle, "Try to reinitialize Monitor"))
|
||||
{
|
||||
_cacheMonitor.StartMareWatcher(_configService.Current.CacheFolder);
|
||||
}
|
||||
}
|
||||
if (_cacheMonitor.MareWatcher == null || _cacheMonitor.PenumbraWatcher == null)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Play, "Resume Monitoring"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Play, "Resume Monitoring"))
|
||||
{
|
||||
_cacheMonitor.StartMareWatcher(_configService.Current.CacheFolder);
|
||||
_cacheMonitor.StartPenumbraWatcher(_ipcManager.Penumbra.ModDirectory);
|
||||
@@ -527,7 +527,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Stop, "Stop Monitoring"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Stop, "Stop Monitoring"))
|
||||
{
|
||||
_cacheMonitor.StopMonitoring();
|
||||
}
|
||||
@@ -557,12 +557,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.UseCompactor = useFileCompactor;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("The file compactor can massively reduce your saved files. It might incur a minor penalty on loading files on a slow CPU." + Environment.NewLine
|
||||
_uiShared.DrawHelpText("The file compactor can massively reduce your saved files. It might incur a minor penalty on loading files on a slow CPU." + Environment.NewLine
|
||||
+ "It is recommended to leave it enabled to save on space.");
|
||||
ImGui.SameLine();
|
||||
if (!_fileCompactor.MassCompactRunning)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FileArchive, "Compact all files in storage"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.FileArchive, "Compact all files in storage"))
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
@@ -573,12 +573,11 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.AttachToolTip("This will run compression on all files in your current Mare Storage." + Environment.NewLine
|
||||
+ "You do not need to run this manually if you keep the file compactor enabled.");
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.File, "Decompact all files in storage"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.File, "Decompact all files in storage"))
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
_fileCompactor.CompactStorage(compress: false);
|
||||
CancellationTokenSource cts = new();
|
||||
_cacheMonitor.RecalculateFileCacheSize(CancellationToken.None);
|
||||
});
|
||||
}
|
||||
@@ -601,7 +600,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
"This operation, depending on how many files you have in your storage, can take a while and will be CPU and drive intensive.");
|
||||
using (ImRaii.Disabled(_validationTask != null && !_validationTask.IsCompleted))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Start File Storage Validation"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Start File Storage Validation"))
|
||||
{
|
||||
_validationCts?.Cancel();
|
||||
_validationCts?.Dispose();
|
||||
@@ -613,7 +612,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
if (_validationTask != null && !_validationTask.IsCompleted)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Times, "Cancel"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Times, "Cancel"))
|
||||
{
|
||||
_validationCts?.Cancel();
|
||||
}
|
||||
@@ -647,7 +646,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
+ Environment.NewLine + "- This can make the situation of not getting other players data worse in situations of heavy file server load.");
|
||||
if (!_readClearCache)
|
||||
ImGui.BeginDisabled();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Clear local storage") && UiSharedService.CtrlPressed() && _readClearCache)
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Clear local storage") && UiSharedService.CtrlPressed() && _readClearCache)
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
@@ -677,12 +676,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
//UiSharedService.FontText("Experimental", _uiShared.UidFont);
|
||||
//ImGui.Separator();
|
||||
|
||||
UiSharedService.FontText("Notes", _uiShared.UidFont);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.StickyNote, "Export all your user notes to clipboard"))
|
||||
_uiShared.BigText("Notes");
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.StickyNote, "Export all your user notes to clipboard"))
|
||||
{
|
||||
ImGui.SetClipboardText(UiSharedService.GetNotes(_pairManager.DirectPairs.UnionBy(_pairManager.GroupPairs.SelectMany(p => p.Value), p => p.UserData, UserDataComparer.Instance).ToList()));
|
||||
}
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.FileImport, "Import notes from clipboard"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.FileImport, "Import notes from clipboard"))
|
||||
{
|
||||
_notesSuccessfullyApplied = null;
|
||||
var notes = ImGui.GetClipboardText();
|
||||
@@ -691,7 +690,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.Checkbox("Overwrite existing notes", ref _overwriteExistingLabels);
|
||||
UiSharedService.DrawHelpText("If this option is selected all already existing notes for UIDs will be overwritten by the imported notes.");
|
||||
_uiShared.DrawHelpText("If this option is selected all already existing notes for UIDs will be overwritten by the imported notes.");
|
||||
if (_notesSuccessfullyApplied.HasValue && _notesSuccessfullyApplied.Value)
|
||||
{
|
||||
UiSharedService.ColorTextWrapped("User Notes successfully imported", ImGuiColors.HealerGreen);
|
||||
@@ -708,10 +707,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.OpenPopupOnAdd = openPopupOnAddition;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will open a popup that allows you to set the notes for a user after successfully adding them to your individual pairs.");
|
||||
_uiShared.DrawHelpText("This will open a popup that allows you to set the notes for a user after successfully adding them to your individual pairs.");
|
||||
|
||||
ImGui.Separator();
|
||||
UiSharedService.FontText("UI", _uiShared.UidFont);
|
||||
_uiShared.BigText("UI");
|
||||
var showNameInsteadOfNotes = _configService.Current.ShowCharacterNameInsteadOfNotesForVisible;
|
||||
var showVisibleSeparate = _configService.Current.ShowVisibleUsersSeparately;
|
||||
var showOfflineSeparate = _configService.Current.ShowOfflineUsersSeparately;
|
||||
@@ -733,14 +732,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.EnableRightClickMenus = enableRightClickMenu;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will add Mare related right click menu entries in the game UI on paired players.");
|
||||
_uiShared.DrawHelpText("This will add Mare related right click menu entries in the game UI on paired players.");
|
||||
|
||||
if (ImGui.Checkbox("Display status and visible pair count in Server Info Bar", ref enableDtrEntry))
|
||||
{
|
||||
_configService.Current.EnableDtrEntry = enableDtrEntry;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will add Mare connection status and visible pair count in the Server Info Bar.\nYou can further configure this through your Dalamud Settings.");
|
||||
_uiShared.DrawHelpText("This will add Mare connection status and visible pair count in the Server Info Bar.\nYou can further configure this through your Dalamud Settings.");
|
||||
|
||||
using (ImRaii.Disabled(!enableDtrEntry))
|
||||
{
|
||||
@@ -764,7 +763,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will show all currently visible users in a special 'Visible' group in the main UI.");
|
||||
_uiShared.DrawHelpText("This will show all currently visible users in a special 'Visible' group in the main UI.");
|
||||
|
||||
using (ImRaii.Disabled(!showVisibleSeparate))
|
||||
{
|
||||
@@ -783,7 +782,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
|
||||
_uiShared.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
|
||||
|
||||
using (ImRaii.Disabled(!showOfflineSeparate))
|
||||
{
|
||||
@@ -802,7 +801,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will group up all Syncshells in a special 'All Syncshells' folder in the main UI.");
|
||||
_uiShared.DrawHelpText("This will group up all Syncshells in a special 'All Syncshells' folder in the main UI.");
|
||||
|
||||
if (ImGui.Checkbox("Show player name for visible players", ref showNameInsteadOfNotes))
|
||||
{
|
||||
@@ -810,7 +809,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will show the character name instead of custom set note when a character is visible");
|
||||
_uiShared.DrawHelpText("This will show the character name instead of custom set note when a character is visible");
|
||||
|
||||
ImGui.Indent();
|
||||
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.BeginDisabled();
|
||||
@@ -820,7 +819,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
UiSharedService.DrawHelpText("If you set a note for a player it will be shown instead of the player name");
|
||||
_uiShared.DrawHelpText("If you set a note for a player it will be shown instead of the player name");
|
||||
if (!_configService.Current.ShowCharacterNameInsteadOfNotesForVisible) ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
|
||||
@@ -830,7 +829,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ProfilesShow = showProfiles;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will show the configured user profile after a set delay");
|
||||
_uiShared.DrawHelpText("This will show the configured user profile after a set delay");
|
||||
ImGui.Indent();
|
||||
if (!showProfiles) ImGui.BeginDisabled();
|
||||
if (ImGui.Checkbox("Popout profiles on the right", ref profileOnRight))
|
||||
@@ -839,13 +838,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Save();
|
||||
Mediator.Publish(new CompactUiChange(Vector2.Zero, Vector2.Zero));
|
||||
}
|
||||
UiSharedService.DrawHelpText("Will show profiles on the right side of the main UI");
|
||||
_uiShared.DrawHelpText("Will show profiles on the right side of the main UI");
|
||||
if (ImGui.SliderFloat("Hover Delay", ref profileDelay, 1, 10))
|
||||
{
|
||||
_configService.Current.ProfileDelay = profileDelay;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Delay until the profile should be displayed");
|
||||
_uiShared.DrawHelpText("Delay until the profile should be displayed");
|
||||
if (!showProfiles) ImGui.EndDisabled();
|
||||
ImGui.Unindent();
|
||||
if (ImGui.Checkbox("Show profiles marked as NSFW", ref showNsfwProfiles))
|
||||
@@ -854,7 +853,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ProfilesAllowNsfw = showNsfwProfiles;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Will show profiles that have the NSFW tag enabled");
|
||||
_uiShared.DrawHelpText("Will show profiles that have the NSFW tag enabled");
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
@@ -862,7 +861,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
var onlineNotifs = _configService.Current.ShowOnlineNotifications;
|
||||
var onlineNotifsPairsOnly = _configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs;
|
||||
var onlineNotifsNamedOnly = _configService.Current.ShowOnlineNotificationsOnlyForNamedPairs;
|
||||
UiSharedService.FontText("Notifications", _uiShared.UidFont);
|
||||
_uiShared.BigText("Notifications");
|
||||
|
||||
_uiShared.DrawCombo("Info Notification Display##settingsUi", (NotificationLocation[])Enum.GetValues(typeof(NotificationLocation)), (i) => i.ToString(),
|
||||
(i) =>
|
||||
@@ -870,7 +869,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.InfoNotification = i;
|
||||
_configService.Save();
|
||||
}, _configService.Current.InfoNotification);
|
||||
UiSharedService.DrawHelpText("The location where \"Info\" notifications will display."
|
||||
_uiShared.DrawHelpText("The location where \"Info\" notifications will display."
|
||||
+ Environment.NewLine + "'Nowhere' will not show any Info notifications"
|
||||
+ Environment.NewLine + "'Chat' will print Info notifications in chat"
|
||||
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
|
||||
@@ -882,7 +881,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.WarningNotification = i;
|
||||
_configService.Save();
|
||||
}, _configService.Current.WarningNotification);
|
||||
UiSharedService.DrawHelpText("The location where \"Warning\" notifications will display."
|
||||
_uiShared.DrawHelpText("The location where \"Warning\" notifications will display."
|
||||
+ Environment.NewLine + "'Nowhere' will not show any Warning notifications"
|
||||
+ Environment.NewLine + "'Chat' will print Warning notifications in chat"
|
||||
+ Environment.NewLine + "'Toast' will show Warning toast notifications in the bottom right corner"
|
||||
@@ -894,7 +893,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ErrorNotification = i;
|
||||
_configService.Save();
|
||||
}, _configService.Current.ErrorNotification);
|
||||
UiSharedService.DrawHelpText("The location where \"Error\" notifications will display."
|
||||
_uiShared.DrawHelpText("The location where \"Error\" notifications will display."
|
||||
+ Environment.NewLine + "'Nowhere' will not show any Error notifications"
|
||||
+ Environment.NewLine + "'Chat' will print Error notifications in chat"
|
||||
+ Environment.NewLine + "'Toast' will show Error toast notifications in the bottom right corner"
|
||||
@@ -905,13 +904,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.DisableOptionalPluginWarnings = disableOptionalPluginWarnings;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Enabling this will not show any \"Warning\" labeled messages for missing optional plugins.");
|
||||
_uiShared.DrawHelpText("Enabling this will not show any \"Warning\" labeled messages for missing optional plugins.");
|
||||
if (ImGui.Checkbox("Enable online notifications", ref onlineNotifs))
|
||||
{
|
||||
_configService.Current.ShowOnlineNotifications = onlineNotifs;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Enabling this will show a small notification (type: Info) in the bottom right corner when pairs go online.");
|
||||
_uiShared.DrawHelpText("Enabling this will show a small notification (type: Info) in the bottom right corner when pairs go online.");
|
||||
|
||||
using var disabled = ImRaii.Disabled(!onlineNotifs);
|
||||
if (ImGui.Checkbox("Notify only for individual pairs", ref onlineNotifsPairsOnly))
|
||||
@@ -919,13 +918,13 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_configService.Current.ShowOnlineNotificationsOnlyForIndividualPairs = onlineNotifsPairsOnly;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs.");
|
||||
_uiShared.DrawHelpText("Enabling this will only show online notifications (type: Info) for individual pairs.");
|
||||
if (ImGui.Checkbox("Notify only for named pairs", ref onlineNotifsNamedOnly))
|
||||
{
|
||||
_configService.Current.ShowOnlineNotificationsOnlyForNamedPairs = onlineNotifsNamedOnly;
|
||||
_configService.Save();
|
||||
}
|
||||
UiSharedService.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note.");
|
||||
_uiShared.DrawHelpText("Enabling this will only show online notifications (type: Info) for pairs where you have set an individual note.");
|
||||
}
|
||||
|
||||
private void DrawServerConfiguration()
|
||||
@@ -933,7 +932,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
_lastTab = "Service Settings";
|
||||
if (ApiController.ServerAlive)
|
||||
{
|
||||
UiSharedService.FontText("Service Actions", _uiShared.UidFont);
|
||||
_uiShared.BigText("Service Actions");
|
||||
ImGuiHelpers.ScaledDummy(new Vector2(5, 5));
|
||||
if (ImGui.Button("Delete all my files"))
|
||||
{
|
||||
@@ -941,7 +940,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.OpenPopup("Delete all your files?");
|
||||
}
|
||||
|
||||
UiSharedService.DrawHelpText("Completely deletes all your uploaded files on the service.");
|
||||
_uiShared.DrawHelpText("Completely deletes all your uploaded files on the service.");
|
||||
|
||||
if (ImGui.BeginPopupModal("Delete all your files?", ref _deleteFilesPopupModalShown, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
@@ -977,7 +976,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.OpenPopup("Delete your account?");
|
||||
}
|
||||
|
||||
UiSharedService.DrawHelpText("Completely deletes your account and all uploaded files to the service.");
|
||||
_uiShared.DrawHelpText("Completely deletes your account and all uploaded files to the service.");
|
||||
|
||||
if (ImGui.BeginPopupModal("Delete your account?", ref _deleteAccountPopupModalShown, UiSharedService.PopupWindowFlags))
|
||||
{
|
||||
@@ -1011,14 +1010,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
UiSharedService.FontText("Service & Character Settings", _uiShared.UidFont);
|
||||
_uiShared.BigText("Service & Character Settings");
|
||||
ImGuiHelpers.ScaledDummy(new Vector2(5, 5));
|
||||
var sendCensus = _serverConfigurationManager.SendCensusData;
|
||||
if (ImGui.Checkbox("Send Statistical Census Data", ref sendCensus))
|
||||
{
|
||||
_serverConfigurationManager.SendCensusData = sendCensus;
|
||||
}
|
||||
UiSharedService.DrawHelpText("This will allow sending census data to the currently connected service." + UiSharedService.TooltipSeparator
|
||||
_uiShared.DrawHelpText("This will allow sending census data to the currently connected service." + UiSharedService.TooltipSeparator
|
||||
+ "Census data contains:" + Environment.NewLine
|
||||
+ "- Current World" + Environment.NewLine
|
||||
+ "- Current Gender" + Environment.NewLine
|
||||
@@ -1095,7 +1094,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}, EqualityComparer<KeyValuePair<int, SecretKey>>.Default.Equals(keys.FirstOrDefault(f => f.Key == item.SecretKeyIdx), default) ? keys.First() : keys.First(f => f.Key == item.SecretKeyIdx));
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Character") && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Character") && UiSharedService.CtrlPressed())
|
||||
_serverConfigurationManager.RemoveCharacterFromServer(idx, item);
|
||||
UiSharedService.AttachToolTip("Hold CTRL to delete this entry.");
|
||||
|
||||
@@ -1109,14 +1108,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
if (!selectedServer.Authentications.Exists(c => string.Equals(c.CharacterName, _uiShared.PlayerName, StringComparison.Ordinal)
|
||||
&& c.WorldId == _uiShared.WorldId))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.User, "Add current character"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.User, "Add current character"))
|
||||
{
|
||||
_serverConfigurationManager.AddCurrentCharacterToServer(idx);
|
||||
}
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add new character"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add new character"))
|
||||
{
|
||||
_serverConfigurationManager.AddEmptyCharacterToServer(idx);
|
||||
}
|
||||
@@ -1148,7 +1147,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
if (!selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed())
|
||||
{
|
||||
selectedServer.SecretKeys.Remove(item.Key);
|
||||
_serverConfigurationManager.Save();
|
||||
@@ -1165,7 +1164,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add new Secret Key"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Add new Secret Key"))
|
||||
{
|
||||
selectedServer.SecretKeys.Add(selectedServer.SecretKeys.Any() ? selectedServer.SecretKeys.Max(p => p.Key) + 1 : 0, new SecretKey()
|
||||
{
|
||||
@@ -1190,7 +1189,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
if (isMain)
|
||||
{
|
||||
UiSharedService.DrawHelpText("You cannot edit the URI of the main service.");
|
||||
_uiShared.DrawHelpText("You cannot edit the URI of the main service.");
|
||||
}
|
||||
|
||||
if (ImGui.InputText("Service Name", ref serverName, 255, flags))
|
||||
@@ -1200,23 +1199,23 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
if (isMain)
|
||||
{
|
||||
UiSharedService.DrawHelpText("You cannot edit the name of the main service.");
|
||||
_uiShared.DrawHelpText("You cannot edit the name of the main service.");
|
||||
}
|
||||
|
||||
if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Service") && UiSharedService.CtrlPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Service") && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_serverConfigurationManager.DeleteServer(selectedServer);
|
||||
}
|
||||
UiSharedService.DrawHelpText("Hold CTRL to delete this service");
|
||||
_uiShared.DrawHelpText("Hold CTRL to delete this service");
|
||||
}
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem("Permission Settings"))
|
||||
{
|
||||
UiSharedService.FontText("Default Permission Settings", _uiShared.UidFont);
|
||||
_uiShared.BigText("Default Permission Settings");
|
||||
if (selectedServer == _serverConfigurationManager.CurrentServer && _apiController.IsConnected)
|
||||
{
|
||||
UiSharedService.TextWrapped("Note: The default permissions settings here are not applied retroactively to existing pairs or joined Syncshells.");
|
||||
@@ -1232,7 +1231,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
perms.IndividualIsSticky = individualIsSticky;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("The preferred attribute means that the permissions to that user will never change through any of your permission changes to Syncshells " +
|
||||
_uiShared.DrawHelpText("The preferred attribute means that the permissions to that user will never change through any of your permission changes to Syncshells " +
|
||||
"(i.e. if you have paused one specific user in a Syncshell and they become preferred permissions, then pause and unpause the same Syncshell, the user will remain paused - " +
|
||||
"if a user does not have preferred permissions, it will follow the permissions of the Syncshell and be unpaused)." + Environment.NewLine + Environment.NewLine +
|
||||
"This setting means:" + Environment.NewLine +
|
||||
@@ -1247,19 +1246,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
perms.DisableIndividualSounds = disableIndividualSounds;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable sound sync for all new individual pairs.");
|
||||
_uiShared.DrawHelpText("This setting will disable sound sync for all new individual pairs.");
|
||||
if (ImGui.Checkbox("Disable individual pair animations", ref disableIndividualAnimations))
|
||||
{
|
||||
perms.DisableIndividualAnimations = disableIndividualAnimations;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable animation sync for all new individual pairs.");
|
||||
_uiShared.DrawHelpText("This setting will disable animation sync for all new individual pairs.");
|
||||
if (ImGui.Checkbox("Disable individual pair VFX", ref disableIndividualVFX))
|
||||
{
|
||||
perms.DisableIndividualVFX = disableIndividualVFX;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable VFX sync for all new individual pairs.");
|
||||
_uiShared.DrawHelpText("This setting will disable VFX sync for all new individual pairs.");
|
||||
ImGuiHelpers.ScaledDummy(5f);
|
||||
bool disableGroundSounds = perms.DisableGroupSounds;
|
||||
bool disableGroupAnimations = perms.DisableGroupAnimations;
|
||||
@@ -1269,19 +1268,19 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
perms.DisableGroupSounds = disableGroundSounds;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable sound sync for all non-sticky pairs in newly joined syncshells.");
|
||||
_uiShared.DrawHelpText("This setting will disable sound sync for all non-sticky pairs in newly joined syncshells.");
|
||||
if (ImGui.Checkbox("Disable Syncshell pair animations", ref disableGroupAnimations))
|
||||
{
|
||||
perms.DisableGroupAnimations = disableGroupAnimations;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable animation sync for all non-sticky pairs in newly joined syncshells.");
|
||||
_uiShared.DrawHelpText("This setting will disable animation sync for all non-sticky pairs in newly joined syncshells.");
|
||||
if (ImGui.Checkbox("Disable Syncshell pair VFX", ref disableGroupVFX))
|
||||
{
|
||||
perms.DisableGroupVFX = disableGroupVFX;
|
||||
_ = _apiController.UserUpdateDefaultPermissions(perms);
|
||||
}
|
||||
UiSharedService.DrawHelpText("This setting will disable VFX sync for all non-sticky pairs in newly joined syncshells.");
|
||||
_uiShared.DrawHelpText("This setting will disable VFX sync for all non-sticky pairs in newly joined syncshells.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Dalamud.Interface.Internal;
|
||||
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using MareSynchronos.API.Data.Extensions;
|
||||
using MareSynchronos.PlayerData.Pairs;
|
||||
@@ -78,7 +77,7 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
|
||||
var rectMax = drawList.GetClipRectMax();
|
||||
var headerSize = ImGui.GetCursorPosY() - ImGui.GetStyle().WindowPadding.Y;
|
||||
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont, _uiSharedService.UidFontBuilt))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
UiSharedService.ColorText(Pair.UserData.AliasOrUID, ImGuiColors.HealerGreen);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(new Vector2(spacing.Y, spacing.Y));
|
||||
@@ -108,9 +107,8 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
|
||||
};
|
||||
if (ImGui.BeginChildFrame(1000, childFrame))
|
||||
{
|
||||
ImGui.PushFont(_uiSharedService.GetGameFontHandle());
|
||||
using var _ = _uiSharedService.GameFont.Push();
|
||||
ImGui.TextWrapped(mareProfile.Description);
|
||||
ImGui.PopFont();
|
||||
}
|
||||
ImGui.EndChildFrame();
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
using var id = ImRaii.PushId("syncshell_admin_" + GroupFullInfo.GID);
|
||||
|
||||
using (ImRaii.PushFont(_uiSharedService.UidFont))
|
||||
using (_uiSharedService.UidFont.Push())
|
||||
ImGui.TextUnformatted(GroupFullInfo.GroupAliasOrGID + " Administrative Panel");
|
||||
|
||||
ImGui.Separator();
|
||||
@@ -77,7 +77,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
bool isInvitesDisabled = perm.IsDisableInvites();
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(isInvitesDisabled ? FontAwesomeIcon.Unlock : FontAwesomeIcon.Lock,
|
||||
if (UiSharedService.IconTextButton(isInvitesDisabled ? FontAwesomeIcon.Unlock : FontAwesomeIcon.Lock,
|
||||
isInvitesDisabled ? "Unlock Syncshell" : "Lock Syncshell"))
|
||||
{
|
||||
perm.SetDisableInvites(!isInvitesDisabled);
|
||||
@@ -87,7 +87,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
UiSharedService.TextWrapped("One-time invites work as single-use passwords. Use those if you do not want to distribute your Syncshell password.");
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Envelope, "Single one-time invite"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Single one-time invite"))
|
||||
{
|
||||
ImGui.SetClipboardText(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), 1).Result.FirstOrDefault() ?? string.Empty);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_multiInvites <= 1 || _multiInvites > 100))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Envelope, "Generate " + _multiInvites + " one-time invites"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Generate " + _multiInvites + " one-time invites"))
|
||||
{
|
||||
_oneTimeInvites.AddRange(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), _multiInvites).Result);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
var invites = string.Join(Environment.NewLine, _oneTimeInvites);
|
||||
ImGui.InputTextMultiline("Generated Multi Invites", ref invites, 5000, new(0, 0), ImGuiInputTextFlags.ReadOnly);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Copy, "Copy Invites to clipboard"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Copy, "Copy Invites to clipboard"))
|
||||
{
|
||||
ImGui.SetClipboardText(invites);
|
||||
}
|
||||
@@ -169,24 +169,24 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
if (pair.Value.Value.IsModerator())
|
||||
{
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.UserShield);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield);
|
||||
UiSharedService.AttachToolTip("Moderator");
|
||||
}
|
||||
if (pair.Value.Value.IsPinned())
|
||||
{
|
||||
UiSharedService.NormalizedIcon(FontAwesomeIcon.Thumbtack);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
||||
UiSharedService.AttachToolTip("Pinned");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UiSharedService.FontText(FontAwesomeIcon.None.ToIconString(), UiBuilder.IconFont);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.None);
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn(); // actions
|
||||
if (_isOwner)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.UserShield))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.UserShield))
|
||||
{
|
||||
GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None;
|
||||
|
||||
@@ -200,7 +200,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
if (_isOwner || (pair.Value == null || (pair.Value != null && !pair.Value.Value.IsModerator())))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Thumbtack))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
||||
{
|
||||
GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None;
|
||||
|
||||
@@ -213,7 +213,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Trash))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Trash))
|
||||
{
|
||||
_ = _apiController.GroupRemoveUser(new GroupPairDto(GroupFullInfo.Group, pair.Key.UserData));
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconButton(FontAwesomeIcon.Ban))
|
||||
if (UiSharedService.IconButton(FontAwesomeIcon.Ban))
|
||||
{
|
||||
Mediator.Publish(new OpenBanUserPopupMessage(pair.Key, GroupFullInfo));
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Broom, "Clear Syncshell"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Broom, "Clear Syncshell"))
|
||||
{
|
||||
_ = _apiController.GroupClear(new(GroupFullInfo.Group));
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.Separator();
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Unlink, "Check for Inactive Users"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Unlink, "Check for Inactive Users"))
|
||||
{
|
||||
_pruneTestTask = _apiController.GroupPrune(new(GroupFullInfo.Group), _pruneDays, execute: false);
|
||||
_pruneTask = null;
|
||||
@@ -290,7 +290,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Broom, "Prune Inactive Users"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Broom, "Prune Inactive Users"))
|
||||
{
|
||||
_pruneTask = _apiController.GroupPrune(new(GroupFullInfo.Group), _pruneDays, execute: true);
|
||||
_pruneTestTask = null;
|
||||
@@ -318,7 +318,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
var banNode = ImRaii.TreeNode("User Bans");
|
||||
if (banNode)
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
|
||||
{
|
||||
_bannedUsers = _apiController.GroupGetBannedUsers(new GroupDto(GroupFullInfo.Group)).Result;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.TableNextColumn();
|
||||
UiSharedService.TextWrapped(bannedUser.Reason);
|
||||
ImGui.TableNextColumn();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Check, "Unban#" + bannedUser.UID))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Check, "Unban#" + bannedUser.UID))
|
||||
{
|
||||
_ = _apiController.GroupUnbanUser(bannedUser);
|
||||
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
|
||||
@@ -370,9 +370,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text("Suggest Sound Sync");
|
||||
UiSharedService.BooleanToColoredIcon(!isDisableSounds);
|
||||
_uiSharedService.BooleanToColoredIcon(!isDisableSounds);
|
||||
ImGui.SameLine(230);
|
||||
if (UiSharedService.NormalizedIconTextButton(isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute,
|
||||
if (UiSharedService.IconTextButton(isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute,
|
||||
isDisableSounds ? "Suggest to enable sound sync" : "Suggest to disable sound sync"))
|
||||
{
|
||||
perm.SetPreferDisableSounds(!perm.IsPreferDisableSounds());
|
||||
@@ -381,9 +381,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text("Suggest Animation Sync");
|
||||
UiSharedService.BooleanToColoredIcon(!isDisableAnimations);
|
||||
_uiSharedService.BooleanToColoredIcon(!isDisableAnimations);
|
||||
ImGui.SameLine(230);
|
||||
if (UiSharedService.NormalizedIconTextButton(isDisableAnimations ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop,
|
||||
if (UiSharedService.IconTextButton(isDisableAnimations ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop,
|
||||
isDisableAnimations ? "Suggest to enable animation sync" : "Suggest to disable animation sync"))
|
||||
{
|
||||
perm.SetPreferDisableAnimations(!perm.IsPreferDisableAnimations());
|
||||
@@ -392,9 +392,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text("Suggest VFX Sync");
|
||||
UiSharedService.BooleanToColoredIcon(!isDisableVfx);
|
||||
_uiSharedService.BooleanToColoredIcon(!isDisableVfx);
|
||||
ImGui.SameLine(230);
|
||||
if (UiSharedService.NormalizedIconTextButton(isDisableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle,
|
||||
if (UiSharedService.IconTextButton(isDisableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle,
|
||||
isDisableVfx ? "Suggest to enable vfx sync" : "Suggest to disable vfx sync"))
|
||||
{
|
||||
perm.SetPreferDisableVFX(!perm.IsPreferDisableVFX());
|
||||
@@ -413,7 +413,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("New Password");
|
||||
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
var buttonSize = UiSharedService.GetNormalizedIconTextButtonSize(FontAwesomeIcon.Passport, "Change Password").X;
|
||||
var buttonSize = UiSharedService.GetIconTextButtonSize(FontAwesomeIcon.Passport, "Change Password");
|
||||
var textSize = ImGui.CalcTextSize("New Password").X;
|
||||
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
||||
|
||||
@@ -423,7 +423,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_newPassword.Length < 10))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Passport, "Change Password"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Passport, "Change Password"))
|
||||
{
|
||||
_pwChangeSuccess = _apiController.GroupChangePassword(new GroupPasswordDto(GroupFullInfo.Group, _newPassword)).Result;
|
||||
_newPassword = string.Empty;
|
||||
@@ -436,7 +436,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
UiSharedService.ColorTextWrapped("Failed to change the password. Password requires to be at least 10 characters long.", ImGuiColors.DalamudYellow);
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Syncshell") && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Syncshell") && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||
{
|
||||
IsOpen = false;
|
||||
_ = _apiController.GroupDelete(new(GroupFullInfo.Group));
|
||||
|
||||
@@ -19,18 +19,19 @@ public class TopTabMenu
|
||||
private readonly MareMediator _mareMediator;
|
||||
|
||||
private readonly PairManager _pairManager;
|
||||
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private string _filter = string.Empty;
|
||||
private int _globalControlCountdown = 0;
|
||||
|
||||
private string _pairToAdd = string.Empty;
|
||||
|
||||
private SelectedTab _selectedTab = SelectedTab.None;
|
||||
public TopTabMenu(MareMediator mareMediator, ApiController apiController, PairManager pairManager)
|
||||
public TopTabMenu(MareMediator mareMediator, ApiController apiController, PairManager pairManager, UiSharedService uiSharedService)
|
||||
{
|
||||
_mareMediator = mareMediator;
|
||||
_apiController = apiController;
|
||||
_pairManager = pairManager;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
private enum SelectedTab
|
||||
@@ -72,7 +73,7 @@ public class TopTabMenu
|
||||
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
var spacing = ImGui.GetStyle().ItemSpacing;
|
||||
var buttonX = (availableWidth - (spacing.X * 3)) / 4f;
|
||||
var buttonY = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonY = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonSize = new Vector2(buttonX, buttonY);
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var underlineColor = ImGui.GetColorU32(ImGuiCol.Separator);
|
||||
@@ -178,14 +179,14 @@ public class TopTabMenu
|
||||
|
||||
private void DrawAddPair(float availableXWidth, float spacingX)
|
||||
{
|
||||
var buttonSize = UiSharedService.GetNormalizedIconTextButtonSize(FontAwesomeIcon.UserPlus, "Add");
|
||||
ImGui.SetNextItemWidth(availableXWidth - buttonSize.X - spacingX);
|
||||
var buttonSize = UiSharedService.GetIconTextButtonSize(FontAwesomeIcon.UserPlus, "Add");
|
||||
ImGui.SetNextItemWidth(availableXWidth - buttonSize - spacingX);
|
||||
ImGui.InputTextWithHint("##otheruid", "Other players UID/Alias", ref _pairToAdd, 20);
|
||||
ImGui.SameLine();
|
||||
var alreadyExisting = _pairManager.DirectPairs.Exists(p => string.Equals(p.UserData.UID, _pairToAdd, StringComparison.Ordinal) || string.Equals(p.UserData.Alias, _pairToAdd, StringComparison.Ordinal));
|
||||
using (ImRaii.Disabled(alreadyExisting || string.IsNullOrEmpty(_pairToAdd)))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserPlus, "Add"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserPlus, "Add"))
|
||||
{
|
||||
_ = _apiController.UserAddPair(new(new(_pairToAdd)));
|
||||
_pairToAdd = string.Empty;
|
||||
@@ -196,8 +197,8 @@ public class TopTabMenu
|
||||
|
||||
private void DrawFilter(float availableWidth, float spacingX)
|
||||
{
|
||||
var buttonSize = UiSharedService.GetNormalizedIconTextButtonSize(FontAwesomeIcon.Ban, "Clear");
|
||||
ImGui.SetNextItemWidth(availableWidth - buttonSize.X - spacingX);
|
||||
var buttonSize = UiSharedService.GetIconTextButtonSize(FontAwesomeIcon.Ban, "Clear");
|
||||
ImGui.SetNextItemWidth(availableWidth - buttonSize - spacingX);
|
||||
string filter = Filter;
|
||||
if (ImGui.InputTextWithHint("##filter", "Filter for UID/notes", ref filter, 255))
|
||||
{
|
||||
@@ -205,7 +206,7 @@ public class TopTabMenu
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using var disabled = ImRaii.Disabled(string.IsNullOrEmpty(Filter));
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Ban, "Clear"))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Ban, "Clear"))
|
||||
{
|
||||
Filter = string.Empty;
|
||||
}
|
||||
@@ -214,7 +215,7 @@ public class TopTabMenu
|
||||
private void DrawGlobalIndividualButtons(float availableXWidth, float spacingX)
|
||||
{
|
||||
var buttonX = (availableXWidth - (spacingX * 3)) / 4f;
|
||||
var buttonY = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonY = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonSize = new Vector2(buttonX, buttonY);
|
||||
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
@@ -322,7 +323,7 @@ public class TopTabMenu
|
||||
private void DrawGlobalSyncshellButtons(float availableXWidth, float spacingX)
|
||||
{
|
||||
var buttonX = (availableXWidth - (spacingX * 4)) / 5f;
|
||||
var buttonY = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonY = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Pause).Y;
|
||||
var buttonSize = new Vector2(buttonX, buttonY);
|
||||
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
@@ -466,7 +467,7 @@ public class TopTabMenu
|
||||
using (ImRaii.Disabled(_pairManager.GroupPairs.Select(k => k.Key).Distinct()
|
||||
.Count(g => string.Equals(g.OwnerUID, _apiController.UID, StringComparison.Ordinal)) >= _apiController.ServerInfo.MaxGroupsCreatedByUser))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Create new Syncshell", buttonX))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Plus, "Create new Syncshell"))
|
||||
{
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(CreateSyncshellUI)));
|
||||
}
|
||||
@@ -475,7 +476,7 @@ public class TopTabMenu
|
||||
|
||||
using (ImRaii.Disabled(_pairManager.GroupPairs.Select(k => k.Key).Distinct().Count() >= _apiController.ServerInfo.MaxGroupsJoinedByUser))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Users, "Join existing Syncshell", buttonX))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.Users, "Join existing Syncshell"))
|
||||
{
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(JoinSyncshellUI)));
|
||||
}
|
||||
@@ -485,13 +486,13 @@ public class TopTabMenu
|
||||
private void DrawUserConfig(float availableWidth, float spacingX)
|
||||
{
|
||||
var buttonX = (availableWidth - spacingX) / 2f;
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.UserCircle, "Edit Mare Profile", buttonX))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.UserCircle, "Edit Mare Profile", buttonX))
|
||||
{
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(EditProfileUi)));
|
||||
}
|
||||
UiSharedService.AttachToolTip("Edit your Mare Profile");
|
||||
ImGui.SameLine();
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Chara Data Analysis", buttonX))
|
||||
if (UiSharedService.IconTextButton(FontAwesomeIcon.PersonCircleQuestion, "Chara Data Analysis", buttonX))
|
||||
{
|
||||
_mareMediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi)));
|
||||
}
|
||||
@@ -518,7 +519,7 @@ public class TopTabMenu
|
||||
{
|
||||
if (ImGui.BeginPopup(popupTitle))
|
||||
{
|
||||
if (UiSharedService.NormalizedIconTextButton(enableIcon, enableText, 0, true))
|
||||
if (UiSharedService.IconTextButton(enableIcon, enableText, null, true))
|
||||
{
|
||||
_ = GlobalControlCountdown(10);
|
||||
var bulkIndividualPairs = _pairManager.PairsWithGroups.Keys
|
||||
@@ -532,7 +533,7 @@ public class TopTabMenu
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableIcon, disableText, 0, true))
|
||||
if (UiSharedService.IconTextButton(disableIcon, disableText, null, true))
|
||||
{
|
||||
_ = GlobalControlCountdown(10);
|
||||
var bulkIndividualPairs = _pairManager.PairsWithGroups.Keys
|
||||
@@ -556,7 +557,7 @@ public class TopTabMenu
|
||||
if (ImGui.BeginPopup(popupTitle))
|
||||
{
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(enableIcon, enableText, 0, true))
|
||||
if (UiSharedService.IconTextButton(enableIcon, enableText, null, true))
|
||||
{
|
||||
_ = GlobalControlCountdown(10);
|
||||
var bulkSyncshells = _pairManager.GroupPairs.Keys
|
||||
@@ -570,7 +571,7 @@ public class TopTabMenu
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
if (UiSharedService.NormalizedIconTextButton(disableIcon, disableText, 0, true))
|
||||
if (UiSharedService.IconTextButton(disableIcon, disableText, null, true))
|
||||
{
|
||||
_ = GlobalControlCountdown(10);
|
||||
var bulkSyncshells = _pairManager.GroupPairs.Keys
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.ImGuiFileDialog;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin;
|
||||
@@ -28,6 +30,8 @@ namespace MareSynchronos.UI;
|
||||
|
||||
public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
{
|
||||
public const string TooltipSeparator = "--SEP--";
|
||||
|
||||
public static readonly ImGuiWindowFlags PopupWindowFlags = ImGuiWindowFlags.NoResize |
|
||||
ImGuiWindowFlags.NoScrollbar |
|
||||
ImGuiWindowFlags.NoScrollWithMouse;
|
||||
@@ -65,12 +69,10 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
private bool _heelsExists = false;
|
||||
|
||||
private bool _honorificExists = false;
|
||||
private bool _moodlesExists = false;
|
||||
private bool _isDirectoryWritable = false;
|
||||
|
||||
private bool _isPenumbraDirectory = false;
|
||||
private bool _isOneDrive = false;
|
||||
|
||||
private bool _isPenumbraDirectory = false;
|
||||
private bool _moodlesExists = false;
|
||||
private bool _penumbraExists = false;
|
||||
|
||||
private int _serverSelectionIndex = -1;
|
||||
@@ -89,14 +91,10 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
_pluginInterface = pluginInterface;
|
||||
_localization = localization;
|
||||
_serverConfigurationManager = serverManager;
|
||||
|
||||
_localization.SetupWithLangCode("en");
|
||||
|
||||
_isDirectoryWritable = IsDirectoryWritable(_configService.Current.CacheFolder);
|
||||
|
||||
_pluginInterface.UiBuilder.BuildFonts += BuildFont;
|
||||
_pluginInterface.UiBuilder.RebuildFonts();
|
||||
|
||||
Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (_) =>
|
||||
{
|
||||
_penumbraExists = _ipcManager.Penumbra.APIAvailable;
|
||||
@@ -106,28 +104,35 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
_honorificExists = _ipcManager.Honorific.APIAvailable;
|
||||
_moodlesExists = _ipcManager.Moodles.APIAvailable;
|
||||
});
|
||||
|
||||
UidFont = _pluginInterface.UiBuilder.FontAtlas.NewDelegateFontHandle(e =>
|
||||
{
|
||||
e.OnPreBuild(tk => tk.AddDalamudAssetFont(Dalamud.DalamudAsset.NotoSansJpMedium, new()
|
||||
{
|
||||
SizePx = 35
|
||||
}));
|
||||
});
|
||||
GameFont = _pluginInterface.UiBuilder.FontAtlas.NewGameFontHandle(new(GameFontFamilyAndSize.Axis12));
|
||||
IconFont = _pluginInterface.UiBuilder.IconFontHandle;
|
||||
}
|
||||
|
||||
public ApiController ApiController => _apiController;
|
||||
|
||||
public bool EditTrackerPosition { get; set; }
|
||||
|
||||
public IFontHandle GameFont { get; init; }
|
||||
public bool HasValidPenumbraModPath => !(_ipcManager.Penumbra.ModDirectory ?? string.Empty).IsNullOrEmpty() && Directory.Exists(_ipcManager.Penumbra.ModDirectory);
|
||||
|
||||
public IFontHandle IconFont { get; init; }
|
||||
public bool IsInGpose => _dalamudUtil.IsInCutscene;
|
||||
|
||||
public string PlayerName => _dalamudUtil.GetPlayerName();
|
||||
|
||||
public ImFontPtr UidFont { get; private set; }
|
||||
|
||||
public bool UidFontBuilt { get; private set; }
|
||||
|
||||
public IFontHandle UidFont { get; init; }
|
||||
public Dictionary<ushort, string> WorldData => _dalamudUtil.WorldData.Value;
|
||||
|
||||
public uint WorldId => _dalamudUtil.GetHomeWorldId();
|
||||
|
||||
public const string TooltipSeparator = "--SEP--";
|
||||
|
||||
public static void AttachToolTip(string text)
|
||||
{
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
@@ -152,23 +157,6 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
public static void BooleanToColoredIcon(bool value, bool inline = true)
|
||||
{
|
||||
using var colorgreen = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, value);
|
||||
using var colorred = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, !value);
|
||||
|
||||
if (inline) ImGui.SameLine();
|
||||
|
||||
if (value)
|
||||
{
|
||||
NormalizedIcon(FontAwesomeIcon.Check);
|
||||
}
|
||||
else
|
||||
{
|
||||
NormalizedIcon(FontAwesomeIcon.Times);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ByteToString(long bytes, bool addSuffix = true)
|
||||
{
|
||||
string[] suffix = ["B", "KiB", "MiB", "GiB", "TiB"];
|
||||
@@ -217,13 +205,6 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
|
||||
public static bool CtrlPressed() => (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
|
||||
|
||||
public static void DrawHelpText(string helpText)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
NormalizedIcon(FontAwesomeIcon.QuestionCircle, ImGui.GetColorU32(ImGuiCol.TextDisabled));
|
||||
AttachToolTip(helpText);
|
||||
}
|
||||
|
||||
public static void DrawOutlinedFont(string text, Vector4 fontColor, Vector4 outlineColor, int thickness)
|
||||
{
|
||||
var original = ImGui.GetCursorPos();
|
||||
@@ -280,20 +261,16 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
drawList.AddText(textPos, fontColor, text);
|
||||
}
|
||||
|
||||
public static void FontText(string text, ImFontPtr font, Vector4? color = null)
|
||||
{
|
||||
using var pushedFont = ImRaii.PushFont(font);
|
||||
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, Color(color ?? new Vector4(1, 1, 1, 1)), color != null);
|
||||
ImGui.TextUnformatted(text);
|
||||
}
|
||||
|
||||
public static Vector4 GetBoolColor(bool input) => input ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed;
|
||||
|
||||
public static Vector2 GetIconButtonSize(FontAwesomeIcon icon)
|
||||
public static float GetIconTextButtonSize(FontAwesomeIcon icon, string text)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
var buttonSize = ImGuiHelpers.GetButtonSize(icon.ToIconString());
|
||||
return buttonSize;
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
Vector2 vector = ImGui.CalcTextSize(icon.ToIconString());
|
||||
ImGui.PopFont();
|
||||
Vector2 vector2 = ImGui.CalcTextSize(text);
|
||||
float num = 3f * ImGuiHelpers.GlobalScale;
|
||||
return vector.X + vector2.X + ImGui.GetStyle().FramePadding.X * 2f + num;
|
||||
}
|
||||
|
||||
public static string GetNotes(List<Pair> pairs)
|
||||
@@ -317,146 +294,51 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
return ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
}
|
||||
|
||||
public static Vector2 GetNormalizedIconTextButtonSize(FontAwesomeIcon icon, string text, float? width = null, bool isInPopup = false)
|
||||
public static bool IconButton(FontAwesomeIcon icon)
|
||||
{
|
||||
var iconData = GetIconData(icon);
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
var padding = ImGui.GetStyle().FramePadding;
|
||||
var buttonSizeY = ImGui.GetFrameHeight();
|
||||
var iconExtraSpacing = isInPopup ? padding.X * 2 : 0;
|
||||
|
||||
if (width == null || width <= 0)
|
||||
{
|
||||
var buttonSizeX = iconData.NormalizedIconScale.X + (padding.X * 3) + iconExtraSpacing + textSize.X;
|
||||
return new Vector2(buttonSizeX, buttonSizeY);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Vector2(width.Value, buttonSizeY);
|
||||
}
|
||||
return ImGuiComponents.IconButton(icon);
|
||||
}
|
||||
|
||||
public static Vector2 NormalizedIconButtonSize(FontAwesomeIcon icon)
|
||||
private static bool IconTextButtonInternal(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, float? width = null)
|
||||
{
|
||||
var iconData = GetIconData(icon);
|
||||
var padding = ImGui.GetStyle().FramePadding;
|
||||
|
||||
return iconData.NormalizedIconScale with { X = iconData.NormalizedIconScale.X + padding.X * 2, Y = iconData.NormalizedIconScale.Y + padding.Y * 2 };
|
||||
int num = 0;
|
||||
if (defaultColor.HasValue)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, defaultColor.Value);
|
||||
num++;
|
||||
}
|
||||
|
||||
public static bool NormalizedIconButton(FontAwesomeIcon icon)
|
||||
ImGui.PushID(text);
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
Vector2 vector = ImGui.CalcTextSize(icon.ToIconString());
|
||||
ImGui.PopFont();
|
||||
Vector2 vector2 = ImGui.CalcTextSize(text);
|
||||
ImDrawListPtr windowDrawList = ImGui.GetWindowDrawList();
|
||||
Vector2 cursorScreenPos = ImGui.GetCursorScreenPos();
|
||||
float num2 = 3f * ImGuiHelpers.GlobalScale;
|
||||
float x = width ?? vector.X + vector2.X + ImGui.GetStyle().FramePadding.X * 2f + num2;
|
||||
float frameHeight = ImGui.GetFrameHeight();
|
||||
bool result = ImGui.Button(string.Empty, new Vector2(x, frameHeight));
|
||||
Vector2 pos = new Vector2(cursorScreenPos.X + ImGui.GetStyle().FramePadding.X, cursorScreenPos.Y + ImGui.GetStyle().FramePadding.Y);
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
windowDrawList.AddText(pos, ImGui.GetColorU32(ImGuiCol.Text), icon.ToIconString());
|
||||
ImGui.PopFont();
|
||||
Vector2 pos2 = new Vector2(pos.X + vector.X + num2, cursorScreenPos.Y + ImGui.GetStyle().FramePadding.Y);
|
||||
windowDrawList.AddText(pos2, ImGui.GetColorU32(ImGuiCol.Text), text);
|
||||
ImGui.PopID();
|
||||
if (num > 0)
|
||||
{
|
||||
bool wasClicked = false;
|
||||
var iconData = GetIconData(icon);
|
||||
var padding = ImGui.GetStyle().FramePadding;
|
||||
var cursor = ImGui.GetCursorPos();
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var pos = ImGui.GetWindowPos();
|
||||
var scrollPosY = ImGui.GetScrollY();
|
||||
var scrollPosX = ImGui.GetScrollX();
|
||||
|
||||
var buttonSize = NormalizedIconButtonSize(icon);
|
||||
|
||||
if (ImGui.Button("###" + icon.ToIconString(), buttonSize))
|
||||
{
|
||||
wasClicked = true;
|
||||
ImGui.PopStyleColor(num);
|
||||
}
|
||||
|
||||
drawList.AddText(UiBuilder.IconFont, ImGui.GetFontSize() * iconData.IconScaling,
|
||||
new(pos.X - scrollPosX + cursor.X + iconData.OffsetX + padding.X,
|
||||
pos.Y - scrollPosY + cursor.Y + (buttonSize.Y - (iconData.IconSize.Y * iconData.IconScaling)) / 2f),
|
||||
ImGui.GetColorU32(ImGuiCol.Text), icon.ToIconString());
|
||||
|
||||
return wasClicked;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool NormalizedIconTextButton(FontAwesomeIcon icon, string text, float? width = null, bool isInPopup = false)
|
||||
public static bool IconTextButton(FontAwesomeIcon icon, string text, float? width = null, bool isInPopup = false)
|
||||
{
|
||||
var wasClicked = false;
|
||||
|
||||
var iconData = GetIconData(icon);
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
var padding = ImGui.GetStyle().FramePadding;
|
||||
var cursor = ImGui.GetCursorPos();
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var pos = ImGui.GetWindowPos();
|
||||
var scrollPosY = ImGui.GetScrollY();
|
||||
var scrollPosX = ImGui.GetScrollX();
|
||||
|
||||
Vector2 buttonSize = GetNormalizedIconTextButtonSize(icon, text, width, isInPopup);
|
||||
var iconExtraSpacing = isInPopup ? padding.X * 2 : 0;
|
||||
|
||||
using (ImRaii.PushColor(ImGuiCol.Button, ImGui.GetColorU32(ImGuiCol.PopupBg), isInPopup))
|
||||
{
|
||||
if (ImGui.Button("###" + icon.ToIconString() + text, buttonSize))
|
||||
{
|
||||
wasClicked = true;
|
||||
return IconTextButtonInternal(icon, text,
|
||||
isInPopup ? ColorHelpers.RgbaUintToVector4(ImGui.GetColorU32(ImGuiCol.PopupBg)) : null, width);
|
||||
}
|
||||
}
|
||||
|
||||
drawList.AddText(UiBuilder.DefaultFont, ImGui.GetFontSize(),
|
||||
new(pos.X - scrollPosX + cursor.X + iconData.NormalizedIconScale.X + (padding.X * 2) + iconExtraSpacing,
|
||||
pos.Y - scrollPosY + cursor.Y + ((buttonSize.Y - textSize.Y) / 2f)),
|
||||
ImGui.GetColorU32(ImGuiCol.Text), text);
|
||||
|
||||
drawList.AddText(UiBuilder.IconFont, ImGui.GetFontSize() * iconData.IconScaling,
|
||||
new(pos.X - scrollPosX + cursor.X + iconData.OffsetX + padding.X,
|
||||
pos.Y - scrollPosY + cursor.Y + (buttonSize.Y - (iconData.IconSize.Y * iconData.IconScaling)) / 2f),
|
||||
ImGui.GetColorU32(ImGuiCol.Text), icon.ToIconString());
|
||||
|
||||
return wasClicked;
|
||||
}
|
||||
|
||||
public static void NormalizedIcon(FontAwesomeIcon icon, uint color)
|
||||
{
|
||||
var cursorPos = ImGui.GetCursorPos();
|
||||
var iconData = GetIconData(icon);
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var windowPos = ImGui.GetWindowPos();
|
||||
var scrollPosX = ImGui.GetScrollX();
|
||||
var scrollPosY = ImGui.GetScrollY();
|
||||
var frameHeight = ImGui.GetFrameHeight();
|
||||
|
||||
var frameOffsetY = ((frameHeight - iconData.IconSize.Y * iconData.IconScaling) / 2f);
|
||||
|
||||
drawList.AddText(UiBuilder.IconFont, UiBuilder.IconFont.FontSize * iconData.IconScaling,
|
||||
new(windowPos.X - scrollPosX + cursorPos.X + iconData.OffsetX,
|
||||
windowPos.Y - scrollPosY + cursorPos.Y + frameOffsetY),
|
||||
color, icon.ToIconString());
|
||||
|
||||
ImGui.Dummy(new(iconData.NormalizedIconScale.X, ImGui.GetFrameHeight()));
|
||||
}
|
||||
|
||||
public static void NormalizedIcon(FontAwesomeIcon icon, Vector4? color = null)
|
||||
{
|
||||
NormalizedIcon(icon, color == null ? ImGui.GetColorU32(ImGuiCol.Text) : ImGui.GetColorU32(color.Value));
|
||||
}
|
||||
|
||||
private static IconScaleData CalcIconScaleData(FontAwesomeIcon icon)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
var iconSize = ImGui.CalcTextSize(icon.ToIconString());
|
||||
var iconscaling = (iconSize.X < iconSize.Y ? (iconSize.Y - iconSize.X) / 2f : 0f, iconSize.X > iconSize.Y ? 1f / (iconSize.X / iconSize.Y) : 1f);
|
||||
var normalized = iconscaling.Item2 == 1f ?
|
||||
new Vector2(iconSize.Y, iconSize.Y)
|
||||
: new((iconSize.X * iconscaling.Item2) + (iconscaling.Item1 * 2), (iconSize.X * iconscaling.Item2) + (iconscaling.Item1 * 2));
|
||||
return new(iconSize, normalized, iconscaling.Item1, iconscaling.Item2);
|
||||
}
|
||||
|
||||
public static IconScaleData GetIconData(FontAwesomeIcon icon)
|
||||
{
|
||||
if (_iconData.TryGetValue(ImGuiHelpers.GlobalScale, out var iconCache))
|
||||
{
|
||||
if (iconCache.TryGetValue(icon, out var iconData)) return iconData;
|
||||
return iconCache[icon] = CalcIconScaleData(icon);
|
||||
}
|
||||
|
||||
_iconData.Add(ImGuiHelpers.GlobalScale, new());
|
||||
return _iconData[ImGuiHelpers.GlobalScale][icon] = CalcIconScaleData(icon);
|
||||
}
|
||||
|
||||
public sealed record IconScaleData(Vector2 IconSize, Vector2 NormalizedIconScale, float OffsetX, float IconScaling);
|
||||
private static Dictionary<float, Dictionary<FontAwesomeIcon, IconScaleData>> _iconData = new();
|
||||
|
||||
public static bool IsDirectoryWritable(string dirPath, bool throwIfFails = false)
|
||||
{
|
||||
@@ -549,10 +431,26 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
return true;
|
||||
}
|
||||
|
||||
public void BigText(string text)
|
||||
public void BigText(string text, Vector4? color = null)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UidFont, UidFontBuilt);
|
||||
ImGui.TextUnformatted(text);
|
||||
FontText(text, UidFont, color);
|
||||
}
|
||||
|
||||
public void BooleanToColoredIcon(bool value, bool inline = true)
|
||||
{
|
||||
using var colorgreen = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, value);
|
||||
using var colorred = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, !value);
|
||||
|
||||
if (inline) ImGui.SameLine();
|
||||
|
||||
if (value)
|
||||
{
|
||||
IconText(FontAwesomeIcon.Check);
|
||||
}
|
||||
else
|
||||
{
|
||||
IconText(FontAwesomeIcon.Times);
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawCacheDirectorySetting()
|
||||
@@ -564,7 +462,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_cacheMonitor.MareWatcher != null))
|
||||
{
|
||||
if (NormalizedIconButton(FontAwesomeIcon.Folder))
|
||||
if (IconButton(FontAwesomeIcon.Folder))
|
||||
{
|
||||
FileDialogManager.OpenFolderDialog("Pick Mare Synchronos Storage Folder", (success, path) =>
|
||||
{
|
||||
@@ -630,7 +528,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
}
|
||||
|
||||
public T? DrawCombo<T>(string comboName, IEnumerable<T> comboItems, Func<T, string> toName,
|
||||
Action<T>? onSelected = null, T? initialSelectedItem = default)
|
||||
Action<T?>? onSelected = null, T? initialSelectedItem = default)
|
||||
{
|
||||
if (!comboItems.Any()) return default;
|
||||
|
||||
@@ -654,7 +552,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
{
|
||||
foreach (var item in comboItems)
|
||||
{
|
||||
bool isSelected = EqualityComparer<T>.Default.Equals(item, (T)selectedItem);
|
||||
bool isSelected = EqualityComparer<T>.Default.Equals(item, (T?)selectedItem);
|
||||
if (ImGui.Selectable(toName(item), isSelected))
|
||||
{
|
||||
_selectedComboItems[comboName] = item!;
|
||||
@@ -704,7 +602,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
if (_configService.Current.InitialScanComplete)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (NormalizedIconTextButton(FontAwesomeIcon.Play, "Force rescan"))
|
||||
if (IconTextButton(FontAwesomeIcon.Play, "Force rescan"))
|
||||
{
|
||||
_cacheMonitor.InvokeScan();
|
||||
}
|
||||
@@ -712,16 +610,23 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawHelpText(string helpText)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
IconText(FontAwesomeIcon.QuestionCircle, ImGui.GetColorU32(ImGuiCol.TextDisabled));
|
||||
AttachToolTip(helpText);
|
||||
}
|
||||
|
||||
public bool DrawOtherPluginState()
|
||||
{
|
||||
var check = FontAwesomeIcon.Check.ToIconString();
|
||||
var cross = FontAwesomeIcon.SquareXmark.ToIconString();
|
||||
var check = FontAwesomeIcon.Check;
|
||||
var cross = FontAwesomeIcon.SquareXmark;
|
||||
ImGui.TextUnformatted("Mandatory Plugins:");
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Penumbra");
|
||||
ImGui.SameLine();
|
||||
FontText(_penumbraExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_penumbraExists));
|
||||
IconText(_penumbraExists ? check : cross, GetBoolColor(_penumbraExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Penumbra is " + (_penumbraExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -729,7 +634,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Glamourer");
|
||||
ImGui.SameLine();
|
||||
FontText(_glamourerExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_glamourerExists));
|
||||
IconText(_glamourerExists ? check : cross, GetBoolColor(_glamourerExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Glamourer is " + (_glamourerExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -738,7 +643,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("SimpleHeels");
|
||||
ImGui.SameLine();
|
||||
FontText(_heelsExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_heelsExists));
|
||||
IconText(_heelsExists ? check : cross, GetBoolColor(_heelsExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"SimpleHeels is " + (_heelsExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -746,7 +651,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Customize+");
|
||||
ImGui.SameLine();
|
||||
FontText(_customizePlusExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_customizePlusExists));
|
||||
IconText(_customizePlusExists ? check : cross, GetBoolColor(_customizePlusExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Customize+ is " + (_customizePlusExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -754,7 +659,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Honorific");
|
||||
ImGui.SameLine();
|
||||
FontText(_honorificExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_honorificExists));
|
||||
IconText(_honorificExists ? check : cross, GetBoolColor(_honorificExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Honorific is " + (_honorificExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -762,7 +667,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted("Moodles");
|
||||
ImGui.SameLine();
|
||||
FontText(_moodlesExists ? check : cross, UiBuilder.IconFont, GetBoolColor(_moodlesExists));
|
||||
IconText(_moodlesExists ? check : cross, GetBoolColor(_moodlesExists));
|
||||
ImGui.SameLine();
|
||||
AttachToolTip($"Moodles is " + (_moodlesExists ? "available and up to date." : "unavailable or not up to date."));
|
||||
ImGui.Spacing();
|
||||
@@ -821,7 +726,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
var text = "Connect";
|
||||
if (_serverSelectionIndex == _serverConfigurationManager.CurrentServerIndex) text = "Reconnect";
|
||||
if (NormalizedIconTextButton(FontAwesomeIcon.Link, text))
|
||||
if (IconTextButton(FontAwesomeIcon.Link, text))
|
||||
{
|
||||
_serverConfigurationManager.SelectServer(_serverSelectionIndex);
|
||||
_ = _apiController.CreateConnections();
|
||||
@@ -834,7 +739,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
ImGui.InputText("Custom Service URI", ref _customServerUri, 255);
|
||||
ImGui.SetNextItemWidth(250);
|
||||
ImGui.InputText("Custom Service Name", ref _customServerName, 255);
|
||||
if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Plus, "Add Custom Service")
|
||||
if (IconTextButton(FontAwesomeIcon.Plus, "Add Custom Service")
|
||||
&& !string.IsNullOrEmpty(_customServerUri)
|
||||
&& !string.IsNullOrEmpty(_customServerName))
|
||||
{
|
||||
@@ -853,6 +758,40 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
return _serverSelectionIndex;
|
||||
}
|
||||
|
||||
public Vector2 GetIconButtonSize(FontAwesomeIcon icon)
|
||||
{
|
||||
using var font = IconFont.Push();
|
||||
var buttonSize = ImGuiHelpers.GetButtonSize(icon.ToIconString());
|
||||
return buttonSize;
|
||||
}
|
||||
|
||||
public Vector2 GetIconData(FontAwesomeIcon icon)
|
||||
{
|
||||
using var font = IconFont.Push();
|
||||
return ImGui.CalcTextSize(icon.ToIconString());
|
||||
}
|
||||
|
||||
public Vector2 IconButtonSize(FontAwesomeIcon icon)
|
||||
{
|
||||
using var font = IconFont.Push();
|
||||
return ImGuiHelpers.GetButtonSize(icon.ToIconString());
|
||||
}
|
||||
|
||||
public void IconText(FontAwesomeIcon icon, uint color)
|
||||
{
|
||||
FontText(icon.ToIconString(), IconFont, color);
|
||||
}
|
||||
|
||||
public void IconText(FontAwesomeIcon icon, Vector4? color = null)
|
||||
{
|
||||
IconText(icon, color == null ? ImGui.GetColorU32(ImGuiCol.Text) : ImGui.GetColorU32(color.Value));
|
||||
}
|
||||
|
||||
public IDalamudTextureWrap LoadImage(byte[] imageData)
|
||||
{
|
||||
return _pluginInterface.UiBuilder.LoadImage(imageData);
|
||||
}
|
||||
|
||||
public void LoadLocalization(string languageCode)
|
||||
{
|
||||
_localization.SetupWithLangCode(languageCode);
|
||||
@@ -862,54 +801,26 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
[LibraryImport("user32")]
|
||||
internal static partial short GetKeyState(int nVirtKey);
|
||||
|
||||
internal ImFontPtr GetGameFontHandle()
|
||||
{
|
||||
return _pluginInterface.UiBuilder.GetGameFontHandle(new GameFontStyle(GameFontFamilyAndSize.Axis12)).ImFont;
|
||||
}
|
||||
|
||||
internal IDalamudTextureWrap LoadImage(byte[] imageData)
|
||||
{
|
||||
return _pluginInterface.UiBuilder.LoadImage(imageData);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_pluginInterface.UiBuilder.BuildFonts -= BuildFont;
|
||||
}
|
||||
|
||||
private static void CenterWindow(float width, float height, ImGuiCond cond = ImGuiCond.None)
|
||||
{
|
||||
var center = ImGui.GetMainViewport().GetCenter();
|
||||
ImGui.SetWindowPos(new Vector2(center.X - width / 2, center.Y - height / 2), cond);
|
||||
}
|
||||
|
||||
#pragma warning disable MA0009 // Add regex evaluation timeout
|
||||
[GeneratedRegex(@"^(?:[a-zA-Z]:\\[\w\s\-\\]+?|\/(?:[\w\s\-\/])+?)$", RegexOptions.ECMAScript)]
|
||||
#pragma warning restore MA0009 // Add regex evaluation timeout
|
||||
[GeneratedRegex(@"^(?:[a-zA-Z]:\\[\w\s\-\\]+?|\/(?:[\w\s\-\/])+?)$", RegexOptions.ECMAScript, 5000)]
|
||||
private static partial Regex PathRegex();
|
||||
|
||||
private void BuildFont()
|
||||
private void FontText(string text, IFontHandle font, Vector4? color = null)
|
||||
{
|
||||
var fontFile = Path.Combine(_pluginInterface.DalamudAssetDirectory.FullName, "UIRes", "NotoSansCJKjp-Medium.otf");
|
||||
UidFontBuilt = false;
|
||||
FontText(text, font, color == null ? ImGui.GetColorU32(ImGuiCol.Text) : ImGui.GetColorU32(color.Value));
|
||||
}
|
||||
|
||||
if (File.Exists(fontFile))
|
||||
private void FontText(string text, IFontHandle font, uint color)
|
||||
{
|
||||
try
|
||||
{
|
||||
UidFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(fontFile, 35);
|
||||
UidFontBuilt = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "Font failed to load. {fontFile}", fontFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogDebug("Font doesn't exist. {fontFile}", fontFile);
|
||||
}
|
||||
using var pushedFont = font.Push();
|
||||
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, color);
|
||||
ImGui.TextUnformatted(text);
|
||||
}
|
||||
|
||||
public sealed record IconScaleData(Vector2 IconSize, Vector2 NormalizedIconScale, float OffsetX, float IconScaling);
|
||||
}
|
||||
@@ -152,10 +152,10 @@
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return _baseStream.ToString();
|
||||
return _baseStream?.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
private class Bandwidth
|
||||
private sealed class Bandwidth
|
||||
{
|
||||
private long _count;
|
||||
private int _lastSecondCheckpoint;
|
||||
@@ -175,7 +175,7 @@
|
||||
{
|
||||
int elapsedTime = Environment.TickCount - _lastSecondCheckpoint + 1;
|
||||
receivedBytesCount = Interlocked.Add(ref _lastTransferredBytesCount, receivedBytesCount);
|
||||
double momentSpeed = receivedBytesCount * 1000 / elapsedTime; // B/s
|
||||
double momentSpeed = receivedBytesCount * 1000 / (double)elapsedTime; // B/s
|
||||
|
||||
if (1000 < elapsedTime)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
Mediator.Subscribe<DalamudLoginMessage>(this, (_) => DalamudUtilOnLogIn());
|
||||
Mediator.Subscribe<DalamudLogoutMessage>(this, (_) => DalamudUtilOnLogOut());
|
||||
Mediator.Subscribe<HubClosedMessage>(this, (msg) => MareHubOnClosed(msg.Exception));
|
||||
Mediator.Subscribe<HubReconnectedMessage>(this, async (msg) => await MareHubOnReconnected().ConfigureAwait(false));
|
||||
Mediator.Subscribe<HubReconnectedMessage>(this, (msg) => _ = MareHubOnReconnected());
|
||||
Mediator.Subscribe<HubReconnectingMessage>(this, (msg) => MareHubOnReconnecting(msg.Exception));
|
||||
Mediator.Subscribe<CyclePauseMessage>(this, (msg) => _ = CyclePause(msg.UserData));
|
||||
Mediator.Subscribe<CensusUpdateMessage>(this, (msg) => _lastCensus = msg);
|
||||
@@ -118,7 +118,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
Logger.LogInformation("Not recreating Connection, paused");
|
||||
_connectionDto = null;
|
||||
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource.Cancel();
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
Logger.LogWarning("No secret key set for current character");
|
||||
_connectionDto = null;
|
||||
await StopConnection(ServerState.NoSecretKey).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource.Cancel();
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,8 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_connectionCancellationTokenSource.Cancel();
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
_connectionCancellationTokenSource?.Dispose();
|
||||
_connectionCancellationTokenSource = new CancellationTokenSource();
|
||||
var token = _connectionCancellationTokenSource.Token;
|
||||
while (ServerState is not ServerState.Connected && !token.IsCancellationRequested)
|
||||
@@ -206,6 +207,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
|
||||
if (_dalamudUtil.HasModifiedGameFiles)
|
||||
{
|
||||
Logger.LogError("Detected modified game files on connection");
|
||||
Mediator.Publish(new NotificationMessage("Modified Game Files detected",
|
||||
"Mare has detected modified game files in your FFXIV installation. You will be able to connect, but the synchronization functionality might be (partially) broken. " +
|
||||
"Exit the game and repair it through XIVLauncher to get rid of this message.",
|
||||
|
||||
Reference in New Issue
Block a user