Example #1
0
        protected override void GotLobbyStatus(LobbyStatus status)
        {
            lobbyStatus = status;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
            }

            foreach (var raw in status.InvitedPlayers)
            {
                if (!Invitees.ContainsKey(raw.SummonerId))
                {
                    var invitee = new LobbyInvitee(raw, this);
                    Invitees.Add(invitee.SummonerID, invitee);
                    OnMemberJoined(invitee);
                }
            }

            if (GroupData != null)
            {
                UpdateSlots();
            }

            if (!loaded)
            {
                OnLoaded();
            }
        }
Example #2
0
    public ChatRoom(GroupChat lobby, TextBox input, RichTextBox output, Button send, ScrollViewer scroller) {
      this.input = input;
      this.output = output;
      this.send = send;
      this.scroller = scroller;
      this.lobby = lobby;

      input.KeyUp += TextBox_KeyUp;
      send.Click += Button_Click;

      lobby.ChatMessage += Lobby_ChatMessage;
      lobby.ChatStatus += Lobby_ChatStatus;
    }
Example #3
0
        protected virtual void GotLobbyStatus(LobbyStatus status)
        {
            lobbyStatus = status;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
            }

            var todo = status.Members.ToDictionary(m => m.SummonerId);

            foreach (var member in Members)
            {
                Member raw;
                if (todo.TryGetValue(member.SummonerID, out raw))
                {
                    member.Update(raw);
                    todo.Remove(member.SummonerID);
                }
                else
                {
                    Members.Remove(member);
                    OnMemberLeft(member);
                }
            }

            foreach (var raw in todo.Values)
            {
                var member = new QueueLobbyMember(raw, this);
                Members.Add(member);
                OnMemberJoined(member);
            }

            foreach (var raw in status.InvitedPlayers)
            {
                if (!Invitees.ContainsKey(raw.SummonerId))
                {
                    var invitee = new LobbyInvitee(raw, this);
                    Invitees.Add(invitee.SummonerID, invitee);
                    OnMemberJoined(invitee);
                }
            }
            if (!loaded)
            {
                OnLoaded();
            }
        }
Example #4
0
    protected virtual void GotGameData(GameDTO game) {
      Data = game;

      if (ChatLobby == null) {
        ChatLobby = new GroupChat(new agsXMPP.Jid(game.RoomName.ToLower() + ".pvp.net"), game.RoomPassword);
      }

      var participants = game.TeamOne.Concat(game.TeamTwo);

      foreach (var thing in participants) {
        var player = thing as PlayerParticipant;
        var bot = thing as BotParticipant;
        int team;
        if (game.TeamOne.Contains(thing)) team = 0;
        else team = 1;

        GameMember now;

        if (player != null) {
          now = new GameMember(player, team, this);
        } else if (bot != null) {
          now = new GameMember(bot, team, this);
        } else throw new Exception("Unknown participant " + thing);

        GameMember old = AllMembers.SingleOrDefault(m => m.SummonerID == now.SummonerID);
        if (old != null) {
          old.Update(now);
        } else {
          if (team == 0) TeamOne.Add(now);
          else TeamTwo.Add(now);
          OnMemberJoined(now);
        }
      }

      if (game.GameState == "TEAM_SELECT") {
        Dispose();
        Session.Current.CurrentLobby = teamSelect;
        OnGameCancel(teamSelect);
      }

      OnUpdate(game);
      if (!loaded) OnLoaded();
    }
Example #5
0
    protected override void GotLobbyStatus(LobbyStatus status) {
      lobbyStatus = status;

      if (ChatLobby == null) {
        ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
      }

      foreach (var raw in status.InvitedPlayers) {
        if (!Invitees.ContainsKey(raw.SummonerId)) {
          var invitee = new LobbyInvitee(raw, this);
          Invitees.Add(invitee.SummonerID, invitee);
          OnMemberJoined(invitee);
        }
      }

      if (GroupData != null) UpdateSlots();

      if (!loaded) OnLoaded();
    }
