private void Lobby_MemberJoined(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var invitee = e.Member as LobbyInvitee; var member = e.Member as CustomLobbyMember; if (member != null) { StackPanel stack; if (member.Team == 0) stack = BlueTeam; else if (member.Team == 1) stack = RedTeam; else throw new Exception("UNEXPECTED TEAM"); var player = new LobbyPlayer(member); stack.Children.Add(player); if (e.Member.IsMe) { RedJoin.Visibility = BlueJoin.Visibility = Visibility.Collapsed; if (member.Team != 0) BlueJoin.Visibility = Visibility.Visible; if (member.Team != 1) RedJoin.Visibility = Visibility.Visible; } Sort(); } else { var player = new InvitedPlayer(invitee); InviteList.Children.Add(player); } }); }
private void Lobby_MemberJoined(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var member = e.Member as TBDLobbyMember; if (member != null) { var spots = new[] { Pos0, Pos1, Pos2, Pos3, Pos4 }; var player = new TBDPlayer(lobby.IsCaptain, member, 0); spots[member.SlotID].Child = player; } else { Session.Log("Invite: " + e.Member.Name); } }); }
private void Lobby_MemberJoined(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var member = e.Member as QueueLobbyMember; if (member != null) { var player = new LobbyPlayer2(lobby.IsCaptain, member, 0); PlayerList.Children.Add(player); var players = PlayerList.Children.Cast<LobbyPlayer2>().ToList(); foreach (var control in players) { PlayerList.Children.Remove(control); int index = lobby.Members.IndexOf(control.Member); PlayerList.Children.Insert(index, control); } } else { var player = new InvitedPlayer(e.Member as LobbyInvitee); InviteList.Children.Add(player); } }); }
private void Lobby_MemberLeft(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var player = PlayerList.Children.Cast<LobbyPlayer2>().FirstOrDefault(p => p.Member == e.Member); PlayerList.Children.Remove(player); }); }
private void Lobby_MemberLeft(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var member = e.Member as CustomLobbyMember; StackPanel stack; if (member.Team == 0) stack = BlueTeam; else if (member.Team == 1) stack = RedTeam; else throw new Exception("UNEXPECTED TEAM"); var player = stack.Children.Cast<LobbyPlayer>().FirstOrDefault(p => p.Member == e.Member); stack.Children.Remove(player); }); }
private void Lobby_MemberChangedTeam(object sender, MemberEventArgs e) { Dispatcher.Invoke(() => { var member = e.Member as CustomLobbyMember; StackPanel src, dst; if (member.Team == 1) { src = BlueTeam; dst = RedTeam; } else if (member.Team == 0) { src = RedTeam; dst = BlueTeam; } else throw new Exception("UNEXPECTED TEAM"); var player = src.Children.Cast<LobbyPlayer>().FirstOrDefault(p => p.Member == member); src.Children.Remove(player); dst.Children.Add(player); if (e.Member.IsMe) { RedJoin.Visibility = BlueJoin.Visibility = Visibility.Collapsed; if (member.Team != 0) BlueJoin.Visibility = Visibility.Visible; if (member.Team != 1) RedJoin.Visibility = Visibility.Visible; } Sort(); }); }