public Engine(SetupModel setup) { currentTurn = Mark.X; board = new Mark?[3, 3]; ScoreX = ScoreO = 0; playerX = setup.PlayerNameX; playerO = setup.PlayerNameO; difficultyLevel = setup.Level; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { model = e.Parameter as SetupModel; engine = new Engine(model); UpdateScores(); CleanBoard(); TriggerButtons(true); tbScore1.FontWeight = FontWeights.Bold; tbScore2.FontWeight = FontWeights.Normal; }
private void StartGame(object sender, RoutedEventArgs e) { SetupModel model = new SetupModel { PlayerNameX = tbPlayerNameX.Text, PlayerNameO = difficultyLevel != DifficultyLevel.Multiplayer ? "Computer" : tbPlayerNameO.Text, Level = difficultyLevel }; Frame.Navigate(typeof(Game), model); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { SetupModel model = e.Parameter as SetupModel; if (model != null) { tbPlayerNameX.Text = model.PlayerNameX; difficultyLevel = model.Level; if (difficultyLevel == DifficultyLevel.Multiplayer) { tbPlayerNameO.Text = model.PlayerNameO; ShowSinglePlayerControls(false); ShowMulitPlayerControls(true); } else { CheckDifficultyLevel(); } } }