Beispiel #1
0
        protected void LoadContent()
        {
            //Load fonts
            SmartFont[] fonts = new SmartFont[100];
            fonts[16] = fontFactory.LoadFont("Consolas", 16f).Load();
            //fonts[32] = fontFactory.LoadFont("Consolas", 32f).Load();
            //fonts[72] = fontFactory.LoadFont("LemonMilk", 72f).Load();

            TextureLib textures = new TextureLib(GraphicsDevice, contentManager);

            //Load textures
            textures.LoadTexture("pixel");
            textures.LoadTexture("board");
            textures.LoadTexture("boardBevel");
            textures.LoadTexture("marbleTable");

            textures.LoadTexture("title");
            textures.LoadTexture("play");
            textures.LoadTexture("singleplayer");
            textures.LoadTexture("singleplayerBig");
            textures.LoadTexture("multiplayer");
            textures.LoadTexture("howtoplay");
            textures.LoadTexture("options");
            textures.LoadTexture("about");
            textures.LoadTexture("goback");
            textures.LoadTexture("gamesetup");
            textures.LoadTexture("human");
            textures.LoadTexture("computer");

            textures.LoadTexture("indentBlue");
            textures.LoadTexture("indentBrown");
            textures.LoadTexture("indentGreen");
            textures.LoadTexture("indentRed");
            textures.LoadTexture("indentYellow");

            textures.LoadTexture("blueMarble");
            textures.LoadTexture("greenMarble");
            textures.LoadTexture("redMarble");
            textures.LoadTexture("yellowMarble");

            content = new GameContent(textures, fonts);

            board     = new Board();
            boardView = new BoardView(board, Size);
            boardView.AnalysisView = this.AnalysisView;
            boardView.NotationView = this.NotationPane;

            boardView.LoadContent(Device, Content);


            Player[] players = new Player[4];
            players[0] = new ComputerPlayer(0, Personality.Adaptive, ComputerPlayer.Difficulties[9], boardView);
            players[1] = new ComputerPlayer(1, Personality.Aggressive, ComputerPlayer.Difficulties[9], boardView);
            players[2] = new ComputerPlayer(2, Personality.Active, ComputerPlayer.Difficulties[9], boardView);
            players[3] = new ComputerPlayer(3, Personality.Passive, ComputerPlayer.Difficulties[9], boardView);

            boardView.SetPlayers(players);
            boardView.Playing = true;
        }
 /// <summary>
 /// Draws the view
 /// </summary>
 /// <param name="batch">Sprite Batch</param>
 /// <param name="textures">Textures</param>
 public void Draw(SpriteBatch batch, TextureLib textures)
 {
     batch.Draw(textures[view.GetIndentAsset(Team)], Rect, Color);
     if (HasMarble)
     {
         batch.Draw(textures[view.GetMarbleAsset(Team)], Rect, Color);
     }
 }
 /// <summary>
 /// Draws the view of the square
 /// </summary>
 /// <param name="batch">SpriteBatch</param>
 /// <param name="textures">Textures</param>
 public void Draw(SpriteBatch batch, TextureLib textures)
 {
     if (Square.IsInBase())
     {
         batch.Draw(textures[boardView.GetIndentAsset(Square.QuadrantValue - 4)], Rect, Color);
     }
     else if (Square.SquareValue == 0)
     {
         batch.Draw(textures[boardView.GetIndentAsset(Square.QuadrantValue)], Rect, Color);
     }
     else
     {
         batch.Draw(textures["indentBrown"], Rect, Color);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Draws the view of the marble
        /// </summary>
        /// <param name="batch">Sprite Batch</param>
        /// <param name="textures">Textures</param>
        public void Draw(SpriteBatch batch, TextureLib textures)
        {
            int marbleWidth  = (int)(boardView.View.Width / 29.166666666666666666666666666667);
            int marbleHeight = (int)(boardView.View.Height / 29.166666666666666666666666666667);

            string asset = boardView.GetMarbleAsset(Team);

            if (dragging)
            {
                batch.Draw(textures[asset], new Rectangle((int)dragPosition.X - 14, (int)dragPosition.Y - 14, marbleWidth, marbleHeight), Color.White);
            }
            else
            {
                batch.Draw(textures[asset], new Rectangle((int)position.X, (int)position.Y, marbleWidth, marbleHeight), Color.White);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Draws the board's tiles
        /// </summary>
        /// <param name="batch">SpriteBatch</param>
        /// <param name="textures">Texture Library</param>
        public void DrawBoard(SpriteBatch batch, TextureLib textures)
        {
            batch.Draw(textures["board"], new Rectangle(View.X, View.Y, View.Width + 20, View.Height + 20), Color.White);

            for (int i = 0; i < 13; i++)
            {
                for (int j = 0; j < 13; j++)
                {
                    if (squares[i][j] != null)
                    {
                        squares[i][j].Draw(batch, textures);
                    }
                }
            }

            for (int t = 0; t < 4; t++)
            {
                for (int s = 0; s < 5; s++)
                {
                    starts[t][s].Draw(batch, textures);
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// Draws the line
 /// </summary>
 /// <param name="spriteBatch">Sprite Batch</param>
 /// <param name="textures">Textures</param>
 public void Draw(SpriteBatch spriteBatch, TextureLib textures)
 {
     spriteBatch.Draw(textures["arrow"], rect, null, color, rotation, new Vector2(0), SpriteEffects.None, 0.0f);
 }
Beispiel #7
0
        /// <summary>
        /// Draws the marbles on the board
        /// </summary>
        /// <param name="batch">SpriteBatch</param>
        /// <param name="textures">Texture Library</param>
        public void DrawMarbles(SpriteBatch batch, TextureLib textures)
        {
            bool      artificiallyDrawMarble = false;
            bool      isPartOfMove           = false;
            PieceMove partOfMove             = null;

            for (int i = 0; i < 13; i++)
            {
                for (int j = 0; j < 13; j++)
                {
                    if (layout[i][j] != null)
                    {
                        Square current = new Square(layout[i][j]);
                        if (currentAnimation != null)
                        {
                            if (current.Equals(currentAnimation.From))
                            {
                                continue;
                            }
                        }

                        if (currentDrag != null)
                        {
                            if (current.Equals(currentDrag.From))
                            {
                                continue;
                            }
                        }

                        artificiallyDrawMarble = false;
                        isPartOfMove           = false;
                        for (int k = 0; k < currentMove.Count; k++)
                        {
                            if (currentMove[k].From != null)
                            {
                                if (currentMove[k].From.Equals(current))
                                {
                                    partOfMove             = currentMove[k];
                                    artificiallyDrawMarble = false;
                                    isPartOfMove           = true;
                                }
                            }

                            if (currentMove[k].To.Equals(current))
                            {
                                partOfMove             = currentMove[k];
                                artificiallyDrawMarble = true;
                                isPartOfMove           = true;
                                break;
                            }
                        }

                        if (isPartOfMove)
                        {
                            if (artificiallyDrawMarble)
                            {
                                string asset = GetMarbleAsset(currentPlayer.Team);
                                batch.Draw(textures[asset], squares[i][j].Rect, (squares[i][j].Selected) ? Color.LightBlue : Color.White);
                            }
                        }
                        else
                        {
                            int marble = board.Get(layout[i][j]);
                            if (marble != -1)
                            {
                                string asset = GetMarbleAsset(marble);
                                batch.Draw(textures[asset], squares[i][j].Rect, (squares[i][j].Selected) ? Color.LightBlue : Color.White);
                            }
                        }
                    }
                }
            }
        }
 public GameContent(TextureLib textures, SmartFont[] fonts) : this()
 {
     Textures = textures;
     Fonts    = fonts;
 }
Beispiel #9
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            fontFactory = new FontFactory(GraphicsDevice);

            //Load fonts
            SmartFont[] fonts = new SmartFont[100];
            fonts[16] = fontFactory.LoadFont("Consolas", 16f).Load();
            //fonts[32] = fontFactory.LoadFont("Consolas", 32f).Load();
            //fonts[72] = fontFactory.LoadFont("LemonMilk", 72f).Load();

            TextureLib textures = new TextureLib(Content);

            //Load textures
            textures.LoadTexture("board");
            textures.LoadTexture("boardBevel");
            textures.LoadTexture("marbleTable");

            textures.LoadTexture("title");
            textures.LoadTexture("play");
            textures.LoadTexture("singleplayer");
            textures.LoadTexture("singleplayerBig");
            textures.LoadTexture("multiplayer");
            textures.LoadTexture("howtoplay");
            textures.LoadTexture("options");
            textures.LoadTexture("about");
            textures.LoadTexture("goback");
            textures.LoadTexture("gamesetup");
            textures.LoadTexture("human");
            textures.LoadTexture("computer");

            textures.LoadTexture("indentBlue");
            textures.LoadTexture("indentBrown");
            textures.LoadTexture("indentGreen");
            textures.LoadTexture("indentRed");
            textures.LoadTexture("indentYellow");

            textures.LoadTexture("blueMarble");
            textures.LoadTexture("greenMarble");
            textures.LoadTexture("redMarble");
            textures.LoadTexture("yellowMarble");

            content = new GameContent(textures, fonts);

            MainMenu mainMenu = new MainMenu(this);

            gameStates.Add("mainmenu", mainMenu);

            Singleplayer singleplayer = new Singleplayer(this);

            gameStates.Add("singleplayer", singleplayer);

            Gameplay gameplay = new Gameplay(this);

            gameStates.Add("gameplay", gameplay);

            mainMenu.Load(content);
            singleplayer.Load(content);
            gameplay.Load(content);

            currentGameState = mainMenu;
        }