add GroupForPairUi
This commit is contained in:
		| @@ -47,6 +47,7 @@ public class CompactUi : Window, IDisposable | |||||||
|     private string _lastAddedUserComment = string.Empty; |     private string _lastAddedUserComment = string.Empty; | ||||||
|  |  | ||||||
|     private readonly SelectGroupForPairUi _selectGroupForPairUi; |     private readonly SelectGroupForPairUi _selectGroupForPairUi; | ||||||
|  |     private readonly SelectPairForGroupUi _selectPairsForGroupUi; | ||||||
|     private readonly PairGroupsUi _pairGroupsUi; |     private readonly PairGroupsUi _pairGroupsUi; | ||||||
|  |  | ||||||
|     public CompactUi(WindowSystem windowSystem, |     public CompactUi(WindowSystem windowSystem, | ||||||
| @@ -81,7 +82,8 @@ public class CompactUi : Window, IDisposable | |||||||
|  |  | ||||||
|         groupPanel = new(this, uiShared, configuration, apiController); |         groupPanel = new(this, uiShared, configuration, apiController); | ||||||
|         _selectGroupForPairUi = new(_tagHandler, configuration); |         _selectGroupForPairUi = new(_tagHandler, configuration); | ||||||
|         _pairGroupsUi = new(_tagHandler, DrawPairedClient, apiController); |         _selectPairsForGroupUi = new(_tagHandler, configuration); | ||||||
|  |         _pairGroupsUi = new(_tagHandler, DrawPairedClient, apiController, _selectPairsForGroupUi); | ||||||
|  |  | ||||||
|         SizeConstraints = new WindowSizeConstraints() |         SizeConstraints = new WindowSizeConstraints() | ||||||
|         { |         { | ||||||
| @@ -157,8 +159,9 @@ public class CompactUi : Window, IDisposable | |||||||
|             } |             } | ||||||
|             ImGui.Separator(); |             ImGui.Separator(); | ||||||
|             UiShared.DrawWithID("transfers", DrawTransfers); |             UiShared.DrawWithID("transfers", DrawTransfers); | ||||||
|             UiShared.DrawWithID("grouping-popup", () => _selectGroupForPairUi.Draw(ShowUidForEntry)); |  | ||||||
|             TransferPartHeight = ImGui.GetCursorPosY() - TransferPartHeight; |             TransferPartHeight = ImGui.GetCursorPosY() - TransferPartHeight; | ||||||
|  |             UiShared.DrawWithID("group-user-popup", () => _selectPairsForGroupUi.Draw(_apiController.PairedClients, ShowUidForEntry)); | ||||||
|  |             UiShared.DrawWithID("grouping-popup", () => _selectGroupForPairUi.Draw(ShowUidForEntry)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (_configuration.OpenPopupOnAdd && _apiController.LastAddedUser != null) |         if (_configuration.OpenPopupOnAdd && _apiController.LastAddedUser != null) | ||||||
| @@ -450,7 +453,7 @@ public class CompactUi : Window, IDisposable | |||||||
|         { |         { | ||||||
|             _selectGroupForPairUi.Open(entry); |             _selectGroupForPairUi.Open(entry); | ||||||
|         } |         } | ||||||
|         UiShared.AttachToolTip("Chose pair groups for " + entryUID); |         UiShared.AttachToolTip("Choose pair groups for " + entryUID); | ||||||
|  |  | ||||||
|         if (UiShared.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently")) |         if (UiShared.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently")) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -15,12 +15,14 @@ namespace MareSynchronos.UI.Components | |||||||
|         private readonly Action<ClientPairDto> _clientRenderFn; |         private readonly Action<ClientPairDto> _clientRenderFn; | ||||||
|         private readonly TagHandler _tagHandler; |         private readonly TagHandler _tagHandler; | ||||||
|         private readonly ApiController _apiController; |         private readonly ApiController _apiController; | ||||||
|  |         private readonly SelectPairForGroupUi _selectGroupForPairUi; | ||||||
|  |  | ||||||
|         public PairGroupsUi(TagHandler tagHandler, Action<ClientPairDto> clientRenderFn, ApiController apiController) |         public PairGroupsUi(TagHandler tagHandler, Action<ClientPairDto> clientRenderFn, ApiController apiController, SelectPairForGroupUi selectGroupForPairUi) | ||||||
|         { |         { | ||||||
|             _clientRenderFn = clientRenderFn; |             _clientRenderFn = clientRenderFn; | ||||||
|             _tagHandler = tagHandler; |             _tagHandler = tagHandler; | ||||||
|             _apiController = apiController; |             _apiController = apiController; | ||||||
|  |             _selectGroupForPairUi = selectGroupForPairUi; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public void Draw(List<ClientPairDto> availablePairs) |         public void Draw(List<ClientPairDto> availablePairs) | ||||||
| @@ -74,13 +76,13 @@ namespace MareSynchronos.UI.Components | |||||||
|         { |         { | ||||||
|             var allArePaused = availablePairsInThisTag.All(pair => pair.IsPaused); |             var allArePaused = availablePairsInThisTag.All(pair => pair.IsPaused); | ||||||
|             var pauseButton = allArePaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; |             var pauseButton = allArePaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; | ||||||
|             var trashButtonX = UiShared.GetIconButtonSize(FontAwesomeIcon.Trash).X; |             var flyoutMenuX = UiShared.GetIconButtonSize(FontAwesomeIcon.Bars).X; | ||||||
|             var pauseButtonX = UiShared.GetIconButtonSize(pauseButton).X; |             var pauseButtonX = UiShared.GetIconButtonSize(pauseButton).X; | ||||||
|             var windowX = ImGui.GetWindowContentRegionMin().X; |             var windowX = ImGui.GetWindowContentRegionMin().X; | ||||||
|             var windowWidth = UiShared.GetWindowContentRegionWidth(); |             var windowWidth = UiShared.GetWindowContentRegionWidth(); | ||||||
|             var spacingX = ImGui.GetStyle().ItemSpacing.X; |             var spacingX = ImGui.GetStyle().ItemSpacing.X; | ||||||
|  |  | ||||||
|             var buttonPauseOffset = windowX + windowWidth - trashButtonX - spacingX - pauseButtonX; |             var buttonPauseOffset = windowX + windowWidth - flyoutMenuX - spacingX - pauseButtonX; | ||||||
|             ImGui.SameLine(buttonPauseOffset); |             ImGui.SameLine(buttonPauseOffset); | ||||||
|             if (ImGuiComponents.IconButton(pauseButton)) |             if (ImGuiComponents.IconButton(pauseButton)) | ||||||
|             { |             { | ||||||
| @@ -107,13 +109,37 @@ namespace MareSynchronos.UI.Components | |||||||
|                 UiShared.AttachToolTip($"Pause pairing with all pairs in {tag}"); |                 UiShared.AttachToolTip($"Pause pairing with all pairs in {tag}"); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             var buttonDeleteOffset = windowX + windowWidth - trashButtonX; |             var buttonDeleteOffset = windowX + windowWidth - flyoutMenuX; | ||||||
|             ImGui.SameLine(buttonDeleteOffset); |             ImGui.SameLine(buttonDeleteOffset); | ||||||
|             if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash)) |             if (ImGuiComponents.IconButton(FontAwesomeIcon.Bars)) | ||||||
|             { |             { | ||||||
|                 _tagHandler.RemoveTag(tag); |                 ImGui.OpenPopup("Group Flyout Menu"); | ||||||
|  |  | ||||||
|             } |             } | ||||||
|             UiShared.AttachToolTip($"Delete Group {tag} (Will not delete the pairs)"); |  | ||||||
|  |             if (ImGui.BeginPopup("Group Flyout Menu")) | ||||||
|  |             { | ||||||
|  |                 UiShared.DrawWithID($"buttons-{tag}", () => DrawGroupMenu(tag)); | ||||||
|  |                 ImGui.EndPopup(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         private void DrawGroupMenu(string tag) | ||||||
|  |         { | ||||||
|  |             if (UiShared.IconTextButton(FontAwesomeIcon.Users, "Add people to " + tag)) | ||||||
|  |             { | ||||||
|  |                 _selectGroupForPairUi.Open(tag); | ||||||
|  |             } | ||||||
|  |             UiShared.AttachToolTip($"Add more users to Group {tag}"); | ||||||
|  |  | ||||||
|  |             if (UiShared.IconTextButton(FontAwesomeIcon.Trash, "Delete " + tag)) | ||||||
|  |             { | ||||||
|  |                 if (UiShared.CtrlPressed()) | ||||||
|  |                 { | ||||||
|  |                     _tagHandler.RemoveTag(tag); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             UiShared.AttachToolTip($"Delete Group {tag} (Will not delete the pairs)" + Environment.NewLine + "Hold CTRL to delete"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void DrawPairs(string tag, List<ClientPairDto> availablePairsInThisCategory) |         private void DrawPairs(string tag, List<ClientPairDto> availablePairsInThisCategory) | ||||||
|   | |||||||
| @@ -6,150 +6,148 @@ using ImGuiNET; | |||||||
| using MareSynchronos.API; | using MareSynchronos.API; | ||||||
| using MareSynchronos.UI.Handlers; | using MareSynchronos.UI.Handlers; | ||||||
|  |  | ||||||
| namespace MareSynchronos.UI.Components | namespace MareSynchronos.UI.Components; | ||||||
|  |  | ||||||
|  | public class SelectGroupForPairUi | ||||||
| { | { | ||||||
|     public class SelectGroupForPairUi |     /// <summary> | ||||||
|  |     /// Should the panel show, yes/no | ||||||
|  |     /// </summary> | ||||||
|  |     private bool _show; | ||||||
|  |  | ||||||
|  |     /// <summary> | ||||||
|  |     /// Has the panel already been opened? | ||||||
|  |     /// This is used to prevent double opening | ||||||
|  |     /// </summary> | ||||||
|  |     private bool _opened; | ||||||
|  |  | ||||||
|  |     /// <summary> | ||||||
|  |     /// 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; | ||||||
|  |  | ||||||
|  |     /// <summary> | ||||||
|  |     /// For the add category option, this stores the currently typed in tag name | ||||||
|  |     /// </summary> | ||||||
|  |     private string _tagNameToAdd = ""; | ||||||
|  |  | ||||||
|  |     private readonly TagHandler _tagHandler; | ||||||
|  |     private readonly Configuration _configuration; | ||||||
|  |  | ||||||
|  |     public SelectGroupForPairUi(TagHandler tagHandler, Configuration configuration) | ||||||
|     { |     { | ||||||
|         /// <summary> |         _show = false; | ||||||
|         /// Should the panel show, yes/no |         _pair = null; | ||||||
|         /// </summary> |         _tagHandler = tagHandler; | ||||||
|         private bool _show; |         _configuration = configuration; | ||||||
|  |     } | ||||||
|  |  | ||||||
|         /// <summary> |     public void Open(ClientPairDto pair) | ||||||
|         /// Has the panel already been opened? |     { | ||||||
|         /// This is used to prevent double opening |         _pair = pair; | ||||||
|         /// </summary> |         // Using "_show" here to de-couple the opening of the popup | ||||||
|         private bool _opened; |         // The popup name is derived from the name the user currently sees, which is | ||||||
|  |         // based on the showUidForEntry dictionary. | ||||||
|  |         // We'd have to derive the name here to open it popup modal here, when the Open() is called | ||||||
|  |         _show = true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// 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; |  | ||||||
|  |  | ||||||
|         /// <summary> |     public void Draw(Dictionary<string, bool> showUidForEntry) | ||||||
|         /// For the add category option, this stores the currently typed in tag name |     { | ||||||
|         /// </summary> |         if (_pair == null) | ||||||
|         private string _tagNameToAdd = ""; |  | ||||||
|          |  | ||||||
|         private readonly TagHandler _tagHandler; |  | ||||||
|         private readonly Configuration _configuration; |  | ||||||
|  |  | ||||||
|         public SelectGroupForPairUi(TagHandler tagHandler, Configuration configuration) |  | ||||||
|         { |         { | ||||||
|             _show = false; |             return; | ||||||
|             _pair = null; |  | ||||||
|             _tagHandler = tagHandler; |  | ||||||
|             _configuration = configuration; |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public void Open(ClientPairDto pair) |         var name = PairName(showUidForEntry, _pair.OtherUID); | ||||||
|  |         var popupName = $"Choose Groups for {name}"; | ||||||
|  |         // Is the popup supposed to show but did not open yet? Open it | ||||||
|  |         if (_show && !_opened) | ||||||
|         { |         { | ||||||
|             _pair = pair; |             ImGui.OpenPopup(popupName); | ||||||
|             // Using "_show" here to de-couple the opening of the popup |             _opened = true; | ||||||
|             // The popup name is derived from the name the user currently sees, which is |  | ||||||
|             // based on the showUidForEntry dictionary. |  | ||||||
|             // We'd have to derive the name here to open it popup modal here, when the Open() is called |  | ||||||
|             _show = true; |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         // Is the popup not supposed to show? Set _opened to false so we can re-open it. | ||||||
|         public void Draw(Dictionary<string, bool> showUidForEntry) |         if (!_show) | ||||||
|         { |         { | ||||||
|             if (_pair == null) |             _opened = false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (ImGui.BeginPopupModal(popupName, ref _show, UiShared.PopupWindowFlags)) | ||||||
|  |         { | ||||||
|  |             UiShared.FontText($"Select the groups you want {name} to be in.", UiBuilder.DefaultFont); | ||||||
|  |             foreach (var tag in _tagHandler.GetAllTagsSorted()) | ||||||
|             { |             { | ||||||
|                 return; |                 UiShared.DrawWithID($"groups-pair-{_pair.OtherUID}-{tag}", () => DrawGroupName(_pair, tag)); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             var name = PairName(showUidForEntry, _pair.OtherUID); |             UiShared.FontText($"Create a new group for {name}.", UiBuilder.DefaultFont); | ||||||
|             var popupName = $"Chose Groups for {name}"; |             if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus)) | ||||||
|             // Is the popup supposed to show but did not open yet? Open it |  | ||||||
|             if (_show && !_opened) |  | ||||||
|             { |             { | ||||||
|                 ImGui.OpenPopup(popupName); |                 HandleAddTag(); | ||||||
|                 _opened = true; |  | ||||||
|             } |             } | ||||||
|  |             ImGui.SameLine(); | ||||||
|             // Is the popup not supposed to show? Set _opened to false so we can re-open it. |             ImGui.InputTextWithHint("##category_name", "New Group", ref _tagNameToAdd, 40); | ||||||
|             if (!_show) |  | ||||||
|             { |             { | ||||||
|                 _opened = false; |                 if (ImGui.IsKeyDown(ImGuiKey.Enter)) | ||||||
|             } |  | ||||||
|              |  | ||||||
|             if (ImGui.BeginPopupModal(popupName, ref _show, UiShared.PopupWindowFlags)) |  | ||||||
|             { |  | ||||||
|                 UiShared.FontText($"Select the groups you want {name} to be in.", UiBuilder.DefaultFont); |  | ||||||
|                 foreach (var tag in _tagHandler.GetAllTagsSorted()) |  | ||||||
|                 { |  | ||||||
|                     UiShared.DrawWithID($"groups-pair-{_pair.OtherUID}-{tag}", () => DrawGroupName(_pair, tag)); |  | ||||||
|                 } |  | ||||||
|                  |  | ||||||
|                 UiShared.FontText($"Create a new group for {name}.", UiBuilder.DefaultFont); |  | ||||||
|                 if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus)) |  | ||||||
|                 { |                 { | ||||||
|                     HandleAddTag(); |                     HandleAddTag(); | ||||||
|                 } |                 } | ||||||
|                 ImGui.SameLine(); |             } | ||||||
|                 ImGui.InputTextWithHint("##category_name", "New Group", ref _tagNameToAdd, 40); |             UiShared.SetScaledWindowSize(375); | ||||||
|                 { |             ImGui.EndPopup(); | ||||||
|                     if (ImGui.IsKeyDown(ImGuiKey.Enter)) |         } | ||||||
|                     { |         else | ||||||
|                         HandleAddTag(); |         { | ||||||
|                     } |             _show = false; | ||||||
|                 } |         } | ||||||
|                 UiShared.SetScaledWindowSize(375); |     } | ||||||
|                 ImGui.EndPopup(); |  | ||||||
|  |     private void DrawGroupName(ClientPairDto pair, string name) | ||||||
|  |     { | ||||||
|  |         bool hasTagBefore = _tagHandler.HasTag(pair, name); | ||||||
|  |         bool hasTag = hasTagBefore; | ||||||
|  |         if (ImGui.Checkbox(name, ref hasTag)) | ||||||
|  |         { | ||||||
|  |             if (hasTag) | ||||||
|  |             { | ||||||
|  |                 _tagHandler.AddTagToPairedUid(pair, name); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 _show = false; |                 _tagHandler.RemoveTagFromPairedUid(pair, name); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|         private void DrawGroupName(ClientPairDto pair, string name) |     private void HandleAddTag() | ||||||
|  |     { | ||||||
|  |         if (!_tagNameToAdd.IsNullOrWhitespace()) | ||||||
|         { |         { | ||||||
|             bool hasTagBefore = _tagHandler.HasTag(pair, name); |             _tagHandler.AddTag(_tagNameToAdd); | ||||||
|             bool hasTag = hasTagBefore; |             if (_pair != null) | ||||||
|             if (ImGui.Checkbox(name, ref hasTag)) |  | ||||||
|             { |             { | ||||||
|                 if (hasTag) |                 _tagHandler.AddTagToPairedUid(_pair, _tagNameToAdd); | ||||||
|                 { |  | ||||||
|                     _tagHandler.AddTagToPairedUid(pair, name); |  | ||||||
|                 } |  | ||||||
|                 else |  | ||||||
|                 { |  | ||||||
|                     _tagHandler.RemoveTagFromPairedUid(pair, name); |  | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
|  |             _tagNameToAdd = string.Empty; | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|         private void HandleAddTag() |     private string PairName(Dictionary<string, bool> showUidForEntry, string otherUid) | ||||||
|  |     { | ||||||
|  |         showUidForEntry.TryGetValue(otherUid, out var showUidInsteadOfName); | ||||||
|  |         _configuration.GetCurrentServerUidComments().TryGetValue(otherUid, out var playerText); | ||||||
|  |         if (showUidInsteadOfName) | ||||||
|         { |         { | ||||||
|             if (!_tagNameToAdd.IsNullOrWhitespace()) |             playerText = otherUid; | ||||||
|             { |  | ||||||
|                 _tagHandler.AddTag(_tagNameToAdd); |  | ||||||
|                 if (_pair != null) |  | ||||||
|                 { |  | ||||||
|                     _tagHandler.AddTagToPairedUid(_pair, _tagNameToAdd);  |  | ||||||
|                 } |  | ||||||
|                 _tagNameToAdd = string.Empty; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|  |         else if (string.IsNullOrEmpty(playerText)) | ||||||
|         private string PairName(Dictionary<string, bool> showUidForEntry, string otherUid) |  | ||||||
|         { |         { | ||||||
|             showUidForEntry.TryGetValue(otherUid, out var showUidInsteadOfName); |             playerText = otherUid; | ||||||
|             _configuration.GetCurrentServerUidComments().TryGetValue(otherUid, out var playerText); |  | ||||||
|             if (showUidInsteadOfName) |  | ||||||
|             { |  | ||||||
|                 playerText = otherUid; |  | ||||||
|             } |  | ||||||
|             else if (string.IsNullOrEmpty(playerText)) |  | ||||||
|             { |  | ||||||
|                 playerText = otherUid; |  | ||||||
|             } |  | ||||||
|             return playerText; |  | ||||||
|         } |         } | ||||||
|  |         return playerText; | ||||||
|     } |     } | ||||||
| } | } | ||||||
							
								
								
									
										89
									
								
								MareSynchronos/UI/Components/SelectPairForGroupUi.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								MareSynchronos/UI/Components/SelectPairForGroupUi.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | |||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using Dalamud.Interface; | ||||||
|  | using ImGuiNET; | ||||||
|  | using MareSynchronos.API; | ||||||
|  | using MareSynchronos.UI.Handlers; | ||||||
|  |  | ||||||
|  | namespace MareSynchronos.UI.Components; | ||||||
|  |  | ||||||
|  | public class SelectPairForGroupUi | ||||||
|  | { | ||||||
|  |     private bool _show = false; | ||||||
|  |     private bool _opened = false; | ||||||
|  |     private HashSet<string> _peopleInGroup = new(System.StringComparer.Ordinal); | ||||||
|  |     private string _tag = string.Empty; | ||||||
|  |     private readonly TagHandler _tagHandler; | ||||||
|  |     private readonly Configuration _configuration; | ||||||
|  |  | ||||||
|  |     public SelectPairForGroupUi(TagHandler tagHandler, Configuration configuration) | ||||||
|  |     { | ||||||
|  |         _tagHandler = tagHandler; | ||||||
|  |         _configuration = configuration; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void Open(string tag) | ||||||
|  |     { | ||||||
|  |         _peopleInGroup = _tagHandler.GetOtherUidsForTag(tag); | ||||||
|  |         _tag = tag; | ||||||
|  |         _show = true; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void Draw(List<ClientPairDto> pairs, Dictionary<string, bool> showUidForEntry) | ||||||
|  |     { | ||||||
|  |         var popupName = $"Choose Users for Group {_tag}"; | ||||||
|  |  | ||||||
|  |         if (!_show) | ||||||
|  |         { | ||||||
|  |             _opened = false; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (_show && !_opened) | ||||||
|  |         { | ||||||
|  |             ImGui.SetWindowSize(new System.Numerics.Vector2(300, 400)); | ||||||
|  |             ImGui.OpenPopup(popupName); | ||||||
|  |             _opened = true; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (ImGui.BeginPopupModal(popupName, ref _show)) | ||||||
|  |         { | ||||||
|  |             UiShared.FontText($"Select users for group {_tag}", UiBuilder.DefaultFont); | ||||||
|  |             foreach (var item in pairs.OrderBy(p => string.IsNullOrEmpty(p.VanityUID) ? p.OtherUID : p.VanityUID, System.StringComparer.OrdinalIgnoreCase).ToList()) | ||||||
|  |             { | ||||||
|  |                 var isInGroup = _peopleInGroup.Contains(item.OtherUID); | ||||||
|  |                 if (ImGui.Checkbox(PairName(showUidForEntry, item.OtherUID), ref isInGroup)) | ||||||
|  |                 { | ||||||
|  |                     if (isInGroup) | ||||||
|  |                     { | ||||||
|  |                         _tagHandler.AddTagToPairedUid(item, _tag); | ||||||
|  |                         _peopleInGroup.Add(item.OtherUID); | ||||||
|  |                     } | ||||||
|  |                     else | ||||||
|  |                     { | ||||||
|  |                         _tagHandler.RemoveTagFromPairedUid(item, _tag); | ||||||
|  |                         _peopleInGroup.Remove(item.OtherUID); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         else | ||||||
|  |         { | ||||||
|  |             _show = false; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private string PairName(Dictionary<string, bool> showUidForEntry, string otherUid) | ||||||
|  |     { | ||||||
|  |         showUidForEntry.TryGetValue(otherUid, out var showUidInsteadOfName); | ||||||
|  |         _configuration.GetCurrentServerUidComments().TryGetValue(otherUid, out var playerText); | ||||||
|  |         if (showUidInsteadOfName) | ||||||
|  |         { | ||||||
|  |             playerText = otherUid; | ||||||
|  |         } | ||||||
|  |         else if (string.IsNullOrEmpty(playerText)) | ||||||
|  |         { | ||||||
|  |             playerText = otherUid; | ||||||
|  |         } | ||||||
|  |         return playerText; | ||||||
|  |     } | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 rootdarkarchon
					rootdarkarchon