Beispiel #1
0
        public MoneyView(Game game, TurnManager turnManager, SpriteBatch spriteBatch, List<Player> players)
            : base(game)
        {
            _PlayerList = players;
            _TurnManager = turnManager;
            _SpriteBatch = spriteBatch;

            game.Components.Add(this);
        }
Beispiel #2
0
        public TurnIndicatorView(Game game, SpriteBatch spriteBatch, TurnManager turnManager, int boardWidth, int boardHeight)
            : base(game)
        {
            this.boardWidth = boardWidth;
            this.boardHeight = boardHeight;
            this.spriteBatch = spriteBatch;
            this.turnManager = turnManager;

            game.Components.Add(this);
        }
Beispiel #3
0
        public MouseInputBehaviour(Game game, SpriteBatch spriteBatch, INotificationWindow notificationBox, Board board, TurnManager turnManager, MouseInputHandler mouseInputHandler, int screenWidth, int screenHeight)
        {
            _SpriteBatch = spriteBatch;
            _Game = game;
            this.turnManager = turnManager;
            this.screenWidth = screenWidth;
            this.screenHeight = screenHeight;
            this.notificationBox = notificationBox;
            this._Board = board;

            mouseInputHandler.LeftMouseClick += handleMouseClick;
        }
Beispiel #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            var random = new Random();
            var board = new Board(BoardWidth, BoardHeight, random);

            var playerList = new[]
                {
                    new Player("Ian", startingMoney, Color.Red),
                    new Player("Ryan", startingMoney, Color.Blue),
                    new Player("Stefan", startingMoney, Color.Yellow),
                    new Player("Jeremy", startingMoney, Color.Green)
                }.ToList();

            var turnManager = new TurnManager(board, playerList);

            notificationBox = null;
            var mouseInputHandler = new MouseInputHandler(this);
            var mouseInputBehaviour = new MouseInputBehaviour(this, spriteBatch, notificationBox, board, turnManager, mouseInputHandler, ScreenWidth, ScreenHeight);

            var moneyView = new MoneyView(this, turnManager, spriteBatch, playerList);

            //var turnIndicatorView = new TurnIndicatorView(this, spriteBatch, turnManager, BoardWidth, BoardHeight);

            //for(int i = 0; i < BoardWidth; i++) {
            //    board.Cells[i, 0].Owner = playerList[0];
            //}

            var boardView = new BoardView(this, board, spriteBatch, ScreenWidth, ScreenHeight);
            Components.Add(boardView);

            base.Initialize();
        }