Пример #1
0
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

            //Load SoundEffects
            mClickSound = contentManager.Load <SoundEffect>("Audio/click2");
            mScream     = contentManager.Load <SoundEffect>("Audio/Gibbons_singen");


            mGraphicsDevice  = deviceManager.GraphicsDevice;
            mSpriteBatch     = new SpriteBatch(deviceManager.GraphicsDevice);
            mTotalWindowSize = new Vector2(mGraphicsDevice.Viewport.Width, mGraphicsDevice.Viewport.Height);

            // Load font
            var font          = contentManager.Load <SpriteFont>("Font");
            var subHeaderFont = contentManager.Load <SpriteFont>("SubHeaderFont");

            IsVisible = true;

            // Load background image
            mBackgroundImageStatistics = contentManager.Load <Texture2D>("scare");
            IsVisible = true;

            // Play Scream
            SoundManager.AddSound(mScream);

            mMenuList = new List <UIv2.Menu>();

            Texture2D texture2D = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.Black);

            // Instantiate a new menu
            var menu = new UIv2.Menu(deviceManager.GraphicsDevice, 5, 5, 90, 90);

            // Create the Back Button
            var backButton = new UIv2.Components.Button(mGraphicsDevice, 40, 80, 20, 7, texture2D, "Back", font, Color.White);

            backButton.AddTo(menu);
            backButton.AddListener(System.Windows.Forms.MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
                mScream.Dispose();
                IsVisible = false;
            });

            mMenuList.Add(menu);

            mMainMenuScreen = new MainMenuScreen();
        }
