Mare 0.9 (#65)

* add jwt expiry

* start of 0.9 api impl

* some stuff idk

* some more impl

* some cleanup

* remove grouppair, add configuration, rework some pair drawing stuff

* do some stuff

* rework some ui

* I don't even know anymore

* add cancellationtoken

* token bla

* ui fixes etc

* probably individual adding/removing now working fully as expected

* add working report popup

* I guess it's more syncshell shit or so

* popup shit idk

* work out most of the syncshell bullshit I guess

* delete some old crap

* are we actually getting closer to the end

* update pair info stuff

* more fixes/adjustments, idk

* refactor some things

* some rework

* some more cleanup

* cleanup

* make menu buttons w i d e

* better icon text buttons

* add all syncshell folder and ordering fixes

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2023-10-17 21:36:44 +02:00
committed by GitHub
parent f15b8f6bbd
commit 14575a4a6b
111 changed files with 3456 additions and 3174 deletions

View File

@@ -1,37 +1,39 @@
using Dalamud.Interface.Colors;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using ImGuiNET;
using MareSynchronos.API.Data.Extensions;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Services.ServerConfiguration;
using Microsoft.Extensions.Logging;
using System.Numerics;
using MareSynchronos.API.Data.Extensions;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Internal;
namespace MareSynchronos.UI;
public class StandaloneProfileUi : WindowMediatorSubscriberBase
{
private readonly MareProfileManager _mareProfileManager;
private readonly PairManager _pairManager;
private readonly ServerConfigurationManager _serverManager;
private readonly UiSharedService _uiSharedService;
private bool _adjustedForScrollBars = false;
private byte[] _lastProfilePicture = Array.Empty<byte>();
private byte[] _lastSupporterPicture = Array.Empty<byte>();
private byte[] _lastProfilePicture = [];
private byte[] _lastSupporterPicture = [];
private IDalamudTextureWrap? _supporterTextureWrap;
private IDalamudTextureWrap? _textureWrap;
public StandaloneProfileUi(ILogger<StandaloneProfileUi> logger, MareMediator mediator, UiSharedService uiBuilder,
ServerConfigurationManager serverManager, MareProfileManager mareProfileManager, Pair pair)
ServerConfigurationManager serverManager, MareProfileManager mareProfileManager, PairManager pairManager, Pair pair)
: base(logger, mediator, "Mare Profile of " + pair.UserData.AliasOrUID + "##MareSynchronosStandaloneProfileUI" + pair.UserData.AliasOrUID)
{
_uiSharedService = uiBuilder;
_serverManager = serverManager;
_mareProfileManager = mareProfileManager;
Pair = pair;
_pairManager = pairManager;
Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.AlwaysAutoResize;
var spacing = ImGui.GetStyle().ItemSpacing;
@@ -88,12 +90,12 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
var descriptionChildHeight = rectMax.Y - pos.Y - rectMin.Y - spacing.Y * 2;
if (descriptionTextSize.Y > descriptionChildHeight && !_adjustedForScrollBars)
{
Size = Size.Value with { X = Size.Value.X + ImGui.GetStyle().ScrollbarSize };
Size = Size!.Value with { X = Size.Value.X + ImGui.GetStyle().ScrollbarSize };
_adjustedForScrollBars = true;
}
else if (descriptionTextSize.Y < descriptionChildHeight && _adjustedForScrollBars)
{
Size = Size.Value with { X = Size.Value.X - ImGui.GetStyle().ScrollbarSize };
Size = Size!.Value with { X = Size.Value.X - ImGui.GetStyle().ScrollbarSize };
_adjustedForScrollBars = false;
}
var childFrame = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, descriptionChildHeight);
@@ -137,13 +139,15 @@ public class StandaloneProfileUi : WindowMediatorSubscriberBase
UiSharedService.ColorText("They: paused", ImGuiColors.DalamudYellow);
}
}
if (Pair.GroupPair.Any())
if (Pair.UserPair.Groups.Any())
{
ImGui.TextUnformatted("Paired through Syncshells:");
foreach (var groupPair in Pair.GroupPair.Select(k => k.Key))
foreach (var group in Pair.UserPair.Groups)
{
var groupNote = _serverManager.GetNoteForGid(groupPair.GID);
var groupString = string.IsNullOrEmpty(groupNote) ? groupPair.GroupAliasOrGID : $"{groupNote} ({groupPair.GroupAliasOrGID})";
var groupNote = _serverManager.GetNoteForGid(group);
var groupName = _pairManager.GroupPairs.First(f => string.Equals(f.Key.GID, group, StringComparison.Ordinal)).Key.GroupAliasOrGID;
var groupString = string.IsNullOrEmpty(groupNote) ? groupName : $"{groupNote} ({groupName})";
ImGui.TextUnformatted("- " + groupString);
}
}