示例#1
0
 public GameDTO CreatePracticeGame(PracticeGameConfig practiceGameConfig)
 {
     int Id = Invoke("gameService", "createPracticeGame", new object[] { practiceGameConfig.GetBaseTypedObject() });
     while (!results.ContainsKey(Id))
         System.Threading.Thread.Sleep(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     GameDTO result = new GameDTO(messageBody);
     results.Remove(Id);
     return result;
 }
 public async Task<GameDTO> CreatePracticeGame(PracticeGameConfig practiceGameConfig)
 {
     int Id = Invoke("gameService", "createPracticeGame", new object[] { practiceGameConfig.GetBaseTypedObject() });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     GameDTO result = new GameDTO(messageBody);
     results.Remove(Id);
     return result;
 }
示例#3
0
 /// 46.)
 public void CreatePracticeGame(PracticeGameConfig practiceGameConfig, GameDTO.Callback callback)
 {
     GameDTO cb = new GameDTO(callback);
     InvokeWithCallback("gameService", "createPracticeGame",
         new object[] { practiceGameConfig.GetBaseTypedObject() }, cb);
 }
        private PracticeGameConfig GenerateGameConfig()
        {
            if (!PageLoaded)
                return new PracticeGameConfig();

            NameInvalidLabel.Visibility = Visibility.Hidden;
            PracticeGameConfig gameConfig = new PracticeGameConfig();
            gameConfig.GameName = NameTextBox.Text;
            gameConfig.GamePassword = PasswordTextBox.Text;
            gameConfig.MaxNumPlayers = Convert.ToInt32(TeamSizeComboBox.SelectedItem) * 2;
            switch ((string)GameTypeComboBox.SelectedItem)
            {
                case "Blind Pick":
                    gameConfig.GameTypeConfig = 1;
                    break;

                case "No Ban Draft":
                    gameConfig.GameTypeConfig = 3;
                    break;

                case "All Random":
                    gameConfig.GameTypeConfig = 4;
                    break;

                case "Open Pick":
                    gameConfig.GameTypeConfig = 5;
                    break;

                case "Blind Draft":
                    gameConfig.GameTypeConfig = 7;
                    break;

                case "Infinite Time Blind Pick":
                    gameConfig.GameTypeConfig = 11;
                    break;

                case "One for All":
                    gameConfig.GameTypeConfig = 14;
                    break;

                case "Captain Pick":
                    gameConfig.GameTypeConfig = 12;
                    break;

                default: //Tournament Draft
                    gameConfig.GameTypeConfig = 6;
                    break;
            }
            switch ((string)((Label)MapListBox.SelectedItem).Content)
            {
                case "The Crystal Scar":
                    gameConfig.GameMap = GameMap.TheCrystalScar;
                    gameConfig.GameMode = "ODIN";
                    break;

                case "Howling Abyss":
                    gameConfig.GameMap = GameMap.HowlingAbyss;
                    gameConfig.GameMode = "ARAM";
                    break;

                case "The Twisted Treeline":
                    gameConfig.GameMap = GameMap.TheTwistedTreeline;
                    gameConfig.GameMode = "CLASSIC";
                    if (gameConfig.MaxNumPlayers > 6)
                    {
                        NameInvalidLabel.Content = "Team size must be lower or equal to 3";
                        NameInvalidLabel.Visibility = Visibility.Visible;
                        CreateGameButton.IsEnabled = false;
                        return gameConfig;
                    }
                    break;

                default:
                    gameConfig.GameMap = GameMap.SummonersRift;
                    gameConfig.GameMode = "CLASSIC";
                    break;
            }
            switch ((string)AllowSpectatorsComboBox.SelectedItem)
            {
                case "None":
                    gameConfig.AllowSpectators = "NONE";
                    break;

                case "Lobby Only":
                    gameConfig.AllowSpectators = "LOBBYONLY";
                    break;

                case "Friends List Only":
                    gameConfig.AllowSpectators = "DROPINONLY";
                    break;

                default:
                    gameConfig.AllowSpectators = "ALL";
                    break;
            }
            CreateGameButton.IsEnabled = true;
            return gameConfig;
        }