/// <summary> /// Retrieve the list of subspaces and players when the warp mode is SUBSPACE /// </summary> private static SubspaceDisplayEntry[] GetSubspaceDisplayEntriesSubspace() { var groupedPlayers = System.ClientSubspaceList.GroupBy(s => s.Value).ToArray(); var subspaceDisplay = new List <SubspaceDisplayEntry>(); foreach (var subspace in groupedPlayers) { var newSubspaceDisplay = new SubspaceDisplayEntry { SubspaceTime = System.GetSubspaceTime(subspace.Key), SubspaceId = subspace.Key, Players = subspace.Select(u => u.Key).ToList() }; if (subspace.Key == System.CurrentSubspace) { if (subspace.Select(v => v.Key).Contains(SettingsSystem.CurrentSettings.PlayerName)) { subspaceDisplay.Insert(0, newSubspaceDisplay); } else { newSubspaceDisplay.Players.Insert(0, SettingsSystem.CurrentSettings.PlayerName); subspaceDisplay.Insert(0, newSubspaceDisplay); } } else { subspaceDisplay.Add(newSubspaceDisplay); } } return(subspaceDisplay.ToArray()); }
/// <summary> /// Retrieve the list of subspaces and players when the warp mode is SUBSPACE /// </summary> private static void FillSubspaceDisplayEntriesSubspace() { //Redo the list only if the subspaces have changed. if (PlayersInSubspacesHaveChanged()) { System.SubspaceEntries.Clear(); var groupedPlayers = System.ClientSubspaceList.GroupBy(s => s.Value); foreach (var subspace in groupedPlayers) { var newSubspaceDisplay = new SubspaceDisplayEntry { SubspaceTime = System.GetSubspaceTime(subspace.Key), SubspaceId = subspace.Key, Players = subspace.Select(u => u.Key).ToList() }; if (subspace.Key == System.CurrentSubspace) { if (subspace.Select(v => v.Key).Contains(SettingsSystem.CurrentSettings.PlayerName)) { System.SubspaceEntries.Insert(0, newSubspaceDisplay); } else { newSubspaceDisplay.Players.Insert(0, SettingsSystem.CurrentSettings.PlayerName); System.SubspaceEntries.Insert(0, newSubspaceDisplay); } } else { System.SubspaceEntries.Add(newSubspaceDisplay); } } } }
/// <summary> /// Retrieve the list of subspaces and players when the warp mode is SUBSPACE /// </summary> private static void FillSubspaceDisplayEntriesSubspace() { //Redo the list only if the subspaces have changed. if (PlayersInSubspacesHaveChanged()) { System.SubspaceEntries.Clear(); var groupedPlayers = System.ClientSubspaceList.GroupBy(s => s.Value); SubspaceDisplayEntry warpingSubspace = null; foreach (var subspace in groupedPlayers) { var newSubspaceDisplay = new SubspaceDisplayEntry { SubspaceTime = System.GetSubspaceTime(subspace.Key), SubspaceId = subspace.Key, Players = subspace.Select(u => u.Key).ToList() }; if (newSubspaceDisplay.SubspaceId == -1) { warpingSubspace = newSubspaceDisplay; continue; } System.SubspaceEntries.Add(newSubspaceDisplay); } System.SubspaceEntries = System.SubspaceEntries.OrderByDescending(s => s.SubspaceTime).ToList(); if (warpingSubspace != null) { System.SubspaceEntries.Insert(0, warpingSubspace); } } }
/// <summary> /// Retrieve the list of subspaces and players when the warp mode is ADMIN or NONE /// </summary> private static SubspaceDisplayEntry[] GetSubspaceDisplayEntriesNoneSubspace() { var allPlayers = new List <string> { SettingsSystem.CurrentSettings.PlayerName }; allPlayers.AddRange(System.ClientSubspaceList.Keys); allPlayers.Sort(PlayerSorter); var sde = new SubspaceDisplayEntry { Players = allPlayers, SubspaceId = 0, SubspaceTime = 0 }; return(new[] { sde }); }