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,9 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Dalamud.Interface;
using FFXIVClientStructs.FFXIV.Common.Math;
using ImGuiNET;
using MareSynchronos.API;
using MareSynchronos.Models;
using MareSynchronos.UI.Handlers;
namespace MareSynchronos.UI.Components;
@@ -12,16 +10,14 @@ public class SelectPairForGroupUi
{
private bool _show = false;
private bool _opened = false;
private HashSet<string> _peopleInGroup = new(System.StringComparer.Ordinal);
private HashSet<string> _peopleInGroup = new(StringComparer.Ordinal);
private string _tag = string.Empty;
private readonly TagHandler _tagHandler;
private readonly Configuration _configuration;
private string _filter = string.Empty;
public SelectPairForGroupUi(TagHandler tagHandler, Configuration configuration)
public SelectPairForGroupUi(TagHandler tagHandler)
{
_tagHandler = tagHandler;
_configuration = configuration;
}
public void Open(string tag)
@@ -31,7 +27,7 @@ public class SelectPairForGroupUi
_show = true;
}
public void Draw(List<ClientPairDto> pairs, Dictionary<string, bool> showUidForEntry)
public void Draw(List<Pair> pairs, Dictionary<string, bool> showUidForEntry)
{
var workHeight = ImGui.GetMainViewport().WorkSize.Y / ImGuiHelpers.GlobalScale;
var minSize = new Vector2(300, workHeight < 400 ? workHeight : 400) * ImGuiHelpers.GlobalScale;
@@ -57,21 +53,21 @@ public class SelectPairForGroupUi
{
UiShared.FontText($"Select users for group {_tag}", UiBuilder.DefaultFont);
ImGui.InputTextWithHint("##filter", "Filter", ref _filter, 255, ImGuiInputTextFlags.None);
foreach (var item in pairs.OrderBy(p => PairName(showUidForEntry, p.OtherUID, p.VanityUID), System.StringComparer.OrdinalIgnoreCase)
.Where(p => string.IsNullOrEmpty(_filter) || PairName(showUidForEntry, p.OtherUID, p.VanityUID).Contains(_filter, System.StringComparison.OrdinalIgnoreCase)).ToList())
foreach (var item in pairs.OrderBy(p => PairName(showUidForEntry, p), StringComparer.OrdinalIgnoreCase)
.Where(p => string.IsNullOrEmpty(_filter) || PairName(showUidForEntry, p).Contains(_filter, StringComparison.OrdinalIgnoreCase)).ToList())
{
var isInGroup = _peopleInGroup.Contains(item.OtherUID);
if (ImGui.Checkbox(PairName(showUidForEntry, item.OtherUID, item.VanityUID), ref isInGroup))
var isInGroup = _peopleInGroup.Contains(item.UserData.UID);
if (ImGui.Checkbox(PairName(showUidForEntry, item), ref isInGroup))
{
if (isInGroup)
{
_tagHandler.AddTagToPairedUid(item, _tag);
_peopleInGroup.Add(item.OtherUID);
_tagHandler.AddTagToPairedUid(item.UserPair!, _tag);
_peopleInGroup.Add(item.UserData.UID);
}
else
{
_tagHandler.RemoveTagFromPairedUid(item, _tag);
_peopleInGroup.Remove(item.OtherUID);
_tagHandler.RemoveTagFromPairedUid(item.UserPair!, _tag);
_peopleInGroup.Remove(item.UserData.UID);
}
}
}
@@ -84,13 +80,13 @@ public class SelectPairForGroupUi
}
}
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;
}