Example #6
0
        protected virtual void GotGameData(GameDTO game)
        {
            Data = game;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(new agsXMPP.Jid(game.RoomName.ToLower() + ".pvp.net"), game.RoomPassword);
            }

            var participants = game.TeamOne.Concat(game.TeamTwo);

            foreach (var thing in participants)
            {
                var player = thing as PlayerParticipant;
                var bot    = thing as BotParticipant;
                int team;
                if (game.TeamOne.Contains(thing))
                {
                    team = 0;
                }
                else
                {
                    team = 1;
                }

                GameMember now;

                if (player != null)
                {
                    now = new GameMember(player, team, this);
                }
                else if (bot != null)
                {
                    now = new GameMember(bot, team, this);
                }
                else
                {
                    throw new Exception("Unknown participant " + thing);
                }

                GameMember old = AllMembers.SingleOrDefault(m => m.SummonerID == now.SummonerID);
                if (old != null)
                {
                    old.Update(now);
                }
                else
                {
                    if (team == 0)
                    {
                        TeamOne.Add(now);
                    }
                    else
                    {
                        TeamTwo.Add(now);
                    }
                    OnMemberJoined(now);
                }
            }

            if (game.GameState == "TEAM_SELECT")
            {
                Dispose();
                Session.Current.CurrentLobby = teamSelect;
                OnGameCancel(teamSelect);
            }

            OnUpdate(game);
            if (!loaded)
            {
                OnLoaded();
            }
        }
Example #7
0
        protected virtual void GotGameData(GameDTO game)
        {
            Data = game;

            if (ChatLobby == null)
            {
                ChatLobby = new GroupChat(RiotChat.GetCustomRoom(game.RoomName, game.Id, game.RoomPassword), game.RoomPassword);
            }

            var participants = game.TeamOne.Concat(game.TeamTwo);
            var left         = new List <CustomLobbyMember>(AllMembers);

            foreach (var thing in participants)
            {
                var player = thing as PlayerParticipant;
                var bot    = thing as BotParticipant;
                int team;
                if (game.TeamOne.Contains(thing))
                {
                    team = 0;
                }
                else
                {
                    team = 1;
                }

                CustomLobbyMember now;

                if (player != null)
                {
                    now = new CustomLobbyMember(player, team, this);
                }
                else if (bot != null)
                {
                    now = new CustomLobbyMember(bot, team, this);
                }
                else
                {
                    throw new Exception("Unknown participant " + thing);
                }

                CustomLobbyMember old = AllMembers.SingleOrDefault(m => m.SummonerID == now.SummonerID);
                if (old != null)
                {
                    TeamOne.Remove(old);
                    TeamTwo.Remove(old);
                    Observers.Remove(old);

                    bool diff = old.Team != now.Team;
                    old.Update(now);
                    if (team == 0)
                    {
                        TeamOne.Add(old);
                    }
                    else
                    {
                        TeamTwo.Add(old);
                    }

                    if (diff)
                    {
                        OnMemberChangeTeam(old);
                    }
                    left.Remove(old);
                }
                else
                {
                    if (team == 0)
                    {
                        TeamOne.Add(now);
                    }
                    else
                    {
                        TeamTwo.Add(now);
                    }

                    OnMemberJoined(now);
                }
            }

            foreach (var thing in game.Observers)
            {
                var now = new CustomLobbyMember(thing, this);

                CustomLobbyMember old = AllMembers.SingleOrDefault(m => m.SummonerID == thing.SummonerId);

                if (old != null)
                {
                    TeamOne.Remove(old);
                    TeamTwo.Remove(old);
                    Observers.Remove(old);

                    bool diff = old.Team != now.Team;
                    old.Update(now);
                    Observers.Add(old);

                    if (diff)
                    {
                        OnMemberChangeTeam(old);
                    }
                    left.Remove(old);
                }
                else
                {
                    Observers.Add(now);

                    OnMemberJoined(now);
                }
            }

            foreach (var member in left)
            {
                TeamOne.Remove(member);
                TeamTwo.Remove(member);
                OnMemberLeft(member);
            }

            if (game.GameState.Contains("CHAMP_SELECT"))
            {
                var champSelect = GameLobby.EnterChampSelect(game);
                OnGameStart(champSelect);
            }

            OnUpdate(game);
            if (!loaded)
            {
                OnLoaded();
            }
        }
