public Player(Board b, ModelLevel m, ModelScore s, MainWindow mw) { board = b; levelModel = m; scoreModel = s; windowMain = mw; }
public void startLevel(string level) { levelModel.StartupLevel = level; levelReader.readMapString(); levelReader.readMapObject(); levelModel.LevelStarted = true; //Change the width and height and the title of the window this.Width = 16 + (levelModel.ColumnLenght * levelModel.CellSize) + levelModel.InfoGridWidth; this.Height = 39 + (levelModel.RowLenght * levelModel.CellSize); this.MinHeight = 39 + (8 * levelModel.CellSize); this.Title = "Sokoban: " + levelModel.StartupLevel; colInfoGrid.Width = new GridLength(levelModel.InfoGridWidth); if (board != null) { board.Visibility = Visibility.Collapsed; infoGrid.Visibility = Visibility.Collapsed; } board = new Board(this.levelModel); board.SetValue(Grid.ColumnProperty, 0); board.SetValue(Grid.RowProperty, 0); gameGrid.Children.Add(board); scoreModel = new ModelScore(); infoGrid = new InfoGrid(this, this.levelModel, scoreModel, highScore); infoGrid.SetValue(Grid.ColumnProperty, 1); infoGrid.SetValue(Grid.RowProperty, 0); gameGrid.Children.Add(infoGrid); player = new Player(board, levelModel, scoreModel, this); mainGrid.Visibility = Visibility.Collapsed; gameGrid.Visibility = Visibility.Visible; }