Пример #2
0
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

            //Load SoundEffects
            mClickSound = contentManager.Load <SoundEffect>("Audio/click2");

            mGraphicsDevice  = deviceManager.GraphicsDevice;
            mSpriteBatch     = new SpriteBatch(deviceManager.GraphicsDevice);
            mTotalWindowSize = new Vector2(mGraphicsDevice.Viewport.Width, mGraphicsDevice.Viewport.Height);

            // Load font
            var font          = contentManager.Load <SpriteFont>("Font");
            var subHeaderFont = contentManager.Load <SpriteFont>("SubHeaderFont");

            IsVisible = true;

            // Load background image
            mBackgroundImageStatistics = contentManager.Load <Texture2D>("forest");
            IsVisible = true;

            mMenuList = new List <UIv2.Menu>();

            Texture2D texture2D = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.Black);

            // Instantiate a new menu
            var menu = new UIv2.Menu(deviceManager.GraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(mGraphicsDevice, (int)mTotalWindowSize.X, (int)mTotalWindowSize.Y, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);

            var heading = new UIv2.Components.Label(mGraphicsDevice, 35, 5, 30, 15, "Statistics", subHeaderFont, Color.White);

            heading.FontType = FontManager.FontType.Subheading;
            heading.AddTo(menu);

            var time = TimeSpan.FromMilliseconds(Statistic.Time);

            // Gesamtspielzeit
            var timeString       = "Total playing time: " + time.Days + " days " + time.Hours + " hours " + time.Minutes + " minutes " + time.Seconds + " seconds";
            var totalPlayingTime = new UIv2.Components.Label(mGraphicsDevice, 30, 20, 40, 7, timeString, font, Color.White);

            totalPlayingTime.AddTo(menu);


            // Escaped Mit-Primaten beim Durchspielen
            var fledPrimatesString = "Total amount of primates fled: " + Statistic.EscapedApes;
            var fledPrimatesLabel  = new UIv2.Components.Label(mGraphicsDevice, 30, 30, 40, 7, fledPrimatesString, font, Color.White);

            fledPrimatesLabel.AddTo(menu);


            // Escaped Holzfäller
            var lumberjacksFledString = "Total number of lumberjacks defeated: " + Statistic.EscapedLumberjacks;
            var lumberjacksFledLabel  = new UIv2.Components.Label(mGraphicsDevice, 30, 40, 40, 7, lumberjacksFledString, font, Color.White);

            lumberjacksFledLabel.AddTo(menu);


            // Wie oft hat man gewonnen / verloren
            var lostWonString = "Games won: " + Statistic.Win + "    " + "Games lost: " + Statistic.Lost;
            var lostWonLabel  = new UIv2.Components.Label(mGraphicsDevice, 30, 50, 40, 7, lostWonString, font, Color.White);

            lostWonLabel.AddTo(menu);


            // Minimale Zeit zum Durchspielen
            time = TimeSpan.FromMilliseconds(Statistic.Time);

            // Gesamtspielzeit
            timeString = "Total playing time: " + time.Days + " days " + time.Hours + " hours " + time.Minutes + " minutes " + time.Seconds + " seconds";
            var minTimeString = Statistic.MinimalTime == 0 ? "Shortest time to finish the whole game: Not finished" : "Shortest time to finish the whole game: " + timeString;
            var minTimeLabel  = new UIv2.Components.Label(mGraphicsDevice, 30, 60, 40, 7, minTimeString, font, Color.White);

            minTimeLabel.AddTo(menu);


            // Create the Back Button
            var backButton = new UIv2.Components.Button(mGraphicsDevice, 40, 80, 20, 7, texture2D, "Back", font, Color.White);

            backButton.AddTo(menu);
            backButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
                IsVisible = false;
            });

            mMenuList.Add(menu);

            mMainMenuScreen = new MainMenuScreen();
        }
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

            //Load SoundEffects
            mClickSound = contentManager.Load <SoundEffect>("Audio/click2");

            // Unlock the framerate. Later we want to remove this piece of code
            // deviceManager.SynchronizeWithVerticalRetrace = false;
            // deviceManager.ApplyChanges();

            mMenuList = new List <UIv2.Menu>();

            // Load font
            var font          = contentManager.Load <SpriteFont>("Font");
            var subHeaderFont = contentManager.Load <SpriteFont>("SubHeaderFont");

            IsVisible = true;

            mGraphicsDevice  = deviceManager.GraphicsDevice;
            mTotalWindowSize = new Vector2(mGraphicsDevice.Viewport.Width, mGraphicsDevice.Viewport.Height);

            mSpriteBatch = new SpriteBatch(mGraphicsDevice);

            // Load background image
            mBackgroundImageAchievements = contentManager.Load <Texture2D>("forest");
            IsVisible = true;

            // Instantiate a new menu
            // var windowWidth = deviceManager.GraphicsDevice.Viewport.Width;
            // var windowHeight = deviceManager.GraphicsDevice.Viewport.Height;

            // mEditorScreen = new EditorScreen();
            // ScreenManager.Add(mEditorScreen);

            Texture2D texture2D = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.Black);
            Texture2D Checked   = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.DarkOliveGreen);

            // Instantiate a new menu
            var menu = new UIv2.Menu(deviceManager.GraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(mGraphicsDevice, (int)mTotalWindowSize.X, (int)mTotalWindowSize.Y, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);

            var screenName = new UIv2.Components.Label(deviceManager.GraphicsDevice, 35, 5, 30, 15, "Achievements", subHeaderFont, Color.White);

            screenName.FontType = FontManager.FontType.Subheading;
            screenName.AddTo(menu);


            // “Gamemaster”: Beende das Spiel erfolgreich.
            var gamemasterString = "Gamemaster: You've played through the whole game. Nice work!";
            var gamemasterButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 15, 25, 70, 7, texture2D, Checked, gamemasterString, font, Color.White, Achievements.Gamemaster);

            gamemasterButton.AddTo(menu);


            // “Lumberjack’s nightmare”: Vertreibe 42 Holzfäller.
            var lumberjackString = "Lumberjack's nightmare: You've made 42 lumberjacks run away. Awesome!";
            var lumberjackLabel  = new UIv2.Components.CheckedButton(mGraphicsDevice, 15, 35, 70, 7, texture2D, Checked, lumberjackString, font, Color.White, Achievements.LumberjacksNightmare);

            lumberjackLabel.AddTo(menu);


            // “Speed runner”: Beende das Spiel innerhalb von 60 Minuten.
            var speedyString = "Speed runner: You've finished the whole game within 1 hour. Speedy Gonzales huh?!";
            var speedyLabel  = new UIv2.Components.CheckedButton(mGraphicsDevice, 15, 45, 70, 7, texture2D, Checked, speedyString, font, Color.White, Achievements.Speedrunner);

            speedyLabel.AddTo(menu);


            // “Redundancy”: Erhalte ein Achievement.
            var redundancyString = "Redundancy: An achievement is officially yours. Hopefully you're happy with it!";
            var redundancyLabel  = new UIv2.Components.CheckedButton(mGraphicsDevice, 15, 55, 70, 7, texture2D, Checked, redundancyString, font, Color.White, Achievements.Redundancy);

            redundancyLabel.AddTo(menu);


            // “Tribute to the creators”: Credits angeschaut.
            var creditsString = "Tribute to the creators: You've had a look at the credits. Thanks man!";
            var creditsLabel  = new UIv2.Components.CheckedButton(mGraphicsDevice, 15, 65, 70, 7, texture2D, Checked, creditsString, font, Color.White, Achievements.TributeToTheCreators);

            creditsLabel.AddTo(menu);

            var backButton = new UIv2.Components.Button(mGraphicsDevice, 40, 80, 20, 7, texture2D, "Back", font, Color.White);

            backButton.AddTo(menu);
            backButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);

                ScreenManager.Remove(this);
                IsVisible = false;
            });


            mMenuList.Add(menu);

            mMainMenuScreen = new MainMenuScreen();
        }