public ReadyCheckUC(LobbyUC lobbyUC) { this.lobbyUC = lobbyUC; InitializeComponent(); App.Instance.FocusWindow(); // TODO: zvuk }
private void btnCreateTournament_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(tbName.Text)) { return; } TournamentSettings s = new TournamentSettings(); s.Name = tbName.Text; s.Leader = App.Instance.PlayerName; s.MMType = (MatchManagerType)cbType.SelectedValue; s.Level = (GameLevel)cbMap.SelectedValue; try { s.RoundCount = int.Parse(tbRounds.Text, CultureInfo.InvariantCulture); if (s.RoundCount < 1) { throw new Exception(); } } catch (Exception) { s.RoundCount = 1; tbRounds.Text = 1.ToString(Strings.Culture); } /*#if !DEBUG * s.BotCount = 0; * s.BotType = SharedDef.DEFAULT_BOT; #else*/ try { s.BotCount = int.Parse(tbBotCount.Text, CultureInfo.InvariantCulture); } catch (Exception) { s.BotCount = 0; } s.BotType = (BotType)cbBot.SelectedValue; //#endif App.Instance.StartTournamentLobby(serverAddress); 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); } }