private void PVPNet_OnMessageReceived(object sender, object message) { if (message.GetType() == typeof(GameDTO)) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { GameDTO QueueDTO = message as GameDTO; if (QueueDTO.GameState == "TERMINATED") { Client.OverlayContainer.Visibility = Visibility.Hidden; Client.PVPNet.OnMessageReceived -= PVPNet_OnMessageReceived; return; } else if (QueueDTO.GameState == "CHAMP_SELECT") { HasStartedChampSelect = true; Client.PVPNet.OnMessageReceived -= PVPNet_OnMessageReceived; string s = QueueDTO.GameState; Client.ChampSelectDTO = QueueDTO; Client.GameID = QueueDTO.Id; Client.ChampSelectDTO = QueueDTO; Client.LastPageContent = Client.Container.Content; Client.OverlayContainer.Visibility = Visibility.Hidden; Client.SwitchPage(new ChampSelectPage()); } int i = 0; string PlayerParticipantStatus = (string)QueueDTO.StatusOfParticipants; if (ReverseString) { string FirstHalf = PlayerParticipantStatus.Substring(0, PlayerParticipantStatus.Length / 2); string SecondHalf = PlayerParticipantStatus.Substring(PlayerParticipantStatus.Length / 2, PlayerParticipantStatus.Length / 2); PlayerParticipantStatus = SecondHalf + FirstHalf; } foreach (char c in PlayerParticipantStatus) { if (c == '1') //If checked { QueuePopPlayer player = null; if (i < (PlayerParticipantStatus.Length / 2)) //Team 1 { player = (QueuePopPlayer)Team1ListBox.Items[i]; } else //Team 2 { player = (QueuePopPlayer)Team2ListBox.Items[i - (PlayerParticipantStatus.Length / 2)]; } player.ReadyCheckBox.IsChecked = true; } i++; } })); } }
private void PVPNet_OnMessageReceived(object sender, MessageReceivedEventArgs message) { if (message.Body.GetType() == typeof(GameDTO)) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { var QueueDTO = message.Body as GameDTO; if (QueueDTO != null && QueueDTO.GameState == "TERMINATED") { Client.OverlayContainer.Visibility = Visibility.Hidden; Client.RiotConnection.MessageReceived -= PVPNet_OnMessageReceived; Client.SendAccept(accepted); Client.HasPopped = false; return; } if (QueueDTO != null && (QueueDTO.GameState == "PRE_CHAMP_SELECT" || QueueDTO.GameState == "CHAMP_SELECT")) { Client.RiotConnection.MessageReceived -= PVPNet_OnMessageReceived; string s = QueueDTO.GameState; Client.ChampSelectDTO = QueueDTO; Client.GameID = QueueDTO.Id; Client.LastPageContent = Client.Container.Content; Client.OverlayContainer.Visibility = Visibility.Hidden; Client.GameStatus = "championSelect"; Client.SetChatHover(); Client.SwitchPage(page.Load(this)); Client.SendAccept(accepted); Client.HasPopped = false; } int i = 0; if (QueueDTO == null) { return; } var playerParticipantStatus = (string)QueueDTO.StatusOfParticipants; if (ReverseString) { string firstHalf = playerParticipantStatus.Substring(0, playerParticipantStatus.Length / 2); string secondHalf = playerParticipantStatus.Substring(playerParticipantStatus.Length / 2, playerParticipantStatus.Length / 2); playerParticipantStatus = secondHalf + firstHalf; } foreach (char c in playerParticipantStatus) { QueuePopPlayer player = null; if (i < playerParticipantStatus.Length / 2) //Team 1 { if (i <= Team1ListBox.Items.Count - 1) { player = (QueuePopPlayer)Team1ListBox.Items[i]; } } else if (i - 5 <= Team2ListBox.Items.Count - 1) //Team 2 { player = (QueuePopPlayer)Team2ListBox.Items[i - (playerParticipantStatus.Length / 2)]; } if (player != null) { switch (c) { case '1': player.ReadyImage.Source = Client.GetImage("/LegendaryClient;component/accepted.png"); break; case '2': player.ReadyImage.Source = Client.GetImage("/LegendaryClient;component/declined.png"); break; } } i++; } })); } }
public async void InitializePop(GameDTO InitialDTO) { List <Participant> allParticipants = InitialDTO.TeamOne; allParticipants.AddRange(InitialDTO.TeamTwo); if (InitialDTO.TeamOne[0] is ObfuscatedParticipant) { ReverseString = true; } allParticipants = allParticipants.Distinct().ToList(); //Seems to have fixed the queuepopoverlay page crashing. //whichever team you're on sometimes duplicates and could not find a reason as it doesn't happen a lot. int i = 1; foreach (Participant p in allParticipants) { var player = new QueuePopPlayer { Width = 264, Height = 70 }; var part = p as PlayerParticipant; if (part != null) { PlayerParticipant playerPart = part; if (!string.IsNullOrEmpty(playerPart.SummonerName)) { player.PlayerLabel.Content = playerPart.SummonerName; player.RankLabel.Content = ""; player.Tag = part; Team1ListBox.Items.Add(player); } else { Client.Log(playerPart.SummonerId.ToString(CultureInfo.InvariantCulture)); player.PlayerLabel.Content = "Summoner " + i; i++; player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } else { var oPlayer = p as ObfuscatedParticipant; if (oPlayer != null) { player.PlayerLabel.Content = "Summoner " + (oPlayer.GameUniqueId - (oPlayer.GameUniqueId > 5 ? 5 : 0)); } player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } GetPlayerLeagues(); if (!Client.AutoAcceptQueue) { return; } await RiotCalls.AcceptPoppedGame(true); accepted = true; }
public async void InitializePop(GameDTO InitialDTO) { List <Participant> AllParticipants = InitialDTO.TeamOne; AllParticipants.AddRange(InitialDTO.TeamTwo); if (InitialDTO.TeamOne[0] is ObfuscatedParticipant) { ReverseString = true; } AllParticipants = AllParticipants.Distinct().ToList(); //Seems to have fixed the queuepopoverlay page crashing. //whichever team you're on sometimes duplicates and could not find a reason as it doesn't happen a lot. int i = 1; foreach (Participant p in AllParticipants) { QueuePopPlayer player = new QueuePopPlayer(); player.Width = 264; player.Height = 70; if (p is PlayerParticipant) { PlayerParticipant playerPart = (PlayerParticipant)p; if (!String.IsNullOrEmpty(playerPart.SummonerName)) { player.PlayerLabel.Content = playerPart.SummonerName; player.RankLabel.Content = ""; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { var playerLeagues = await Client.PVPNet.GetAllLeaguesForPlayer(playerPart.SummonerId); foreach (LeagueListDTO x in playerLeagues.SummonerLeagues) { if (x.Queue == "RANKED_SOLO_5x5") { player.RankLabel.Content = x.Tier + " " + x.RequestorsRank; } } if (String.IsNullOrEmpty(player.RankLabel.Content.ToString())) { player.RankLabel.Content = "Unranked"; } })); Team1ListBox.Items.Add(player); } else { Client.Log(playerPart.SummonerId.ToString()); player.PlayerLabel.Content = "Summoner " + i; i++; player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } else { ObfuscatedParticipant oPlayer = p as ObfuscatedParticipant; player.PlayerLabel.Content = "Summoner " + (oPlayer.GameUniqueId - (oPlayer.GameUniqueId > 5 ? 5 : 0)); player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } if (Client.AutoAcceptQueue) { await Client.PVPNet.AcceptPoppedGame(true); } }
private void OnMessageReceived(object sender, MessageReceivedEventArgs message) { if (message.Body.GetType() == typeof(GameDTO)) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { GameDTO QueueDTO = message.Body as GameDTO; if (QueueDTO.GameState == "TERMINATED" || QueueDTO.GameState == "TERMINATED_IN_ERROR") { Client.OverlayContainer.Visibility = Visibility.Hidden; Client.RtmpConnection.MessageReceived -= OnMessageReceived; Client.IsInGame = false; return; } else if (QueueDTO.GameState == "CHAMP_SELECT") { HasStartedChampSelect = true; Client.RtmpConnection.MessageReceived -= OnMessageReceived; string s = QueueDTO.GameState; Client.ChampSelectDTO = QueueDTO; Client.GameID = QueueDTO.Id; Client.ChampSelectDTO = QueueDTO; Client.LastPageContent = Client.Container.Content; Client.OverlayContainer.Visibility = Visibility.Hidden; Client.SwitchPage(new ChampSelectPage()); } int i = 0; string PlayerParticipantStatus = (string)QueueDTO.StatusOfParticipants; if (ReverseString) { string FirstHalf = PlayerParticipantStatus.Substring(0, PlayerParticipantStatus.Length / 2); string SecondHalf = PlayerParticipantStatus.Substring(PlayerParticipantStatus.Length / 2, PlayerParticipantStatus.Length / 2); PlayerParticipantStatus = SecondHalf + FirstHalf; } foreach (char c in PlayerParticipantStatus) { if (c == '1') //If checked { QueuePopPlayer player = null; if (i < (PlayerParticipantStatus.Length / 2)) //Team 1 { player = (QueuePopPlayer)Team1ListBox.Items[i]; } else //Team 2 { player = (QueuePopPlayer)Team2ListBox.Items[i - (PlayerParticipantStatus.Length / 2)]; } player.ReadyCheckBox.IsChecked = true; player.ReadyCheckBox.Foreground = System.Windows.Media.Brushes.Green; } else if (c == '2') { QueuePopPlayer player = null; if (i < (PlayerParticipantStatus.Length / 2)) //Team 1 { player = (QueuePopPlayer)Team1ListBox.Items[i]; } else //Team 2 { player = (QueuePopPlayer)Team2ListBox.Items[i - (PlayerParticipantStatus.Length / 2)]; } player.ReadyCheckBox.IsChecked = null; player.ReadyCheckBox.Foreground = System.Windows.Media.Brushes.Red; } i++; } })); } }
public async void InitializePop(GameDTO InitialDTO) { List <Participant> AllParticipants = InitialDTO.TeamOne; AllParticipants.AddRange(InitialDTO.TeamTwo); if (InitialDTO.TeamOne[0] is ObfuscatedParticipant) { ReverseString = true; } foreach (Participant p in AllParticipants) { QueuePopPlayer player = new QueuePopPlayer(); player.Width = 300; player.Height = 100; if (p is PlayerParticipant) { PlayerParticipant playerPart = (PlayerParticipant)p; player.PlayerLabel.Content = playerPart.SummonerName; player.RankLabel.Content = ""; Team1ListBox.Items.Add(player); } else { player.PlayerLabel.Content = "Enemy"; player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } int i = 0; foreach (Participant p in AllParticipants) { if (p is PlayerParticipant) { QueuePopPlayer player = (QueuePopPlayer)Team1ListBox.Items[i]; PlayerParticipant playerPart = (PlayerParticipant)p; SummonerLeaguesDTO playerLeagues = await RiotCalls.GetAllLeaguesForPlayer(playerPart.SummonerId); foreach (LeagueListDTO x in playerLeagues.SummonerLeagues) { if (x.Queue == "RANKED_SOLO_5x5") { player.RankLabel.Content = x.Tier + " " + x.RequestorsRank; } } //People can be ranked without having solo queue so don't put if statement checking List.Length if (String.IsNullOrEmpty((string)player.RankLabel.Content)) { player.RankLabel.Content = "Unranked"; } i++; } } if (Client.AutoAcceptQueue) { await RiotCalls.AcceptPoppedGame(true); } }