mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 22:17:22 +01:00
add shared character data sets display to main ui
This commit is contained in:
parent
7720bdc6a9
commit
2cb2e7ca78
5 changed files with 52 additions and 12 deletions
|
|
@ -93,8 +93,17 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
_pairManager = pairManager;
|
||||
_charaDataGposeTogetherManager = charaDataGposeTogetherManager;
|
||||
Mediator.Subscribe<GposeStartMessage>(this, (_) => IsOpen |= _configService.Current.OpenMareHubOnGposeStart);
|
||||
Mediator.Subscribe<OpenCharaDataHubWithFilterMessage>(this, (msg) =>
|
||||
{
|
||||
IsOpen = true;
|
||||
_openDataApplicationShared = true;
|
||||
_sharedWithYouOwnerFilter = msg.UserData.AliasOrUID;
|
||||
UpdateFilteredItems();
|
||||
});
|
||||
}
|
||||
|
||||
private bool _openDataApplicationShared = false;
|
||||
|
||||
public string CharaName(string name)
|
||||
{
|
||||
if (_abbreviateCharaName)
|
||||
|
|
@ -207,7 +216,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
}
|
||||
}
|
||||
|
||||
using (var applicationTabItem = ImRaii.TabItem("Data Application"))
|
||||
using (var applicationTabItem = ImRaii.TabItem("Data Application", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
if (applicationTabItem)
|
||||
{
|
||||
|
|
@ -243,7 +252,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
}
|
||||
}
|
||||
|
||||
using (var gposeTabItem = ImRaii.TabItem("Apply Data"))
|
||||
using (var gposeTabItem = ImRaii.TabItem("Apply Data", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
if (gposeTabItem)
|
||||
{
|
||||
|
|
@ -704,7 +713,7 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
}
|
||||
}
|
||||
|
||||
using (var sharedWithYouTabItem = ImRaii.TabItem("Shared With You"))
|
||||
using (var sharedWithYouTabItem = ImRaii.TabItem("Shared With You", _openDataApplicationShared ? ImGuiTabItemFlags.SetSelected : ImGuiTabItemFlags.None))
|
||||
{
|
||||
using var id = ImRaii.PushId("sharedWithYouTab");
|
||||
if (sharedWithYouTabItem)
|
||||
|
|
@ -718,8 +727,12 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
|
||||
DrawUpdateSharedDataButton();
|
||||
|
||||
|
||||
UiSharedService.DrawTree("Filters", () =>
|
||||
int activeFilters = 0;
|
||||
if (!string.IsNullOrEmpty(_sharedWithYouOwnerFilter)) activeFilters++;
|
||||
if (!string.IsNullOrEmpty(_sharedWithYouDescriptionFilter)) activeFilters++;
|
||||
if (_sharedWithYouDownloadableFilter) activeFilters++;
|
||||
string filtersText = activeFilters == 0 ? "Filters" : $"Filters ({activeFilters} active)";
|
||||
UiSharedService.DrawTree($"{filtersText}##filters", () =>
|
||||
{
|
||||
var filterWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||
ImGui.SetNextItemWidth(filterWidth);
|
||||
|
|
@ -758,6 +771,9 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
ImGuiHelpers.ScaledDummy(5);
|
||||
foreach (var entry in _filteredDict ?? [])
|
||||
{
|
||||
bool isFilteredAndHasToBeOpened = entry.Key.Contains(_sharedWithYouOwnerFilter) && _openDataApplicationShared;
|
||||
if (isFilteredAndHasToBeOpened)
|
||||
ImGui.SetNextItemOpen(isFilteredAndHasToBeOpened);
|
||||
UiSharedService.DrawTree($"{entry.Key} - [{entry.Value.Count} Character Data Sets]##{entry.Key}", () =>
|
||||
{
|
||||
foreach (var data in entry.Value)
|
||||
|
|
@ -766,6 +782,8 @@ internal sealed partial class CharaDataHubUi : WindowMediatorSubscriberBase
|
|||
}
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
});
|
||||
if (isFilteredAndHasToBeOpened)
|
||||
_openDataApplicationShared = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue