public Page3(List <string> playernames) { InitializeComponent(); grid = new MemoryGrid(MemoryGrid, NR_OF_COLS, NR_OF_ROWS); label1.Content = playernames[0]; label2.Content = playernames[1]; }
public Page3(List <string> playernames) { InitializeComponent(); grid = new MemoryGrid(MemoryGrid, NR_OF_COLS, NR_OF_ROWS, playernames); label1.Content = playernames[0]; label2.Content = playernames[1]; grid.ScoreChange += UpdateScores; }
/// <summary> /// Initialize a new game screen to begin a new game. /// </summary> /// <param name="parentFrame">The Frame to navigate between pages.</param> /// <param name="player1">The object of the first player.</param> /// <param name="player2">The object of the second player.</param> /// <param name="difficulty">The string that holds the current difficulty.</param> public GameScreen(Frame parentFrame, Player player1, Player player2, string difficulty) { InitializeComponent(); this.parentFrame = parentFrame; this.player1 = player1; this.player2 = player2; this.difficulty = difficulty; SetGridSize(this.difficulty); grid = new MemoryGrid(this, cardHolder, player1, player2, colSize, rowSize); }
/// <summary> /// The click event of the restart button. /// This restarts the game to start over. /// </summary> /// <param name="sender">The object that is being clicked on.</param> /// <param name="args">The event arguments.</param> private void RestartButton_Click(object sender, RoutedEventArgs args) { MessageBoxResult result = MessageBox.Show("Weet je zeker dat je opnieuw wilt beginnen? Als je dit doet kom je niet op het scorebord.", "Opnieuw beginnen", MessageBoxButton.YesNo); if (result.Equals(MessageBoxResult.Yes)) { grid = new MemoryGrid(this, cardHolder, player1, player2, colSize, rowSize); player1.SetScore(0); player2.SetScore(0); player1.SetTurn(true); player2.SetTurn(false); UpdateLabels(player1, player2); } }
/// <summary> /// Initialize a new game screen to continue a previous game. /// </summary> /// <param name="parentFrame">The Frame to navigate between pages.</param> /// <param name="saveFile">The XML save file of the previous game.</param> /// <param name="player1Element">The element of the first player of the previous game.</param> /// <param name="player2Element">The element of the second player of the previous game.</param> /// <param name="cardsElement">The element that contains the status of all cards of the previous game.</param> public GameScreen(Frame parentFrame, XmlDocument saveFile, XmlNode player1Element, XmlNode player2Element, XmlNode cardsElement) { InitializeComponent(); this.parentFrame = parentFrame; this.player1 = new Player(player1Element.ChildNodes.Item(0).InnerText, Convert.ToInt32(player1Element.ChildNodes.Item(1).InnerText), Convert.ToBoolean(player1Element.ChildNodes.Item(2).InnerText)); this.player2 = new Player(player2Element.ChildNodes.Item(0).InnerText, Convert.ToInt32(player2Element.ChildNodes.Item(1).InnerText), Convert.ToBoolean(player2Element.ChildNodes.Item(2).InnerText)); this.difficulty = saveFile.GetElementsByTagName("difficulty").Item(0).InnerText; this.pairs = Convert.ToInt32(saveFile.GetElementsByTagName("pairs").Item(0).InnerText); SetGridSize(this.difficulty); grid = new MemoryGrid(this, cardHolder, player1, player2, colSize, rowSize); LoadData(cardsElement); }
public MainWindow() { InitializeComponent(); mgrid = new MemoryGrid(GameGrid); }
public Page3() { InitializeComponent(); grid = new MemoryGrid(MemoryGrid, NR_OF_COLS, NR_OF_ROWS); //InitializeGameGrid(); }
public MainWindow() { InitializeComponent(); grid = new MemoryGrid(GameGrid, NR_OF_COLS, NR_OF_ROWS); InitializeGameGrid(); }