Ejemplo n.º 1
0
    public static async Task<CustomLobby> CreateLobby(PracticeGameConfig config) {
      var lobby = new CustomLobby();
      Session.Current.CurrentLobby = lobby;

      GameDTO game = await RiotServices.GameService.CreatePracticeGame(config);

      if (game?.Name == null) {
        throw new Exception("Invalid name");
      } else {
        lobby.GotGameData(game);
        return lobby;
      }
    }
Ejemplo n.º 2
0
    private async void CreateGame(object sender, RoutedEventArgs e) {
      ErrorLabel.Visibility = Visibility.Collapsed;
      var config = new PracticeGameConfig();
      config.GameName = GameName.Text;
      config.GamePassword = GamePass.Text;
      config.MaxNumPlayers = ((int) TeamSize.SelectedItem) * 2;
      config.GameTypeConfig = (GameType.SelectedItem as GameConfig).Key;
      config.AllowSpectators = (Spectators.SelectedItem as SpectatorState).Key;
      config.GameMap = selected;
      switch (selected.MapId) {
        case 8: config.GameMode = "ODIN"; break;
        case 10:
        case 11: config.GameMode = "CLASSIC"; break;
        case 12:
        case 14: config.GameMode = "ARAM"; break;
      }

      try {
        var lobby = await CustomLobby.CreateLobby(config);
        LoLClient.QueueManager.JoinLobby(lobby);
      } catch {
        ErrorLabel.Visibility = Visibility.Visible;
      }
    }