Ejemplo n.º 1
0
        public BoardView(Game game, Board board, SpriteBatch spriteBatch, int screenWidth, int screenHeight)
            : base(game)
        {
            this.board = board;
            this.spriteBatch = spriteBatch;

            tileWidth = screenWidth / board.Width;
            tileHeight = screenHeight / board.Height;
            ScreenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        public DrillOilNotificationWindow(Game game, SpriteBatch spriteBatch, Board board, int boardX, int boardY)
            : base(game)
        {
            _Board = board;
            _Game = game;
            _SpriteBatch = spriteBatch;
            _BoardX = boardX;
            _BoardY = boardY;

            _WindowLocation = new Vector2(400, 250);

            game.Components.Add(this);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 5
0
 public TurnManager(Board board, List<Player> players)
 {
     this.board = board;
     this.Players = players;
 }