示例#1
0
        public MisterTokenGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            stats = new StatsTracker();

            titleMenu = new Menu2(true, true, delegate() { SaveAndQuit(); });
            videoMenu = new Menu2(true, true, delegate() { state = State.TITLE_MENU; });
            musicMenu = new Menu2(true, true, delegate() { state = State.TITLE_MENU; });
        }
示例#2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Sprites.LoadContent(Content, GraphicsDevice);
            Sound.LoadContent(Content);
            Levels.LoadContent(Content);

            titleMenu.Add("1 Player", delegate() {
                singlePlayer = true;
                subMenu = worldMenu;
                state = State.SUB_MENU;
            });
            titleMenu.Add("2 Player", delegate() {
                singlePlayer = false;
                subMenu = worldMenu;
                state = State.SUB_MENU;
            });
            titleMenu.Add("Video", delegate() {
                subMenu = videoMenu;
                state = State.SUB_MENU;
            });
            titleMenu.Add("Music", delegate() {
                subMenu = musicMenu;
                state = State.SUB_MENU;
            });
            titleMenu.Add("Help", delegate() {
                state = State.HELP_SCREEN;
            });
            titleMenu.Add("Exit", delegate() {
                SaveAndQuit();
            });

            videoMenu.Add("Fullscreen Native", delegate() {
                graphics.IsFullScreen = false;
                graphics.ApplyChanges();
                graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width;
                graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height;
                graphics.IsFullScreen = true;
                graphics.ApplyChanges();

                Storage.GetSaveData().height = graphics.PreferredBackBufferHeight;
                Storage.GetSaveData().width = graphics.PreferredBackBufferWidth;
                Storage.GetSaveData().fullscreen = graphics.IsFullScreen;
            });
            videoMenu.Add("Window 1280x720", delegate() {
                graphics.PreferredBackBufferWidth = 1280;
                graphics.PreferredBackBufferHeight = 720;
                graphics.IsFullScreen = false;
                graphics.ApplyChanges();

                Storage.GetSaveData().height = graphics.PreferredBackBufferHeight;
                Storage.GetSaveData().width = graphics.PreferredBackBufferWidth;
                Storage.GetSaveData().fullscreen = graphics.IsFullScreen;
            });
            videoMenu.Add("Window 640x480", delegate() {
                graphics.PreferredBackBufferWidth = 640;
                graphics.PreferredBackBufferHeight = 480;
                graphics.IsFullScreen = false;
                graphics.ApplyChanges();

                Storage.GetSaveData().height = graphics.PreferredBackBufferHeight;
                Storage.GetSaveData().width = graphics.PreferredBackBufferWidth;
                Storage.GetSaveData().fullscreen = graphics.IsFullScreen;
            });
            videoMenu.Add("Fullscreen 1280x720", delegate() {
                graphics.PreferredBackBufferWidth = 1280;
                graphics.PreferredBackBufferHeight = 720;
                graphics.IsFullScreen = true;
                graphics.ApplyChanges();

                Storage.GetSaveData().height = graphics.PreferredBackBufferHeight;
                Storage.GetSaveData().width = graphics.PreferredBackBufferWidth;
                Storage.GetSaveData().fullscreen = graphics.IsFullScreen;
            });
            videoMenu.Add("Fullscreen 640x480", delegate() {
                graphics.PreferredBackBufferWidth = 640;
                graphics.PreferredBackBufferHeight = 480;
                graphics.IsFullScreen = true;
                graphics.ApplyChanges();

                Storage.GetSaveData().height = graphics.PreferredBackBufferHeight;
                Storage.GetSaveData().width = graphics.PreferredBackBufferWidth;
                Storage.GetSaveData().fullscreen = graphics.IsFullScreen;

            });
            videoMenu.Add("Back", delegate() {
                state = State.TITLE_MENU;
            });

            musicMenu.AddMusic("Off", SoundHook.SONG_NONE);
            musicMenu.AddMusic("Random", SoundHook.SONG_RANDOM);
            musicMenu.AddMusic("Classic", SoundHook.SONG_2);
            musicMenu.AddMusic("Modern", SoundHook.SONG_3);
            musicMenu.Add("Back", delegate() {
                state = State.TITLE_MENU;
            });

            /*
            worldMenu = new Menu2(PlayerIndex.One, delegate() { state = State.TITLE_MENU; });
            for (int world = 0; world < Levels.GetWorldCount(); ++world) {
                Menu2 levelMenu = new Menu2(PlayerIndex.One, delegate() { subMenu = worldMenu; });
                for (int level = 0; level < Levels.GetLevelCount(world); ++level) {
                    levelMenu.AddLevel(Levels.GetLevel(world, level), delegate(Level levelObject) {
                        int randomSeed = (new Random()).Next();
                        if (singlePlayer) {
                            model = new SinglePlayer(PlayerIndex.One, levelObject, new Random(randomSeed), true, this);
                        } else {
                            model = new MultiPlayer(levelObject, randomSeed, stats, this);
                        }
                        state = State.PLAYING;
                        Sound.StartMusic(SoundHook.SONG_2);
                    });
                }
                worldMenu.Add(Levels.GetWorldName(world), delegate() {
                    subMenu = levelMenu;
                });
            }
            */

            worldMenu = new Menu2(true, true, delegate() { state = State.TITLE_MENU; });
            int number = 1;
            for (int world = 0; world < Levels.GetWorldCount(); ++world) {
                for (int level = 0; level < Levels.GetLevelCount(world); ++level) {
                    worldMenu.AddLevel(number++, Levels.GetLevel(world, level), delegate(Level levelObject) {
                        int randomSeed = (new Random()).Next();
                        if (singlePlayer) {
                            model = new SinglePlayer(PlayerIndex.One, levelObject, new Random(randomSeed), true, this);
                        } else {
                            model = new MultiPlayer(levelObject, randomSeed, stats, this);
                        }
                        state = State.PLAYING;
                        Sound.StartMusic();
                    });
                }
            }
        }