 0c87e84f25
			
		
	
	0c87e84f25
	
	
	
		
			
			* move stuff out into file transfer manager * obnoxious unsupported version text, adjustments to filetransfermanager * add back file upload transfer progress * restructure code * cleanup some more stuff I guess * downloadids by playername * individual anim/sound bs * fix migration stuff, finalize impl of individual sound/anim pause * fixes with logging stuff * move download manager to transient * rework dl ui first iteration * some refactoring and cleanup * more code cleanup * refactoring * switch to hostbuilder * some more rework I guess * more refactoring * clean up mediator calls and disposal * fun code cleanup * push error message when log level is set to anything but information in non-debug builds * remove notificationservice * move message to after login * add download bars to gameworld * fixes download progress bar * set gpose ui min and max size * remove unnecessary usings * adjustments to reconnection logic * add options to set visible/offline groups visibility * add impl of uploading display, transfer list in settings ui * attempt to fix issues with server selection * add back download status to compact ui * make dl bar fixed size based * some fixes for upload/download handling * adjust text from Syncing back to Uploading --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com> Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
		
			
				
	
	
		
			95 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Numerics;
 | |
| using Dalamud.Interface;
 | |
| using ImGuiNET;
 | |
| using MareSynchronos.PlayerData.Pairs;
 | |
| using MareSynchronos.UI.Handlers;
 | |
| 
 | |
| namespace MareSynchronos.UI.Components;
 | |
| 
 | |
| public class SelectPairForGroupUi
 | |
| {
 | |
|     private readonly TagHandler _tagHandler;
 | |
|     private string _filter = string.Empty;
 | |
|     private bool _opened = false;
 | |
|     private HashSet<string> _peopleInGroup = new(StringComparer.Ordinal);
 | |
|     private bool _show = false;
 | |
|     private string _tag = string.Empty;
 | |
| 
 | |
|     public SelectPairForGroupUi(TagHandler tagHandler)
 | |
|     {
 | |
|         _tagHandler = tagHandler;
 | |
|     }
 | |
| 
 | |
|     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;
 | |
|         var maxSize = new Vector2(300, 1000) * ImGuiHelpers.GlobalScale;
 | |
| 
 | |
|         var popupName = $"Choose Users for Group {_tag}";
 | |
| 
 | |
|         if (!_show)
 | |
|         {
 | |
|             _opened = false;
 | |
|         }
 | |
| 
 | |
|         if (_show && !_opened)
 | |
|         {
 | |
|             ImGui.SetNextWindowSize(minSize);
 | |
|             UiSharedService.CenterNextWindow(minSize.X, minSize.Y, ImGuiCond.Always);
 | |
|             ImGui.OpenPopup(popupName);
 | |
|             _opened = true;
 | |
|         }
 | |
| 
 | |
|         ImGui.SetNextWindowSizeConstraints(minSize, maxSize);
 | |
|         if (ImGui.BeginPopupModal(popupName, ref _show, ImGuiWindowFlags.Popup | ImGuiWindowFlags.Modal))
 | |
|         {
 | |
|             UiSharedService.FontText($"Select users for group {_tag}", UiBuilder.DefaultFont);
 | |
|             ImGui.InputTextWithHint("##filter", "Filter", ref _filter, 255, ImGuiInputTextFlags.None);
 | |
|             foreach (var item in pairs
 | |
|                 .Where(p => string.IsNullOrEmpty(_filter) || PairName(showUidForEntry, p).Contains(_filter, StringComparison.OrdinalIgnoreCase))
 | |
|                 .OrderBy(p => PairName(showUidForEntry, p), StringComparer.OrdinalIgnoreCase)
 | |
|                 .ToList())
 | |
|             {
 | |
|                 var isInGroup = _peopleInGroup.Contains(item.UserData.UID);
 | |
|                 if (ImGui.Checkbox(PairName(showUidForEntry, item), ref isInGroup))
 | |
|                 {
 | |
|                     if (isInGroup)
 | |
|                     {
 | |
|                         _tagHandler.AddTagToPairedUid(item.UserPair!, _tag);
 | |
|                         _peopleInGroup.Add(item.UserData.UID);
 | |
|                     }
 | |
|                     else
 | |
|                     {
 | |
|                         _tagHandler.RemoveTagFromPairedUid(item.UserPair!, _tag);
 | |
|                         _peopleInGroup.Remove(item.UserData.UID);
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             ImGui.EndPopup();
 | |
|         }
 | |
|         else
 | |
|         {
 | |
|             _filter = string.Empty;
 | |
|             _show = false;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void Open(string tag)
 | |
|     {
 | |
|         _peopleInGroup = _tagHandler.GetOtherUidsForTag(tag);
 | |
|         _tag = tag;
 | |
|         _show = true;
 | |
|     }
 | |
| 
 | |
|     private static string PairName(Dictionary<string, bool> showUidForEntry, Pair pair)
 | |
|     {
 | |
|         showUidForEntry.TryGetValue(pair.UserData.UID, out var showUidInsteadOfName);
 | |
|         var playerText = pair.GetNote();
 | |
|         if (showUidInsteadOfName || string.IsNullOrEmpty(playerText))
 | |
|         {
 | |
|             playerText = pair.UserData.AliasOrUID;
 | |
|         }
 | |
|         return playerText;
 | |
|     }
 | |
| } |