Merge branch '1.11.10' into pause-fix-and-performance
This commit is contained in:
@@ -8,7 +8,6 @@ using LightlessSync.API.Data.Extensions;
|
||||
using LightlessSync.API.Dto.Group;
|
||||
using LightlessSync.Interop.Ipc;
|
||||
using LightlessSync.LightlessConfiguration;
|
||||
using LightlessSync.LightlessConfiguration.Configurations;
|
||||
using LightlessSync.PlayerData.Handlers;
|
||||
using LightlessSync.PlayerData.Pairs;
|
||||
using LightlessSync.Services;
|
||||
@@ -35,6 +34,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private readonly CharacterAnalyzer _characterAnalyzer;
|
||||
private readonly ApiController _apiController;
|
||||
private readonly LightlessConfigService _configService;
|
||||
private readonly LightlessMediator _lightlessMediator;
|
||||
private readonly ConcurrentDictionary<GameObjectHandler, Dictionary<string, FileDownloadStatus>> _currentDownloads = new();
|
||||
private readonly DrawEntityFactory _drawEntityFactory;
|
||||
private readonly FileUploadManager _fileTransferManager;
|
||||
@@ -57,7 +57,6 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private string _lastAddedUserComment = string.Empty;
|
||||
private Vector2 _lastPosition = Vector2.One;
|
||||
private Vector2 _lastSize = Vector2.One;
|
||||
private int _secretKeyIdx = -1;
|
||||
private bool _showModalForUserAddition;
|
||||
private float _transferPartHeight;
|
||||
private bool _wasOpen;
|
||||
@@ -68,7 +67,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
TagHandler tagHandler, DrawEntityFactory drawEntityFactory,
|
||||
SelectTagForPairUi selectTagForPairUi, SelectPairForTagUi selectPairForTagUi, RenamePairTagUi renameTagUi,
|
||||
SelectTagForSyncshellUi selectTagForSyncshellUi, SelectSyncshellForTagUi selectSyncshellForTagUi, RenameSyncshellTagUi renameSyncshellTagUi,
|
||||
PerformanceCollectorService performanceCollectorService, IpcManager ipcManager, CharacterAnalyzer characterAnalyzer, PlayerPerformanceConfigService playerPerformanceConfig)
|
||||
PerformanceCollectorService performanceCollectorService, IpcManager ipcManager, CharacterAnalyzer characterAnalyzer, PlayerPerformanceConfigService playerPerformanceConfig, LightlessMediator lightlessMediator)
|
||||
: base(logger, mediator, "###LightlessSyncMainUI", performanceCollectorService)
|
||||
{
|
||||
_uiSharedService = uiShared;
|
||||
@@ -124,7 +123,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
};
|
||||
|
||||
_drawFolders = GetDrawFolders().ToList();
|
||||
_drawFolders = [.. GetDrawFolders()];
|
||||
|
||||
#if DEBUG
|
||||
string dev = "Dev Build";
|
||||
@@ -152,6 +151,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
};
|
||||
_characterAnalyzer = characterAnalyzer;
|
||||
_playerPerformanceConfig = playerPerformanceConfig;
|
||||
_lightlessMediator = lightlessMediator;
|
||||
}
|
||||
|
||||
protected override void DrawInternal()
|
||||
@@ -430,7 +430,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
ImGui.SetClipboardText(uidText);
|
||||
}
|
||||
|
||||
if (_cachedAnalysis != null)
|
||||
if (_cachedAnalysis != null && _apiController.ServerState is ServerState.Connected)
|
||||
{
|
||||
var firstEntry = _cachedAnalysis.FirstOrDefault();
|
||||
var valueDict = firstEntry.Value;
|
||||
@@ -460,6 +460,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
ImGui.SameLine();
|
||||
_uiSharedService.IconText(FontAwesomeIcon.ExclamationTriangle, UIColors.Get("LightlessYellow"));
|
||||
|
||||
string warningMessage = "";
|
||||
if (isOverTriHold)
|
||||
{
|
||||
@@ -474,6 +475,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
$"{UiSharedService.ByteToString(actualVramUsage - (_playerPerformanceConfig.Current.VRAMSizeWarningThresholdMiB * 1024 * 1024))}.";
|
||||
}
|
||||
UiSharedService.AttachToolTip(warningMessage);
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
_lightlessMediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,7 +499,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
UiSharedService.AttachToolTip("Click to copy");
|
||||
if (ImGui.IsItemClicked())
|
||||
{
|
||||
ImGui.SetClipboardText(_apiController.UID);
|
||||
_lightlessMediator.Publish(new UiToggleMessage(typeof(DataAnalysisUi)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -543,6 +548,8 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
=> u.Value.Exists(g => string.Equals(g.GID, group.GID, StringComparison.Ordinal));
|
||||
bool FilterNotTaggedUsers(KeyValuePair<Pair, List<GroupFullInfoDto>> u)
|
||||
=> u.Key.IsDirectlyPaired && !u.Key.IsOneSidedPair && !_tagHandler.HasAnyPairTag(u.Key.UserData.UID);
|
||||
bool FilterNotTaggedSyncshells(GroupFullInfoDto group)
|
||||
=> (!_tagHandler.HasAnySyncshellTag(group.GID) && !_configService.Current.ShowGroupedSyncshellsInAll) || _configService.Current.ShowGroupedSyncshellsInAll;
|
||||
bool FilterOfflineUsers(KeyValuePair<Pair, List<GroupFullInfoDto>> u)
|
||||
=> ((u.Key.IsDirectlyPaired && _configService.Current.ShowSyncshellOfflineUsersSeparately)
|
||||
|| !_configService.Current.ShowSyncshellOfflineUsersSeparately)
|
||||
@@ -566,7 +573,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
foreach (var group in _pairManager.GroupPairs.Select(g => g.Key).OrderBy(g => g.GroupAliasOrGID, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
GetGroups(allPairs, filteredPairs, group, out ImmutableList<Pair> allGroupPairs, out Dictionary<Pair, List<GroupFullInfoDto>> filteredGroupPairs);
|
||||
groupFolders.Add(_drawEntityFactory.CreateDrawGroupFolder(group, filteredGroupPairs, allGroupPairs));
|
||||
if (FilterNotTaggedSyncshells(group))
|
||||
{
|
||||
groupFolders.Add(_drawEntityFactory.CreateDrawGroupFolder(group, filteredGroupPairs, allGroupPairs));
|
||||
}
|
||||
}
|
||||
|
||||
if (_configService.Current.GroupUpSyncshells)
|
||||
|
||||
@@ -633,25 +633,6 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_lastTab = "FileCache";
|
||||
|
||||
_uiShared.UnderlinedBigText("Export MCDF", UIColors.Get("LightlessBlue"));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
UiSharedService.ColorTextWrapped("Exporting MCDF has moved.", UIColors.Get("LightlessYellow"));
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
UiSharedService.TextWrapped("It is now found in the Main UI under \"Your User Menu\" (");
|
||||
ImGui.SameLine();
|
||||
_uiShared.IconText(FontAwesomeIcon.UserCog);
|
||||
ImGui.SameLine();
|
||||
UiSharedService.TextWrapped(") -> \"Character Data Hub\".");
|
||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Running, "Open Lightless Character Data Hub"))
|
||||
{
|
||||
Mediator.Publish(new UiToggleMessage(typeof(CharaDataHubUi)));
|
||||
}
|
||||
UiSharedService.TextWrapped("Note: this entry will be removed in the near future. Please use the Main UI to open the Character Data Hub.");
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
ImGui.Separator();
|
||||
|
||||
_uiShared.UnderlinedBigText("Storage", UIColors.Get("LightlessBlue"));
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
@@ -946,6 +927,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
var preferNotesInsteadOfName = _configService.Current.PreferNotesOverNamesForVisible;
|
||||
var useFocusTarget = _configService.Current.UseFocusTarget;
|
||||
var groupUpSyncshells = _configService.Current.GroupUpSyncshells;
|
||||
var groupedSyncshells = _configService.Current.ShowGroupedSyncshellsInAll;
|
||||
var groupInVisible = _configService.Current.ShowSyncshellUsersInVisible;
|
||||
var syncshellOfflineSeparate = _configService.Current.ShowSyncshellOfflineUsersSeparately;
|
||||
|
||||
@@ -1163,6 +1145,14 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
_uiShared.DrawHelpText("This will group up all Syncshells in a special 'All Syncshells' folder in the main UI.");
|
||||
|
||||
if (ImGui.Checkbox("Show grouped syncshells in main screen/all syncshells", ref groupedSyncshells))
|
||||
{
|
||||
_configService.Current.ShowGroupedSyncshellsInAll = groupedSyncshells;
|
||||
_configService.Save();
|
||||
Mediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
_uiShared.DrawHelpText("This will show grouped syncshells in main screen or group 'All Syncshells'.");
|
||||
|
||||
if (ImGui.Checkbox("Show player name for visible players", ref showNameInsteadOfNotes))
|
||||
{
|
||||
_configService.Current.ShowCharacterNameInsteadOfNotesForVisible = showNameInsteadOfNotes;
|
||||
|
||||
@@ -195,9 +195,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 3, tableFlags);
|
||||
if (table)
|
||||
{
|
||||
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 5);
|
||||
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 4);
|
||||
ImGui.TableSetupColumn("Flags", ImGuiTableColumnFlags.None, 1);
|
||||
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 2);
|
||||
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 3);
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var groupedPairs = new Dictionary<Pair, GroupPairUserInfo?>(pairs.Select(p => new KeyValuePair<Pair, GroupPairUserInfo?>(p,
|
||||
@@ -254,13 +254,32 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.TableNextColumn(); // actions
|
||||
if (_isOwner)
|
||||
{
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.UserShield))
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("LightlessYellow")))
|
||||
{
|
||||
GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None;
|
||||
using (ImRaii.Disabled(!UiSharedService.ShiftPressed()))
|
||||
{
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Crown))
|
||||
{
|
||||
_ = _apiController.GroupChangeOwnership(new(GroupFullInfo.Group, pair.Key.UserData));
|
||||
IsOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
userInfo.SetModerator(!userInfo.IsModerator());
|
||||
}
|
||||
UiSharedService.AttachToolTip("Hold SHIFT and click to transfer ownership of this Syncshell to "
|
||||
+ (pair.Key.UserData.AliasOrUID) + Environment.NewLine + "WARNING: This action is irreversible and will close screen.");
|
||||
ImGui.SameLine();
|
||||
|
||||
_ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo));
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, pair.Value != null && pair.Value.Value.IsModerator() ? UIColors.Get("DimRed") : UIColors.Get("PairBlue")))
|
||||
{
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.UserShield))
|
||||
{
|
||||
GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None;
|
||||
|
||||
userInfo.SetModerator(!userInfo.IsModerator());
|
||||
|
||||
_ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo));
|
||||
}
|
||||
}
|
||||
UiSharedService.AttachToolTip(pair.Value != null && pair.Value.Value.IsModerator() ? "Demod user" : "Mod user");
|
||||
ImGui.SameLine();
|
||||
|
||||
Reference in New Issue
Block a user