コード例 #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;
        }
コード例 #2
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;
        }