Example #8
0
    protected virtual void GotLobbyStatus(LobbyStatus status) {
      lobbyStatus = status;

      if (ChatLobby == null) {
        ChatLobby = new GroupChat(RiotChat.GetLobbyRoom(status.InvitationID, status.ChatKey), status.ChatKey);
      }

      var todo = status.Members.ToDictionary(m => m.SummonerId);

      foreach (var member in Members) {
        Member raw;
        if (todo.TryGetValue(member.SummonerID, out raw)) {
          member.Update(raw);
          todo.Remove(member.SummonerID);
        } else {
          Members.Remove(member);
          OnMemberLeft(member);
        }
      }

      foreach (var raw in todo.Values) {
        var member = new QueueLobbyMember(raw, this);
        Members.Add(member);
        OnMemberJoined(member);
      }

      foreach (var raw in status.InvitedPlayers) {
        if (!Invitees.ContainsKey(raw.SummonerId)) {
          var invitee = new LobbyInvitee(raw, this);
          Invitees.Add(invitee.SummonerID, invitee);
          OnMemberJoined(invitee);
        }
      }
      if (!loaded) OnLoaded();
    }
Example #9
0
    protected virtual void GotGameData(GameDTO game) {
      Data = game;

      if (ChatLobby == null) {
        ChatLobby = new GroupChat(RiotChat.GetCustomRoom(game.RoomName, game.Id, game.RoomPassword), game.RoomPassword);
      }

      var participants = game.TeamOne.Concat(game.TeamTwo);
      var left = new List<CustomLobbyMember>(AllMembers);

      foreach (var thing in participants) {
        var player = thing as PlayerParticipant;
        var bot = thing as BotParticipant;
        int team;
        if (game.TeamOne.Contains(thing)) team = 0;
        else team = 1;

        CustomLobbyMember now;

        if (player != null) {
          now = new CustomLobbyMember(player, team, this);
        } else if (bot != null) {
          now = new CustomLobbyMember(bot, team, this);
        } else throw new Exception("Unknown participant " + thing);

        CustomLobbyMember old = AllMembers.SingleOrDefault(m => m.SummonerID == now.SummonerID);
        if (old != null) {
          TeamOne.Remove(old);
          TeamTwo.Remove(old);
          Observers.Remove(old);

          bool diff = old.Team != now.Team;
          old.Update(now);
          if (team == 0) TeamOne.Add(old);
          else TeamTwo.Add(old);

          if (diff) OnMemberChangeTeam(old);
          left.Remove(old);
        } else {
          if (team == 0) TeamOne.Add(now);
          else TeamTwo.Add(now);

          OnMemberJoined(now);
        }
      }

      foreach (var thing in game.Observers) {
        var now = new CustomLobbyMember(thing, this);

        CustomLobbyMember old = AllMembers.SingleOrDefault(m => m.SummonerID == thing.SummonerId);

        if (old != null) {
          TeamOne.Remove(old);
          TeamTwo.Remove(old);
          Observers.Remove(old);

          bool diff = old.Team != now.Team;
          old.Update(now);
          Observers.Add(old);

          if (diff) OnMemberChangeTeam(old);
          left.Remove(old);
        } else {
          Observers.Add(now);

          OnMemberJoined(now);
        }
      }

      foreach (var member in left) {
        TeamOne.Remove(member);
        TeamTwo.Remove(member);
        OnMemberLeft(member);
      }

      if (game.GameState.Contains("CHAMP_SELECT")) {
        var champSelect = GameLobby.EnterChampSelect(game);
        OnGameStart(champSelect);
      }

      OnUpdate(game);
      if (!loaded) OnLoaded();
    }