Client rework for API change and paradigm shift (#39)

* most of the groups refactoring on client

* register OnMethods for group stuff

* start implementing client (still pretty broken)

* finish implementing new api first iteration

* idk rework everything for pair shit (still WIP); goal is to remove PairedClients and GroupPairClients from ApiController

* move everything to PairManager, remove dictionaries from APiController

* remove admin stuff from client, cleanup

* adjust reconnection handling, add new settings, todo still to remove access from old stuff that's marked obsolete from config

* add back adding servers, fix intro ui

* fix obsolete calls

* adjust config namespace

* add UI for setting animation/sound permissions to syncshells

* add ConfigurationService to hot reload config on change from external

* move transient data cache to configuration

* add deleting service to ui

* fix saving of transient resources

* fix group pair user assignments

* halt scanner when penumbra inactive, add visible/online/offline split to individual pairs and tags

* add presence to syncshell ui

* move fullpause from config to server config

* fixes in code style

* more codestyle

* show info icon on player in shells, don't show icon when no changes from default state are made, add online notifs

* fixes to intro UI

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2023-01-29 15:13:53 +01:00
committed by GitHub
parent 616af3626a
commit b2276a1883
79 changed files with 3585 additions and 2701 deletions

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic;
using System.Numerics;
using System.Numerics;
using Dalamud.Interface;
using Dalamud.Interface.Components;
using Dalamud.Utility;
using ImGuiNET;
using MareSynchronos.API;
using MareSynchronos.Models;
using MareSynchronos.UI.Handlers;
namespace MareSynchronos.UI.Components;
@@ -20,7 +19,7 @@ public class SelectGroupForPairUi
/// The group UI is always open for a specific pair. This defines which pair the UI is open for.
/// </summary>
/// <returns></returns>
private ClientPairDto? _pair;
private Pair? _pair;
/// <summary>
/// For the add category option, this stores the currently typed in tag name
@@ -28,17 +27,15 @@ public class SelectGroupForPairUi
private string _tagNameToAdd = "";
private readonly TagHandler _tagHandler;
private readonly Configuration _configuration;
public SelectGroupForPairUi(TagHandler tagHandler, Configuration configuration)
public SelectGroupForPairUi(TagHandler tagHandler)
{
_show = false;
_pair = null;
_tagHandler = tagHandler;
_configuration = configuration;
}
public void Open(ClientPairDto pair)
public void Open(Pair pair)
{
_pair = pair;
// Using "_show" here to de-couple the opening of the popup
@@ -56,7 +53,7 @@ public class SelectGroupForPairUi
return;
}
var name = PairName(showUidForEntry, _pair.OtherUID, _pair.VanityUID);
var name = PairName(showUidForEntry, _pair);
var popupName = $"Choose Groups for {name}";
// Is the popup supposed to show but did not open yet? Open it
if (_show)
@@ -76,7 +73,7 @@ public class SelectGroupForPairUi
{
foreach (var tag in tags)
{
UiShared.DrawWithID($"groups-pair-{_pair.OtherUID}-{tag}", () => DrawGroupName(_pair, tag));
UiShared.DrawWithID($"groups-pair-{_pair.UserData.UID}-{tag}", () => DrawGroupName(_pair, tag));
}
ImGui.EndChild();
}
@@ -99,19 +96,19 @@ public class SelectGroupForPairUi
}
}
private void DrawGroupName(ClientPairDto pair, string name)
private void DrawGroupName(Pair pair, string name)
{
var hasTagBefore = _tagHandler.HasTag(pair, name);
var hasTagBefore = _tagHandler.HasTag(pair.UserPair!, name);
var hasTag = hasTagBefore;
if (ImGui.Checkbox(name, ref hasTag))
{
if (hasTag)
{
_tagHandler.AddTagToPairedUid(pair, name);
_tagHandler.AddTagToPairedUid(pair.UserPair!, name);
}
else
{
_tagHandler.RemoveTagFromPairedUid(pair, name);
_tagHandler.RemoveTagFromPairedUid(pair.UserPair!, name);
}
}
}
@@ -123,19 +120,19 @@ public class SelectGroupForPairUi
_tagHandler.AddTag(_tagNameToAdd);
if (_pair != null)
{
_tagHandler.AddTagToPairedUid(_pair, _tagNameToAdd);
_tagHandler.AddTagToPairedUid(_pair.UserPair!, _tagNameToAdd);
}
_tagNameToAdd = string.Empty;
}
}
private string PairName(Dictionary<string, bool> showUidForEntry, string otherUid, string vanityUid)
private string PairName(Dictionary<string, bool> showUidForEntry, Pair pair)
{
showUidForEntry.TryGetValue(otherUid, out var showUidInsteadOfName);
_configuration.GetCurrentServerUidComments().TryGetValue(otherUid, out var playerText);
showUidForEntry.TryGetValue(pair.UserData.UID, out var showUidInsteadOfName);
var playerText = pair.GetNote();
if (showUidInsteadOfName || string.IsNullOrEmpty(playerText))
{
playerText = string.IsNullOrEmpty(vanityUid) ? otherUid : vanityUid;
playerText = pair.UserData.AliasOrUID;
}
return playerText;
}