Compare commits
17 Commits
ui-updates
...
0.2.4
Author | SHA1 | Date | |
---|---|---|---|
b4cad9c745 | |||
100c5612dc | |||
b8e0100bdf | |||
137db42446
|
|||
956d2009eb | |||
ec66da8b5e | |||
0555ee0db7
|
|||
837b487281
|
|||
9a0f2c062c
|
|||
![]() |
6e9c69c2a8 | ||
f0cef81b5e | |||
d8160effd0
|
|||
18da07763c
|
|||
3c448f2290
|
|||
cadc7e223f | |||
e1baca7940 | |||
c2e0cf65a8 |
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
.editorconfig = .editorconfig
|
.editorconfig = .editorconfig
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnowcloakSync", "SnowcloakSync\SnowcloakSync.csproj", "{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -36,6 +38,14 @@ Global
|
|||||||
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|x64.ActiveCfg = Release|Any CPU
|
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|x64.Build.0 = Release|Any CPU
|
{5A0B7434-8D89-4E90-B55C-B4A7AE1A6ADE}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{E633A968-2FB8-48FF-8136-5EBAEDF8E6F3}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
|
<Project Sdk="Dalamud.NET.Sdk/13.1.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyName>Snowcloak</AssemblyName>
|
<AssemblyName>Snowcloak</AssemblyName>
|
||||||
<Version>0.2.1</Version>
|
<Version>0.2.4</Version>
|
||||||
<PackageProjectUrl>https://github.com/Eauldane/SnowcloakClient/</PackageProjectUrl>
|
<PackageProjectUrl>https://git.snowcloak-sync.com/Eauldane/SnowcloakClient/</PackageProjectUrl>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MareAPI\MareSynchronosAPI\MareSynchronos.API.csproj" />
|
<ProjectReference Include="..\MareAPI\MareSynchronosAPI\MareSynchronos.API.csproj" />
|
||||||
|
<ProjectReference Include="..\SnowcloakSync\SnowcloakSync.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -14,8 +14,9 @@ namespace MareSynchronos.Services;
|
|||||||
|
|
||||||
public sealed class CommandManagerService : IDisposable
|
public sealed class CommandManagerService : IDisposable
|
||||||
{
|
{
|
||||||
private const string _commandName = "/sync";
|
private const string _commandName = "/snow";
|
||||||
private const string _commandName2 = "/snowcloak";
|
private const string _commandName2 = "/snowcloak";
|
||||||
|
private const string _commandName3 = "/sync";
|
||||||
|
|
||||||
private const string _ssCommandPrefix = "/ss";
|
private const string _ssCommandPrefix = "/ss";
|
||||||
|
|
||||||
@@ -48,6 +49,10 @@ public sealed class CommandManagerService : IDisposable
|
|||||||
{
|
{
|
||||||
HelpMessage = "Opens the Snowcloak UI"
|
HelpMessage = "Opens the Snowcloak UI"
|
||||||
});
|
});
|
||||||
|
_commandManager.AddHandler(_commandName3, new CommandInfo(OnCommand)
|
||||||
|
{
|
||||||
|
HelpMessage = "Opens the Snowcloak UI"
|
||||||
|
});
|
||||||
|
|
||||||
// Lazy registration of all possible /ss# commands which tbf is what the game does for linkshells anyway
|
// Lazy registration of all possible /ss# commands which tbf is what the game does for linkshells anyway
|
||||||
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
|
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
|
||||||
|
@@ -1054,7 +1054,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||||||
_configService.Current.OpenMareHubOnGposeStart = openInGpose;
|
_configService.Current.OpenMareHubOnGposeStart = openInGpose;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
_uiSharedService.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /sync gpose");
|
_uiSharedService.DrawHelpText("This will automatically open the import menu when loading into Gpose. If unchecked you can open the menu manually with /snow gpose");
|
||||||
bool downloadDataOnConnection = _configService.Current.DownloadMcdDataOnConnection;
|
bool downloadDataOnConnection = _configService.Current.DownloadMcdDataOnConnection;
|
||||||
if (ImGui.Checkbox("Download Online Character Data on connecting", ref downloadDataOnConnection))
|
if (ImGui.Checkbox("Download Online Character Data on connecting", ref downloadDataOnConnection))
|
||||||
{
|
{
|
||||||
|
@@ -105,7 +105,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
|||||||
protected override void DrawInternal()
|
protected override void DrawInternal()
|
||||||
{
|
{
|
||||||
if (_serverManager.CurrentApiUrl.Equals(ApiController.SnowcloakServiceUri, StringComparison.Ordinal))
|
if (_serverManager.CurrentApiUrl.Equals(ApiController.SnowcloakServiceUri, StringComparison.Ordinal))
|
||||||
UiSharedService.AccentColor = new(0.4275f, 0.6863f, 1f, 1f);
|
UiSharedService.AccentColor = SnowcloakSync.Utils.Colours._snowcloakOnline;
|
||||||
else
|
else
|
||||||
UiSharedService.AccentColor = ImGuiColors.ParsedGreen;
|
UiSharedService.AccentColor = ImGuiColors.ParsedGreen;
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetStyle().WindowPadding.Y - 1f * ImGuiHelpers.GlobalScale + ImGui.GetStyle().ItemSpacing.Y);
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetStyle().WindowPadding.Y - 1f * ImGuiHelpers.GlobalScale + ImGui.GetStyle().ItemSpacing.Y);
|
||||||
@@ -362,13 +362,14 @@ public class CompactUi : WindowMediatorSubscriberBase
|
|||||||
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
|
: (ImGui.GetWindowContentRegionMax().Y - ImGui.GetWindowContentRegionMin().Y) - TransferPartHeight - ImGui.GetCursorPosY();
|
||||||
var users = GetFilteredUsers().OrderBy(u => u.GetPairSortKey(), StringComparer.Ordinal);
|
var users = GetFilteredUsers().OrderBy(u => u.GetPairSortKey(), StringComparer.Ordinal);
|
||||||
|
|
||||||
var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
var onlineUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.IsOnline && !u.IsVisible && (!u.UserPair!.OtherPermissions.IsPaused() && !u.UserPair!.OwnPermissions.IsPaused()))).Select(c => new DrawUserPair("Online" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
||||||
|
var pausedUsers = users.Where(u => u.UserPair!.OtherPermissions.IsPaired() && (u.UserPair!.OtherPermissions.IsPaused() || u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Paused" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
||||||
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
var visibleUsers = users.Where(u => u.IsVisible).Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
||||||
var offlineUsers = users.Where(u => !u.UserPair!.OtherPermissions.IsPaired() || (!u.IsOnline && !u.UserPair!.OwnPermissions.IsPaused())).Select(c => new DrawUserPair("Offline" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
var offlineUsers = users.Where(u => !u.UserPair!.OtherPermissions.IsPaired() || !u.IsOnline && (!u.UserPair!.OwnPermissions.IsPaused() && !u.UserPair.OtherPermissions.IsPaused())).Select(c => new DrawUserPair("Offline" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager)).ToList();
|
||||||
|
|
||||||
ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false);
|
ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false);
|
||||||
|
|
||||||
_pairGroupsUi.Draw(visibleUsers, onlineUsers, offlineUsers);
|
_pairGroupsUi.Draw(visibleUsers, onlineUsers, pausedUsers, offlineUsers);
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
}
|
}
|
||||||
|
@@ -129,7 +129,7 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
|
|
||||||
protected override float DrawRightSide(float textPosY, float originalY)
|
protected override float DrawRightSide(float textPosY, float originalY)
|
||||||
{
|
{
|
||||||
var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
var pauseIcon = _pair.IsPaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||||
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
|
||||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||||
var entryUID = _fullInfoDto.UserAliasOrUID;
|
var entryUID = _fullInfoDto.UserAliasOrUID;
|
||||||
@@ -296,9 +296,10 @@ public class DrawGroupPair : DrawPairBase
|
|||||||
|
|
||||||
if (_uiSharedService.IconButton(pauseIcon))
|
if (_uiSharedService.IconButton(pauseIcon))
|
||||||
{
|
{
|
||||||
var perm = _fullInfoDto.GroupUserPermissions;
|
var perm = _pair.UserPair!.OwnPermissions;
|
||||||
var newPaused = !perm.IsPaused();
|
perm.SetPaused(!perm.IsPaused());
|
||||||
perm.SetPaused(newPaused);
|
_ = _apiController.UserSetPairPermissions(new(_pair.UserData, perm));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()
|
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()
|
||||||
|
@@ -52,26 +52,27 @@ public class DrawUserPair : DrawPairBase
|
|||||||
{
|
{
|
||||||
connectionIcon = FontAwesomeIcon.PauseCircle;
|
connectionIcon = FontAwesomeIcon.PauseCircle;
|
||||||
connectionText = "Pairing status with " + _pair.UserData.AliasOrUID + " is paused";
|
connectionText = "Pairing status with " + _pair.UserData.AliasOrUID + " is paused";
|
||||||
connectionColor = ImGuiColors.DalamudYellow;
|
connectionColor = ImGuiColors.DalamudGrey;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connectionIcon = FontAwesomeIcon.Check;
|
connectionIcon = FontAwesomeIcon.Snowflake;
|
||||||
connectionText = "You are paired with " + _pair.UserData.AliasOrUID;
|
connectionText = "You are paired with " + _pair.UserData.AliasOrUID;
|
||||||
connectionColor = ImGuiColors.ParsedGreen;
|
connectionColor = _pair.IsOnline ? SnowcloakSync.Utils.Colours._snowcloakOnline : ImGuiColors.DalamudGrey;
|
||||||
}
|
}
|
||||||
|
if (!_pair.IsVisible)
|
||||||
ImGui.SetCursorPosY(textPosY);
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
|
||||||
UiSharedService.ColorText(connectionIcon.ToIconString(), connectionColor);
|
|
||||||
ImGui.PopFont();
|
|
||||||
UiSharedService.AttachToolTip(connectionText);
|
|
||||||
if (_pair is { IsOnline: true, IsVisible: true })
|
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
|
||||||
ImGui.SetCursorPosY(textPosY);
|
ImGui.SetCursorPosY(textPosY);
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(UiBuilder.IconFont);
|
||||||
UiSharedService.ColorText(FontAwesomeIcon.Eye.ToIconString(), ImGuiColors.ParsedGreen);
|
UiSharedService.ColorText(connectionIcon.ToIconString(), connectionColor);
|
||||||
|
ImGui.PopFont();
|
||||||
|
UiSharedService.AttachToolTip(connectionText);
|
||||||
|
}
|
||||||
|
if (_pair is { IsOnline: true, IsVisible: true })
|
||||||
|
{
|
||||||
|
ImGui.SetCursorPosY(textPosY);
|
||||||
|
ImGui.PushFont(UiBuilder.IconFont);
|
||||||
|
UiSharedService.ColorText(FontAwesomeIcon.Eye.ToIconString(), SnowcloakSync.Utils.Colours._snowcloakOnline);
|
||||||
if (ImGui.IsItemClicked())
|
if (ImGui.IsItemClicked())
|
||||||
{
|
{
|
||||||
_mediator.Publish(new TargetPairMessage(_pair));
|
_mediator.Publish(new TargetPairMessage(_pair));
|
||||||
|
@@ -418,11 +418,23 @@ internal sealed class GroupPanel
|
|||||||
ImGui.Indent(20);
|
ImGui.Indent(20);
|
||||||
if (_expandedGroupState[groupDto.GID])
|
if (_expandedGroupState[groupDto.GID])
|
||||||
{
|
{
|
||||||
var sortedPairs = pairsInGroup
|
IOrderedEnumerable<Pair> sortedPairs;
|
||||||
.OrderByDescending(u => string.Equals(u.UserData.UID, groupDto.OwnerUID, StringComparison.Ordinal))
|
if (!_mareConfig.Current.SortSyncshellsByVRAM)
|
||||||
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsModerator())
|
{
|
||||||
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsPinned())
|
sortedPairs = pairsInGroup
|
||||||
.ThenBy(u => u.GetPairSortKey(), StringComparer.OrdinalIgnoreCase);
|
.OrderByDescending(u => string.Equals(u.UserData.UID, groupDto.OwnerUID, StringComparison.Ordinal))
|
||||||
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsModerator())
|
||||||
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsPinned())
|
||||||
|
.ThenBy(u => u.GetPairSortKey(), StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sortedPairs = pairsInGroup
|
||||||
|
.OrderByDescending(u => string.Equals(u.UserData.UID, groupDto.OwnerUID, StringComparison.Ordinal))
|
||||||
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsModerator())
|
||||||
|
.ThenByDescending(u => u.GroupPair[groupDto].GroupPairStatusInfo.IsPinned())
|
||||||
|
.ThenByDescending(u => u.LastAppliedApproximateVRAMBytes);
|
||||||
|
}
|
||||||
|
|
||||||
var visibleUsers = new List<DrawGroupPair>();
|
var visibleUsers = new List<DrawGroupPair>();
|
||||||
var onlineUsers = new List<DrawGroupPair>();
|
var onlineUsers = new List<DrawGroupPair>();
|
||||||
|
@@ -28,15 +28,15 @@ public class PairGroupsUi
|
|||||||
_uiSharedService = uiSharedService;
|
_uiSharedService = uiSharedService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw<T>(List<T> visibleUsers, List<T> onlineUsers, List<T> offlineUsers) where T : DrawPairBase
|
public void Draw<T>(List<T> visibleUsers, List<T> onlineUsers, List<T> pausedUsers, List<T> offlineUsers) where T : DrawPairBase
|
||||||
{
|
{
|
||||||
// Only render those tags that actually have pairs in them, otherwise
|
// Only render those tags that actually have pairs in them, otherwise
|
||||||
// we can end up with a bunch of useless pair groups
|
// we can end up with a bunch of useless pair groups
|
||||||
var tagsWithPairsInThem = _tagHandler.GetAllTagsSorted();
|
var tagsWithPairsInThem = _tagHandler.GetAllTagsSorted();
|
||||||
var allUsers = onlineUsers.Concat(offlineUsers).ToList();
|
var allUsers = onlineUsers.Concat(offlineUsers).Concat(pausedUsers).ToList();
|
||||||
if (typeof(T) == typeof(DrawUserPair))
|
if (typeof(T) == typeof(DrawUserPair))
|
||||||
{
|
{
|
||||||
DrawUserPairs(tagsWithPairsInThem, allUsers.Cast<DrawUserPair>().ToList(), visibleUsers.Cast<DrawUserPair>(), onlineUsers.Cast<DrawUserPair>(), offlineUsers.Cast<DrawUserPair>());
|
DrawUserPairs(tagsWithPairsInThem, allUsers.Cast<DrawUserPair>().ToList(), visibleUsers.Cast<DrawUserPair>(), onlineUsers.Cast<DrawUserPair>(), pausedUsers.Cast<DrawUserPair>(), offlineUsers.Cast<DrawUserPair>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,13 +91,19 @@ public class PairGroupsUi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCategory(string tag, IEnumerable<DrawPairBase> onlineUsers, IEnumerable<DrawPairBase> allUsers, IEnumerable<DrawPairBase>? visibleUsers = null)
|
private void DrawCategory(string tag, IEnumerable<DrawPairBase> onlineUsers, IEnumerable<DrawPairBase> pausedUsers, IEnumerable<DrawPairBase> allUsers, IEnumerable<DrawPairBase>? visibleUsers = null)
|
||||||
{
|
{
|
||||||
IEnumerable<DrawPairBase> usersInThisTag;
|
IEnumerable<DrawPairBase> usersInThisTag;
|
||||||
HashSet<string>? otherUidsTaggedWithTag = null;
|
HashSet<string>? otherUidsTaggedWithTag = null;
|
||||||
bool isSpecialTag = false;
|
bool isSpecialTag = false;
|
||||||
int visibleInThisTag = 0;
|
int visibleInThisTag = 0;
|
||||||
if (tag is TagHandler.CustomOfflineTag or TagHandler.CustomOnlineTag or TagHandler.CustomVisibleTag or TagHandler.CustomUnpairedTag)
|
|
||||||
|
if (tag is TagHandler.CustomPausedTag)
|
||||||
|
{
|
||||||
|
usersInThisTag = pausedUsers;
|
||||||
|
isSpecialTag = true;
|
||||||
|
}
|
||||||
|
else if (tag is TagHandler.CustomOfflineTag or TagHandler.CustomOnlineTag or TagHandler.CustomVisibleTag or TagHandler.CustomUnpairedTag)
|
||||||
{
|
{
|
||||||
usersInThisTag = onlineUsers;
|
usersInThisTag = onlineUsers;
|
||||||
isSpecialTag = true;
|
isSpecialTag = true;
|
||||||
@@ -113,14 +119,13 @@ public class PairGroupsUi
|
|||||||
|
|
||||||
if (isSpecialTag && !usersInThisTag.Any()) return;
|
if (isSpecialTag && !usersInThisTag.Any()) return;
|
||||||
|
|
||||||
DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count(), otherUidsTaggedWithTag?.Count);
|
DrawName(tag, isSpecialTag, visibleInThisTag, usersInThisTag.Count(), pausedUsers.Count(), otherUidsTaggedWithTag?.Count);
|
||||||
if (!isSpecialTag)
|
if (!isSpecialTag)
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast<DrawUserPair>().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList());
|
using (ImRaii.PushId($"group-{tag}-buttons")) DrawButtons(tag, allUsers.Cast<DrawUserPair>().Where(p => otherUidsTaggedWithTag!.Contains(p.UID)).ToList());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Avoid uncomfortably close group names
|
|
||||||
if (!_tagHandler.IsTagOpen(tag))
|
if (!_tagHandler.IsTagOpen(tag))
|
||||||
{
|
{
|
||||||
var size = ImGui.CalcTextSize("").Y + ImGui.GetStyle().FramePadding.Y * 2f;
|
var size = ImGui.CalcTextSize("").Y + ImGui.GetStyle().FramePadding.Y * 2f;
|
||||||
@@ -151,18 +156,19 @@ public class PairGroupsUi
|
|||||||
UiSharedService.AttachToolTip($"Delete Group {tag} (Will not delete the pairs)" + Environment.NewLine + "Hold CTRL to delete");
|
UiSharedService.AttachToolTip($"Delete Group {tag} (Will not delete the pairs)" + Environment.NewLine + "Hold CTRL to delete");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawName(string tag, bool isSpecialTag, int visible, int online, int? total)
|
private void DrawName(string tag, bool isSpecialTag, int visible, int online, int paused, int? total)
|
||||||
{
|
{
|
||||||
string displayedName = tag switch
|
string displayedName = tag switch
|
||||||
{
|
{
|
||||||
TagHandler.CustomUnpairedTag => "Unpaired",
|
TagHandler.CustomUnpairedTag => "Unpaired",
|
||||||
TagHandler.CustomOfflineTag => "Offline",
|
TagHandler.CustomOfflineTag => "Offline",
|
||||||
TagHandler.CustomOnlineTag => _mareConfig.Current.ShowOfflineUsersSeparately ? "Online/Paused" : "Contacts",
|
TagHandler.CustomOnlineTag => _mareConfig.Current.ShowOfflineUsersSeparately ? "Online" : "Contacts",
|
||||||
|
TagHandler.CustomPausedTag => "Paused",
|
||||||
TagHandler.CustomVisibleTag => "Visible",
|
TagHandler.CustomVisibleTag => "Visible",
|
||||||
_ => tag
|
_ => tag
|
||||||
};
|
};
|
||||||
|
|
||||||
string resultFolderName = !isSpecialTag ? $"{displayedName} ({visible}/{online}/{total} Pairs)" : $"{displayedName} ({online} Pairs)";
|
string resultFolderName = !isSpecialTag ? $"{displayedName} ({visible}/{online}/{paused}/{total} Pairs)" : $"{displayedName} ({online} Pairs)";
|
||||||
|
|
||||||
// FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight
|
// FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight
|
||||||
var icon = _tagHandler.IsTagOpen(tag) ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight;
|
var icon = _tagHandler.IsTagOpen(tag) ? FontAwesomeIcon.CaretSquareDown : FontAwesomeIcon.CaretSquareRight;
|
||||||
@@ -184,7 +190,8 @@ public class PairGroupsUi
|
|||||||
ImGui.TextUnformatted($"Group {tag}");
|
ImGui.TextUnformatted($"Group {tag}");
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
ImGui.TextUnformatted($"{visible} Pairs visible");
|
ImGui.TextUnformatted($"{visible} Pairs visible");
|
||||||
ImGui.TextUnformatted($"{online} Pairs online/paused");
|
ImGui.TextUnformatted($"{online} Pairs online");
|
||||||
|
ImGui.TextUnformatted($"{paused} Pairs paused");
|
||||||
ImGui.TextUnformatted($"{total} Pairs total");
|
ImGui.TextUnformatted($"{total} Pairs total");
|
||||||
ImGui.EndTooltip();
|
ImGui.EndTooltip();
|
||||||
}
|
}
|
||||||
@@ -197,39 +204,45 @@ public class PairGroupsUi
|
|||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawUserPairs(List<string> tagsWithPairsInThem, List<DrawUserPair> allUsers, IEnumerable<DrawUserPair> visibleUsers, IEnumerable<DrawUserPair> onlineUsers, IEnumerable<DrawUserPair> offlineUsers)
|
private void DrawUserPairs(List<string> tagsWithPairsInThem, List<DrawUserPair> allUsers, IEnumerable<DrawUserPair> visibleUsers, IEnumerable<DrawUserPair> onlineUsers, IEnumerable<DrawUserPair> pausedUsers, IEnumerable<DrawUserPair> offlineUsers)
|
||||||
{
|
{
|
||||||
if (_mareConfig.Current.ShowVisibleUsersSeparately)
|
if (_mareConfig.Current.ShowVisibleUsersSeparately)
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId("$group-VisibleCustomTag")) DrawCategory(TagHandler.CustomVisibleTag, visibleUsers, allUsers);
|
using (ImRaii.PushId("$group-VisibleCustomTag")) DrawCategory(TagHandler.CustomVisibleTag, visibleUsers, Enumerable.Empty<DrawUserPair>(), allUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var tag in tagsWithPairsInThem)
|
foreach (var tag in tagsWithPairsInThem)
|
||||||
{
|
{
|
||||||
if (_mareConfig.Current.ShowOfflineUsersSeparately)
|
if (_mareConfig.Current.ShowOfflineUsersSeparately)
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId($"group-{tag}")) DrawCategory(tag, onlineUsers, allUsers, visibleUsers);
|
using (ImRaii.PushId($"group-{tag}")) DrawCategory(tag, onlineUsers, pausedUsers, allUsers, visibleUsers);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId($"group-{tag}")) DrawCategory(tag, allUsers, allUsers, visibleUsers);
|
using (ImRaii.PushId($"group-{tag}")) DrawCategory(tag, allUsers, Enumerable.Empty<DrawUserPair>(), allUsers, visibleUsers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mareConfig.Current.ShowOfflineUsersSeparately)
|
if (_mareConfig.Current.ShowOfflineUsersSeparately)
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId($"group-OnlineCustomTag")) DrawCategory(TagHandler.CustomOnlineTag,
|
using (ImRaii.PushId($"group-OnlineCustomTag")) DrawCategory(TagHandler.CustomOnlineTag,
|
||||||
onlineUsers.Where(u => !_tagHandler.HasAnyTag(u.UID)).ToList(), allUsers);
|
onlineUsers.Where(u => !_tagHandler.HasAnyTag(u.UID)).ToList(), Enumerable.Empty<DrawUserPair>(), allUsers);
|
||||||
|
if (pausedUsers.Any()) using (ImRaii.PushId("group-PausedCustomTag")) DrawCategory(TagHandler.CustomPausedTag,
|
||||||
|
Enumerable.Empty<DrawUserPair>(), pausedUsers, allUsers);
|
||||||
using (ImRaii.PushId($"group-OfflineCustomTag")) DrawCategory(TagHandler.CustomOfflineTag,
|
using (ImRaii.PushId($"group-OfflineCustomTag")) DrawCategory(TagHandler.CustomOfflineTag,
|
||||||
offlineUsers.Where(u => u.UserPair!.OtherPermissions.IsPaired()).ToList(), allUsers);
|
offlineUsers.Where(u => u.UserPair!.OtherPermissions.IsPaired()).ToList(), Enumerable.Empty<DrawUserPair>(), allUsers);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (ImRaii.PushId($"group-OnlineCustomTag")) DrawCategory(TagHandler.CustomOnlineTag,
|
using (ImRaii.PushId($"group-OnlineCustomTag")) DrawCategory(TagHandler.CustomOnlineTag,
|
||||||
onlineUsers.Concat(offlineUsers.Where(u => u.UserPair!.OtherPermissions.IsPaired())).Where(u => !_tagHandler.HasAnyTag(u.UID)).ToList(), allUsers);
|
onlineUsers.Concat(offlineUsers.Where(u => u.UserPair!.OtherPermissions.IsPaired())).Where(u => !_tagHandler.HasAnyTag(u.UID)).ToList(), Enumerable.Empty<DrawUserPair>(), allUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (ImRaii.PushId($"group-UnpairedCustomTag")) DrawCategory(TagHandler.CustomUnpairedTag,
|
using (ImRaii.PushId($"group-UnpairedCustomTag")) DrawCategory(TagHandler.CustomUnpairedTag,
|
||||||
offlineUsers.Where(u => !u.UserPair!.OtherPermissions.IsPaired()).ToList(), allUsers);
|
offlineUsers.Where(u => !u.UserPair!.OtherPermissions.IsPaired()).ToList(), Enumerable.Empty<DrawUserPair>(), allUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void PauseRemainingPairs(List<DrawUserPair> availablePairs)
|
private void PauseRemainingPairs(List<DrawUserPair> availablePairs)
|
||||||
{
|
{
|
||||||
foreach (var pairToPause in availablePairs.Where(pair => !pair.UserPair!.OwnPermissions.IsPaused()))
|
foreach (var pairToPause in availablePairs.Where(pair => !pair.UserPair!.OwnPermissions.IsPaused()))
|
||||||
|
@@ -203,10 +203,10 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
DtrStyle.Style4 => $"\xE03A {text}",
|
DtrStyle.Style4 => $"\xE03A {text}",
|
||||||
DtrStyle.Style5 => $"\xE033 {text}",
|
DtrStyle.Style5 => $"\xE033 {text}",
|
||||||
DtrStyle.Style6 => $"\xE038 {text}",
|
DtrStyle.Style6 => $"\xE038 {text}",
|
||||||
DtrStyle.Style7 => $"\xE05D {text}",
|
DtrStyle.Style7 => $"\xE044 {text}",
|
||||||
DtrStyle.Style8 => $"\xE03C{text}",
|
DtrStyle.Style8 => $"\xE03C{text}",
|
||||||
DtrStyle.Style9 => $"\xE040 {text} \xE041",
|
DtrStyle.Style9 => $"\xE040 {text} \xE041",
|
||||||
_ => $"\uE044 {text}"
|
_ => $"\uE05D {text}"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ public class TagHandler
|
|||||||
public const string CustomOnlineTag = "Mare_Online";
|
public const string CustomOnlineTag = "Mare_Online";
|
||||||
public const string CustomUnpairedTag = "Mare_Unpaired";
|
public const string CustomUnpairedTag = "Mare_Unpaired";
|
||||||
public const string CustomVisibleTag = "Mare_Visible";
|
public const string CustomVisibleTag = "Mare_Visible";
|
||||||
|
public const string CustomPausedTag = "Mare_Paused";
|
||||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||||
|
|
||||||
public TagHandler(ServerConfigurationManager serverConfigurationManager)
|
public TagHandler(ServerConfigurationManager serverConfigurationManager)
|
||||||
|
@@ -1083,12 +1083,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
_uiShared.DrawHelpText("This will put users using the most VRAM in a syncshell at the top of the list.");
|
_uiShared.DrawHelpText("This will put users using the most VRAM in a syncshell at the top of the list.");
|
||||||
if (ImGui.Checkbox("Show separate Offline group", ref showOfflineSeparate))
|
if (ImGui.Checkbox("Group users by connection status", ref showOfflineSeparate))
|
||||||
{
|
{
|
||||||
_configService.Current.ShowOfflineUsersSeparately = showOfflineSeparate;
|
_configService.Current.ShowOfflineUsersSeparately = showOfflineSeparate;
|
||||||
_configService.Save();
|
_configService.Save();
|
||||||
}
|
}
|
||||||
_uiShared.DrawHelpText("This will show all currently offline users in a special 'Offline' group in the main UI.");
|
_uiShared.DrawHelpText("This will categorize users by their connection status in the main UI.");
|
||||||
|
|
||||||
if (ImGui.Checkbox("Show player names", ref showCharacterNames))
|
if (ImGui.Checkbox("Show player names", ref showCharacterNames))
|
||||||
{
|
{
|
||||||
|
@@ -183,10 +183,12 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
|
|
||||||
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
|
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
|
||||||
|
|
||||||
|
await CheckClientHealth().ConfigureAwait(false);
|
||||||
|
|
||||||
ServerState = ServerState.Connected;
|
ServerState = ServerState.Connected;
|
||||||
|
|
||||||
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
|
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
|
||||||
|
|
||||||
if (_connectionDto.ServerVersion != IMareHub.ApiVersion)
|
if (_connectionDto.ServerVersion != IMareHub.ApiVersion)
|
||||||
{
|
{
|
||||||
if (_connectionDto.CurrentClientVersion > currentClientVer)
|
if (_connectionDto.CurrentClientVersion > currentClientVer)
|
||||||
@@ -308,14 +310,18 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
_ = Task.Run(async () => await StopConnection(ServerState.Disconnected).ConfigureAwait(false));
|
_ = Task.Run(async () => await StopConnection(ServerState.Disconnected).ConfigureAwait(false));
|
||||||
_connectionCancellationTokenSource?.Cancel();
|
_connectionCancellationTokenSource?.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ClientHealthCheck(CancellationToken ct)
|
private async Task ClientHealthCheck(CancellationToken ct)
|
||||||
{
|
{
|
||||||
while (!ct.IsCancellationRequested && _mareHub != null)
|
while (!ct.IsCancellationRequested && _mareHub != null)
|
||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
||||||
Logger.LogDebug("Checking Client Health State");
|
var healthy = await CheckClientHealth().ConfigureAwait(false);
|
||||||
_ = await CheckClientHealth().ConfigureAwait(false);
|
if (!healthy || _mareHub.State != HubConnectionState.Connected)
|
||||||
|
{
|
||||||
|
Logger.LogWarning("Health check failed, forcing reconnect. ClientHealth: {0} HubConnected: {1}", healthy, _mareHub.State != HubConnectionState.Connected);
|
||||||
|
await ForceResetConnection().ConfigureAwait(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +397,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
{
|
{
|
||||||
var users = await GroupsGetUsersInGroup(group).ConfigureAwait(false);
|
var users = await GroupsGetUsersInGroup(group).ConfigureAwait(false);
|
||||||
foreach (var user in users)
|
foreach (var user in users)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("Group Pair: {user}", user);
|
Logger.LogDebug("Group Pair: {user}", user);
|
||||||
_pairManager.AddGroupPair(user);
|
_pairManager.AddGroupPair(user);
|
||||||
}
|
}
|
||||||
@@ -478,5 +484,30 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
|
|
||||||
ServerState = state;
|
ServerState = state;
|
||||||
}
|
}
|
||||||
|
//Because this plugin really likes to bug out with connections, lets "fix" it....
|
||||||
|
public async Task ForceResetConnection()
|
||||||
|
{
|
||||||
|
if (!_initialized) return;
|
||||||
|
Logger.LogInformation("ForceReconnect called");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||||
|
|
||||||
|
// Cancel any ongoing health checks to prevent conflicts
|
||||||
|
_healthCheckTokenSource?.Cancel();
|
||||||
|
_healthCheckTokenSource?.Dispose();
|
||||||
|
_healthCheckTokenSource = null;
|
||||||
|
|
||||||
|
await CreateConnections().ConfigureAwait(false);
|
||||||
|
|
||||||
|
Logger.LogInformation("ForceReconnect completed successfully");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex, "Failure during ForceReconnect, disconnecting");
|
||||||
|
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore MA0040
|
#pragma warning restore MA0040
|
@@ -536,6 +536,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MessagePack.Annotations": "[2.5.129, )"
|
"MessagePack.Annotations": "[2.5.129, )"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"snowcloaksync": {
|
||||||
|
"type": "Project"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
SnowcloakSync/SnowcloakSync.csproj
Normal file
9
SnowcloakSync/SnowcloakSync.csproj
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
9
SnowcloakSync/Utils/Colours.cs
Normal file
9
SnowcloakSync/Utils/Colours.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace SnowcloakSync.Utils
|
||||||
|
{
|
||||||
|
public static class Colours
|
||||||
|
{
|
||||||
|
public static readonly Vector4 _snowcloakOnline = new(0.4275f, 0.6863f, 1f, 1f);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user