public void ExecuteCommands()
        {
            foreach (CommandType c in commands)
            {
                switch (c)
                {
                case CommandType.START_LOCAL_TOURNAMENT:
                    App.Instance.StartTournamentFinder("127.0.0.1");
                    break;

                case CommandType.CONNECT_FIRST_TOURNAMENT:
                    TournamentFinderUC tuc = LogicalTreeHelper.FindLogicalNode(App.WindowInstance, "tournamentFinderUC") as TournamentFinderUC;
                    if (tuc != null)
                    {
                        tuc.ReceivedNewTournamentsCallback = (settings, serverAddress) =>
                        {
                            if (settings.Count > 0)
                            {
                                App.Instance.StartTournamentGame(serverAddress, settings[0].ServerId);
                                tuc.ReceivedNewTournamentsCallback = null;
                            }
                        };
                    }
                    break;

                case CommandType.CREATE_COMPETITION_TOURNAMENT:
                    TournamentSettings s = new TournamentSettings();
                    s.Name       = "Automatic Test Competition";
                    s.Leader     = App.Instance.PlayerName;
                    s.MMType     = MatchManagerType.ONLY_SCORE;
                    s.Level      = GameLevel.BASIC_MAP;
                    s.RoundCount = 10;
                    s.BotCount   = 0;
                    s.BotType    = BotType.NONE;

                    App.Instance.StartTournamentLobby("127.0.0.1");

                    App.Instance.GetSceneMgr().Enqueue(new Action(() =>
                    {
                        App.Instance.GetSceneMgr().ProcessNewTournamentSettings(s);
                    }));

                    LobbyUC lobby = LogicalTreeHelper.FindLogicalNode(Application.Current.MainWindow, "lobbyWindow") as LobbyUC;
                    if (lobby != null)
                    {
                        lobby.UpdateTournamentSettings(s);
                    }
                    break;
                }
            }
        }
Beispiel #2
0
 public VisualizableTorunamentSettings(TournamentSettings s)
 {
     Settings = s;
 }