Пример #1
0
 internal static GameLobby EnterChampSelect(GameDTO game) {
   var lobby = new GameLobby();
   Session.Current.CurrentLobby = lobby;
   RiotServices.GameService.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");
   lobby.GotGameData(game);
   return lobby;
 }
Пример #2
0
    public ChampSelectPage(GameLobby game) {
      InitializeComponent();

      this.game = game;

      game.GameCancelled += Game_LeftChampSelect;
      game.GameStarted += Game_GameStarted;
      game.Updated += Updated;
      game.Loaded += Game_Loaded;
      Update();

      Popup.ChampSelector.ChampSelected += ChampsGrid_ChampSelected;
      Popup.ChampSelector.SkinSelected += ChampsGrid_SkinSelected;
      UpdateBooks();

      Popup.SpellSelector.SpellSelected += SpellSelector_SpellSelected;
      Popup.Close += Popup_Close;

      Popup.SpellSelector.Spells = (from spell in DataDragon.SpellData.Value.data.Values
                                    where spell.modes.Contains(game.Data.GameMode)
                                    select spell);

      var map = GameMap.Maps.FirstOrDefault(m => m.MapId == game.Data.MapId);

      var config = Session.Current.Account.LoginPacket.GameTypeConfigs.FirstOrDefault(g => g.Id == game.Data.GameTypeConfigId);
      if (config.MaxAllowableBans == 0) {
        MyBansGrid.Visibility = OtherBansGrid.Visibility = Visibility.Collapsed;
      }

      MapLabel.Content = map.DisplayName;
      ModeLabel.Content = ModeLabel.Content = GameMode.Values[game.Data.GameMode].Value;
      QueueLabel.Content = GameConfig.Values[game.Data.GameTypeConfigId];
      TeamSizeLabel.Content = $"{game.Data.MaxNumPlayers / 2}v{game.Data.MaxNumPlayers / 2}";
    }
Пример #3
0
    public void BeginChampionSelect(GameLobby game) {
      if (Thread.CurrentThread != Dispatcher.Thread) { Dispatcher.MyInvoke(BeginChampionSelect, game); return; }

      LoLClient.QueueManager.ShowPage(new InGamePage(true));
      champselect = new ChampSelectPage(game);

      champselect.ChampSelectCompleted += Champselect_ChampSelectCompleted;

      ContentFrame.Content = champselect;
      Session.Current.ChatManager.Status = ChatStatus.championSelect;
    }
Пример #4
0
 protected virtual void OnGameStart(GameLobby champSelect)
 {
     GameStarted?.Invoke(this, champSelect);
 }
Пример #5
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();
            }
        }
Пример #6
0
 private void Queue_EnteredChampSelect(object sender, GameLobby e) {
   LoLClient.MainWindow.BeginChampionSelect(e);
 }
Пример #7
0
 protected virtual void OnGameStart(GameLobby champSelect) {
   GameStarted?.Invoke(this, champSelect);
 }
Пример #8
0
 protected void OnEnteredChampSelect(GameDTO game)
 {
     EnteredChampSelect?.Invoke(this, GameLobby.EnterChampSelect(game));
 }
Пример #9
0
 private void Lobby_GameStarted(object sender, GameLobby game) {
   hasStarted = true;
   LoLClient.MainWindow.BeginChampionSelect(game);
 }