public GameScreen(SerializationInfo info, StreamingContext context)
 {
     IsVisible      = (bool)info.GetValue("IsVisible", typeof(bool));
     mLevel         = (Level)info.GetValue("mLevel", typeof(Level));
     mCameraHandler = (CameraHandler)info.GetValue("mCameraHandler", typeof(CameraHandler));
     mCamera        = mCameraHandler.mCamera;// (Camera)info.GetValue("mCamera", typeof(Camera));
     // mViewport = (Viewport)info.GetValue("mViewport", typeof(Viewport));
     // mRenderTarget = (RenderTarget)info.GetValue("mRenderTarget", typeof(RenderTarget));
     // mMasterRenderer = (MasterRenderer)info.GetValue("mMasterRenderer", typeof(MasterRenderer));
     // mContentManager= (ContentManager)info.GetValue("mContentManager", typeof(ContentManager));
     // mContentManager = (ContentManager)info.GetValue("mContentManager", typeof(ContentManager));
     mSpriteBatch = (SpriteBatch)info.GetValue("mSpriteBatch", typeof(SpriteBatch));
     mMenu        = (Menu)info.GetValue("mMenu", typeof(Menu));
     mLabel       = (Label)info.GetValue("mLabel", typeof(Label));
     mLevelPath   = (string)info.GetValue("mLevelPath", typeof(string));
 }
        public void LoadContent(GraphicsDeviceManager deviceManager,
                                ContentManager contentManager,
                                int windowWidth,
                                int windowHeight)
        {
            var graphicsDevice = deviceManager.GraphicsDevice;

            // Create a new content manager so we can unload all its content later
            mContentManager = new ContentManager(contentManager.ServiceProvider, contentManager.RootDirectory);

            mLevel = new Level(mContentManager, SoundManager, graphicsDevice, false);
            mLevel.Load(mLevelPath);

            mSpriteBatch = new SpriteBatch(graphicsDevice);

            var font = mContentManager.Load <SpriteFont>("Font");

            mMenu           = new Menu(graphicsDevice, 0, 0, 100, 100);
            mLabel          = new Label(graphicsDevice, 0, 0, 25, 3, "", font, Color.Orange);
            mLabel.FontType = FontManager.FontType.Default;
            mLabel.AddTo(mMenu);

            mRenderTarget = new RenderTarget(graphicsDevice,
                                             Options.ResolutionWidth,
                                             Options.ResolutionHeight,
                                             Options.ShadowResolution);
            mMasterRenderer = new MasterRenderer(graphicsDevice, mContentManager)
            {
                DebugMode = false
            };

            mCamera = new Camera(farPlane: Options.ViewingDistance,
                                 nearPlane: 0.5f,
                                 thirdPerson: true,
                                 location: mLevel.mInitialSilverbackLocation);
            mCameraHandler = new CameraHandler(mCamera, 4.0f, 2.0f, .3f);

            mCamera.UpdatePerspective();
        }
Exemple #3
0
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

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

            Device       = deviceManager.GraphicsDevice;
            mSpriteBatch = new SpriteBatch(deviceManager.GraphicsDevice);

            // Unlock the framerate. Later we want to remove this piece of code
            mGraphicsDevice = deviceManager.GraphicsDevice;
            mSpriteBatch    = new SpriteBatch(deviceManager.GraphicsDevice);

            // Load font
            var font       = contentManager.Load <SpriteFont>("Font");
            var headerFont = contentManager.Load <SpriteFont>("Heading");

            IsVisible = true;

            // Load background image
            mBackgroundImage = contentManager.Load <Texture2D>("Forest");

            mMenuList = new List <UIv2.Menu>();
            var menu = new UIv2.Menu(mGraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice, 50, 30, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);
            mMenuList.Add(menu);

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

            // GAME OVER Text
            var heading = new UIv2.Components.Label(mGraphicsDevice, 10, 20, 80, 30, "GAME OVER", headerFont, Color.DarkSlateGray);

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

            var loseString = "The lumberjacks won... Now go bury yourself!";
            var loseLabel  = new UIv2.Components.Label(mGraphicsDevice, 20, 60, 60, 10, loseString, font, Color.White);

            loseLabel.AddTo(menu);

            var repeatButton = new UIv2.Components.Button(mGraphicsDevice, 40, 70, 20, 7, texture2D, "Try again", font, Color.White);

            repeatButton.AddTo(menu);
            repeatButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                var levelString = mHudScreen.mGameScreen.mLevel.mLevelFilename;
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
                IsVisible         = false;
                var loadingScreen = new LoadingScreen(levelString);
                ScreenManager.Add(loadingScreen);
            });

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

            backButton.AddTo(menu);
            backButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
                IsVisible = false;
            });
        }
Exemple #4
0
        public void LoadContent(GraphicsDeviceManager deviceManager,
                                ContentManager contentManager,
                                int windowWidth,
                                int windowHeight)
        {
            var currentDirectoryPath = Directory.GetCurrentDirectory();

            Directory.SetCurrentDirectory("../../../../Content");

            var graphicsDevice = deviceManager.GraphicsDevice;

            // Create a new content manager so we can unload all its content later
            mContentManager = new ContentManager(contentManager.ServiceProvider, contentManager.RootDirectory);


            mSpriteBatch = new SpriteBatch(graphicsDevice);

            var font        = mContentManager.Load <SpriteFont>("Font");
            var modelLoader = new ModelLoader(graphicsDevice);

            var texture2D = UIv2.Menu.CreateTexture2D(graphicsDevice,
                                                      50,
                                                      30,
                                                      pixel => Color.Black);

            mMenu = new UIv2.Menu(graphicsDevice, 0, 0, 100, 4);
            mMenu.NonSolid();
            mLabel = new UIv2.Components.Label(graphicsDevice, 0, 0, 25, 100, "", font, Color.Orange);
            mLabel.AddTo(mMenu);

            var backButton = new UIv2.Components.Button(graphicsDevice, 90, 0, 10, 100, texture2D, "Back", font, Color.White);

            backButton.AddTo(mMenu);

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

            mRenderTarget = new RenderTarget(graphicsDevice,
                                             Options.ResolutionWidth,
                                             Options.ResolutionHeight,
                                             1);
            mMasterRenderer = new MasterRenderer(graphicsDevice, mContentManager)
            {
                DebugMode = false
            };

            mCamera = new Camera(farPlane: Options.ViewingDistance,
                                 nearPlane: 0.5f,
                                 thirdPerson: true,
                                 location: new Vector3(0.0f, 0.0f, -110.0f));
            mCameraHandler = new CameraHandler(mCamera, 4.0f, 2.0f, .3f);

            mScene = new Scene();

            var staticObjectsRectangles = new List <CollisionRectangle>();

            mScene.mQuadTree = new QuadTree <Actor>(new Rectangle(-128, -128, 256, 256), 4, 10);

            mScene.mTerrain = new Terrain(mContentManager,
                                          graphicsDevice,
                                          "Terrain/level1 heightmap.png",
                                          "Terrain/techdemoTexture.png");
            mScene.Add(mScene.mTerrain);

            var obstacleMesh = modelLoader.LoadMesh("Mesh/beerbottle2.obj");

            var random = new Random();

            for (var i = 0; i < ObstacleCount; i++)
            {
                var x = (2.0f * (float)random.NextDouble() - 1.0f) * ObstacleRadius;
                var z = (2.0f * (float)random.NextDouble() - 1.0f) * ObstacleRadius;

                var vector = new Vector3(x, 0.0f, z) + new Vector3(20.0f, 0.0f, -100.0f);

                vector.Y = mScene.mTerrain.GetHeight(vector);

                var actor = new Actor(obstacleMesh)
                {
                    ModelMatrix = Matrix.CreateTranslation(vector)
                };

                mScene.Add(actor);
                mScene.mQuadTree.Insert(actor, actor.mBoundingRectangle.GetAxisAlignedRectangle(1));
                staticObjectsRectangles.Add(actor.mBoundingRectangle);
            }

            mScene.mVisibilityGraph = new Pathfinding.VisibilityGraph(staticObjectsRectangles, new Rectangle(-128, -128, 256, 256), 0.0f, false);

            var hutMesh = modelLoader.LoadMesh("Mesh/spawningcabin_scaled 0.015.fbx");

            var lumberjackMesh = modelLoader.LoadMesh("Mesh/lumberjack_minimal_noanimation.obj");

            var doubleAxeKillerMesh = modelLoader.LoadMesh("Mesh/lumberjack_distance_idle.fbx");

            modelLoader.LoadAnimation(doubleAxeKillerMesh, "Mesh/lumberjack_distance_walk.fbx");
            modelLoader.LoadAnimation(doubleAxeKillerMesh, "Mesh/lumberjack_distance_hit.fbx");
            modelLoader.LoadAnimation(doubleAxeKillerMesh, "Mesh/lumberjack_distance_run.fbx");

            var axeMesh = modelLoader.LoadMesh("Mesh/axe.fbx");

            var silverbackMesh = modelLoader.LoadMesh("Mesh/gorilla_idle.fbx");

            modelLoader.LoadAnimation(silverbackMesh, "Mesh/gorilla_walking.fbx");
            modelLoader.LoadAnimation(silverbackMesh, "Mesh/gorilla_smash.fbx");

            var capuchinMesh = modelLoader.LoadMesh("Mesh/kapuziner_idle.fbx");

            modelLoader.LoadAnimation(capuchinMesh, "Mesh/kapuziner_walk.fbx");
            modelLoader.LoadAnimation(capuchinMesh, "Mesh/kapuziner_heal.fbx");

            mSilverback = new Silverback(new Vector3(0.0f, 0.0f, -110.0f), new Vector2(0.0f), silverbackMesh);
            mScene.Add(mSilverback);

            var otherSilverback = new Silverback(new Vector3(0.0f, 0.0f, -110.0f), new Vector2(0.0f), silverbackMesh);

            mSubApe = new Capuchin(capuchinMesh, mScene.mTerrain, otherSilverback, mScene, ref random);
            mScene.Add(mSubApe);

            var hut = new Hut(hutMesh, lumberjackMesh, doubleAxeKillerMesh, axeMesh, mSilverback, mScene, 1000, 100.0f, 110.0f, true);

            mScene.Add(hut);

            mScene.mPostProcessing.mBloom.Activated = false;
            mScene.mPostProcessing.mFxaa.Activated  = false;
            mScene.mSky.Light.mShadow.mActivated    = false;

            mCamera.UpdatePerspective();

            Directory.SetCurrentDirectory(currentDirectoryPath);
        }
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

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

            SoundManager.AddMusic(mMainMenuMusic);

            // We should remove this for a more stable framerate later
            deviceManager.SynchronizeWithVerticalRetrace = false;
            deviceManager.ApplyChanges();

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

            IsVisible = true;

            mGraphicsDevice = deviceManager.GraphicsDevice;

            mSpriteBatch = new SpriteBatch(deviceManager.GraphicsDevice);

            // Load font
            var font          = contentManager.Load <SpriteFont>("Font");
            var headerFont    = contentManager.Load <SpriteFont>("Heading");
            var buttonTexture = contentManager.Load <Texture2D>("button");

            IsVisible = true;

            // Load background image
            mBackgroundImage = contentManager.Load <Texture2D>("Forest");

            IsVisible = true;

            mOptionsScreen      = new OptionsMenu(false);
            mStatisticsScreen   = new StatisticsScreen();
            mCreditsScreen      = new CreditsScreen();
            mEditorHudScreen    = new EditorHudScreen();
            mAchievementsScreen = new AchievementsScreen();
            mScreamScreen       = new ScreamScreen();

            var menu = new UIv2.Menu(mGraphicsDevice, 0, 0, 100, 100);

            mMenuList.Add(menu);

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

            var heading = new UIv2.Components.Label(mGraphicsDevice, 10, 0, 80, 30, "Silverback", headerFont, Color.DarkSlateGray);

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

            var newGameButton = new UIv2.Components.Button(mGraphicsDevice, 35, 24, 30, 7, texture2D, "New Game", font, Color.White);

            newGameButton.AddTo(menu);
            newGameButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                Statistic.CurrentSaveTime = 0;
                var loadingScreen         = new LoadingScreen("..\\..\\..\\..\\Content\\tutorial.lvl");
                ScreenManager.Add(loadingScreen);
                IsVisible = false;
            });

            var loadGameButton = new UIv2.Components.Button(mGraphicsDevice, 35, 32, 30, 7, texture2D, "Load Game", font, Color.White);

            loadGameButton.AddTo(menu);
            // Add an event listener to the button
            loadGameButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);

                if (!File.Exists(PauseScreen.GetSavedGamesPath() + "\\Camera.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\CapuchinPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\ChimpPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\GibbonPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\HudScreen.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Huts.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Level.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\OrangPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Silverback.xml"))
                {
                    return;
                }

                // Get the level file

                using (var fs = File.OpenRead(PauseScreen.GetSavedGamesPath() + "\\HudScreen.xml"))
                {
                    var serializer      = new XmlSerializer(typeof(HudScreen));
                    HudScreen hudScreen = null;
                    try
                    {
                        hudScreen = (HudScreen)serializer.Deserialize(fs);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.GetBaseException());
                    }

                    if (hudScreen != null)
                    {
                        var loadingScreen = new LoadingScreen(hudScreen.mLevelPath);
                        loadingScreen.LoadSaveGame();
                        ScreenManager.Add(loadingScreen);
                    }

                    IsVisible = false;
                }
            });

            // Create Statistic button
            var statisticsButton = new UIv2.Components.Button(mGraphicsDevice, 35, 40, 30, 7, texture2D, "Statistics", font, Color.White);

            statisticsButton.AddTo(menu);
            // Add an event listener to the button
            statisticsButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mStatisticsScreen);
                IsVisible = false;
            });

            // Create Achievements button
            var achievementsButton = new UIv2.Components.Button(mGraphicsDevice, 35, 48, 30, 7, texture2D, "Achievements", font, Color.White);

            achievementsButton.AddTo(menu);
            // Add an event listener to the button
            achievementsButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mAchievementsScreen);
                IsVisible = false;
            });

            // Create Credits button
            var creditsButton = new UIv2.Components.Button(mGraphicsDevice, 35, 56, 30, 7, texture2D, "Credits", font, Color.White);

            creditsButton.AddTo(menu);
            // Add an event listener to the button
            creditsButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                // ScreenManager.Add(mScreamScreen);
                ScreenManager.Add(mCreditsScreen);
                IsVisible = false;
            });

            // Create Option button
            var optionsButton = new UIv2.Components.Button(mGraphicsDevice, 35, 64, 30, 7, texture2D, "Options", font, Color.White);

            optionsButton.AddTo(menu);
            // Add an event listener to the button
            optionsButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mOptionsScreen);
                IsVisible = false;
            });

            var editorButton = new UIv2.Components.Button(mGraphicsDevice, 35, 72, 30, 7, texture2D, "Editor", font, Color.White);

            editorButton.AddTo(menu);
            editorButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mEditorHudScreen);
                IsVisible = false;
            });

            var exitButton = new UIv2.Components.Button(mGraphicsDevice, 35, 80, 30, 7, texture2D, "Exit", font, Color.White);

            exitButton.AddTo(menu);
            exitButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
            });
        }
Exemple #6
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;

            Achievements.TributeToTheCreators = true;

            //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 backround Image
            mBackgroundImageCredits = contentManager.Load <Texture2D>("forest");
            IsVisible = true;

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

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

            // Instantiate a new menu
            var menu = new UIv2.Menu(mGraphicsDevice, 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);

            mMenuList.Add(menu);

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

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

            var scrollListRowCount = 3;

            var rowHeight = 3;
            var rowSpace  = 4;

            var labelWidth = 40;

            var labelX = 5;

            /*
             * var tt = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "The Team", font, Color.White);
             * tt.AddTo(menu);
             *
             * var jb = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Josephine Bergmeier", font, Color.White);
             * jb.AddTo(menu);
             *
             * var df = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Domenico Frei", font, Color.White);
             * df.AddTo(menu);
             *
             * var bf = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Benjamin Fuchs", font, Color.White);
             * bf.AddTo(menu);
             *
             * var sg = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Steven Gilgin", font, Color.White);
             * sg.AddTo(menu);
             *
             * var mk = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Mario Kantz", font, Color.White);
             * mk.AddTo(menu);
             *
             * var dl = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "David Leimroth", font, Color.White);
             * dl.AddTo(menu);
             *
             * var mr = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Maximilian Roth", font, Color.White);
             * mr.AddTo(menu);
             *
             * var st = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Simon Tippe", font, Color.White);
             * st.AddTo(menu);
             *
             * var sr = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Tutor: Samuel Roth", font, Color.White);
             * sr.AddTo(menu);
             *
             * var noMonkeys = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "No monkeys were harmed during the creation of the game...", font, Color.White);
             * noMonkeys.AddTo(menu);
             *
             * var wellSome = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "well, some students suffered but that's probably okay. :-)", font, Color.White);
             * wellSome.AddTo(menu);
             *
             * var nowGo = new UIv2.Components.Label(mGraphicsDevice, labelX, scrollListRowCount++ * rowSpace, labelWidth, rowHeight, "Now go out and hug a tree!", font, Color.White);
             * nowGo.AddTo(menu);
             */

            // Credits: Team + Tutor
            var teamString = "The Team:\nJosephine Bergmeier\nDomenico Frei\nBenjamin Fuchs\nSteven Gilgin\nMario Kantz" +
                             "\nDavid Leimroth\nMaximilian Roth\nSimon Tippe\nTutor: Samuel Roth\n\n" +
                             "No monkeys were harmed during the creation of the game...\n" +
                             "well, some students suffered but that's probably okay.\n\n" +
                             "Now go out and hug a tree!";

            var teamLabel = new UIv2.Components.Label(mGraphicsDevice, 35, 40, 30, 15, teamString, font, Color.White);

            teamLabel.DisableAutobreak();
            teamLabel.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;
            });
        }
        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();
        }
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

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

            Device       = deviceManager.GraphicsDevice;
            mSpriteBatch = new SpriteBatch(deviceManager.GraphicsDevice);

            mOptionsScreen = new OptionsMenu(true);

            // Unlock the framerate. Later we want to remove this piece of code
            mGraphicsDevice = deviceManager.GraphicsDevice;
            mSpriteBatch    = new SpriteBatch(deviceManager.GraphicsDevice);

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

            IsVisible = true;

            // Load background image
            mBackgroundImageOptions = contentManager.Load <Texture2D>("forest");

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

            var menu = new UIv2.Menu(mGraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice, 50, 30, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);
            mMenuList.Add(menu);

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

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

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

            // Create new Resume Button

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

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

            // Create new Save Button
            var saveButton = new UIv2.Components.Button(mGraphicsDevice, 40, 30, 20, 7, texture2D, "Save Game", font, Color.White);

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

                var serializer = new XmlSerializer(typeof(Camera));

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Camera to " + GetSavedGamesPath() + "\\Camera.xml");
                Console.WriteLine("########################################################");


                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\Camera.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    serializer.Serialize(stream, mHudScreen.mGameScreen.mCamera);
                    stream.Close();
                }

                serializer = new XmlSerializer(typeof(Level));

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\Level.xml");
                Console.WriteLine("########################################################");



                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\Level.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    serializer.Serialize(stream, mHudScreen.mGameScreen.mLevel);
                    stream.Close();
                }

                serializer = new XmlSerializer(typeof(HudScreen));

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\HudScreen.xml");
                Console.WriteLine("########################################################");



                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\HudScreen.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    serializer.Serialize(stream, mHudScreen);
                    stream.Close();
                }

                serializer = new XmlSerializer(typeof(Silverback));

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\Silverback.xml");
                Console.WriteLine("########################################################");

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\Silverback.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    serializer.Serialize(stream, mHudScreen.mGameScreen.mLevel.mSilverback);
                    stream.Close();
                }


                serializer = new XmlSerializer(typeof(List <Matrix>));

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\CapuchinPositions.xml");
                Console.WriteLine("########################################################");

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\CapuchinPositions.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    var toSerialize = new List <Matrix>();
                    mHudScreen.mGameScreen.mLevel.mCapuchinBatch.mActors.ForEach(actor => toSerialize.Add(actor.mModelMatrix));
                    serializer.Serialize(stream, toSerialize);
                    stream.Close();
                }

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\GibbonPositions.xml");
                Console.WriteLine("########################################################");

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\GibbonPositions.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    var toSerialize = new List <Matrix>();
                    mHudScreen.mGameScreen.mLevel.mGibbonBatch.mActors.ForEach(actor => toSerialize.Add(actor.mModelMatrix));
                    serializer.Serialize(stream, toSerialize);
                    stream.Close();
                }

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\OrangPositions.xml");
                Console.WriteLine("########################################################");

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\OrangPositions.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    var toSerialize = new List <Matrix>();
                    mHudScreen.mGameScreen.mLevel.mOrangutanBatch.mActors.ForEach(actor => toSerialize.Add(actor.mModelMatrix));
                    serializer.Serialize(stream, toSerialize);
                    stream.Close();
                }

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\ChimpPositions.xml");
                Console.WriteLine("########################################################");

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\ChimpPositions.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    var toSerialize = new List <Matrix>();
                    mHudScreen.mGameScreen.mLevel.mChimpanezzeBatch.mActors.ForEach(actor => toSerialize.Add(actor.mModelMatrix));
                    serializer.Serialize(stream, toSerialize);
                    stream.Close();
                }

                Console.WriteLine("########################################################");
                Console.WriteLine("Saving Level to " + GetSavedGamesPath() + "\\Huts.xml");
                Console.WriteLine("########################################################");

                serializer = new XmlSerializer(typeof(List <Hut>));

                using (Stream stream = new FileStream(GetSavedGamesPath() + "\\Huts.xml", FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    var toSerialize   = new List <Hut>();
                    var hutActorBatch = mHudScreen.mGameScreen.mLevel.mActorBatches.Find(ele =>
                                                                                         ele.mMesh == mHudScreen.mGameScreen.mLevel.mHutMesh);
                    mHudScreen.mGameScreen.mLevel.mHuts.ForEach(hut => toSerialize.Add(hut));
                    serializer.Serialize(stream, toSerialize);
                    stream.Close();
                }
            });

            // Error label | Savegame
            var errLabel = new UIv2.Components.Label(mGraphicsDevice, 10, 90, 80, 4, "Could not load the savegame", font, Color.White);

            errLabel.FontType = FontManager.FontType.Default;
            errLabel.SetVisibility(false);
            errLabel.AddTo(menu);

            // Create new Load Game Button
            var loadButton = new UIv2.Components.Button(mGraphicsDevice, 40, 40, 20, 7, texture2D, "Load Checkpoint", font, Color.White);

            loadButton.AddTo(menu);
            loadButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                if (!File.Exists(PauseScreen.GetSavedGamesPath() + "\\Camera.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\CapuchinPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\ChimpPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\GibbonPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\HudScreen.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Huts.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Level.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\OrangPositions.xml") ||
                    !File.Exists(PauseScreen.GetSavedGamesPath() + "\\Silverback.xml"))
                {
                    errLabel.SetVisibility(true);
                    return;
                }
                errLabel.SetVisibility(false);
                ScreenManager.Remove(this);
                ScreenManager.Remove(mHudScreen.mGameScreen);
                ScreenManager.Remove(mHudScreen);

                var loadingScreen = new LoadingScreen(mHudScreen.mLevelPath);
                loadingScreen.LoadSaveGame();
                ScreenManager.Add(loadingScreen);
            });

            // Create new Options Button
            var optionsButton = new UIv2.Components.Button(mGraphicsDevice, 40, 50, 20, 7, texture2D, "Options", font, Color.White);

            optionsButton.AddTo(menu);
            optionsButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mOptionsScreen);
                IsVisible = false;
            });

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

            backButton.AddTo(menu);
            backButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(mHudScreen);
                ScreenManager.Remove(this);
                IsVisible = false;
            });
        }
        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;

            mPauseScreen = new PauseScreen(this);

            mWinScreen  = new WinScreen(this);
            mLoseScreen = new LoseScreen(this);

            mGameScreen = new GameScreen(mLevelPath);
            ScreenManager.Add(mGameScreen);
            mTotalCunter = mGameScreen.mLevel.mSpawnablePrimatesCount;

            mSpriteBatch = new SpriteBatch(mGraphicsDevice);

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

            IsVisible = true;

            // Instantiate a new menu
            mMenuList = new List <UIv2.Menu>();

            mButtonTexture = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.Black);
            var textureTransparent = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 10, 10, pixel => Color.Transparent);

            //Highlighted Button
            mHighlightedButtonTexture = UIv2.Menu.CreateTexture2D(mGraphicsDevice, 200, 30, pixel => Color.Orange);

            var menu = new UIv2.Menu(mGraphicsDevice, 0, 95, 100, 5);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice,
                                                          windowWidth,
                                                          200,
                                                          pixel => new Color(0.0f, 0.0f, 0.0f, 0.15f)),
                                0,
                                0,
                                100,
                                100);
            mMenuList.Add(menu);

            mCounterMenu = new UIv2.Menu(mGraphicsDevice, 40, 15, 20, 4);
            mCounterMenu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice,
                                                                  windowWidth,
                                                                  200,
                                                                  pixel => new Color(0.0f, 0.0f, 0.0f, 0.15f)),
                                        0,
                                        0,
                                        100,
                                        100);
            mCounterMenu.NonSolid();
            mMenuList.Add(mCounterMenu);

            var counterLabel = new UIv2.Components.Label(mGraphicsDevice, 0, 0, 100, 100, "Available apes to spawn: " + mGameScreen.mLevel.mSpawnablePrimatesCount, font, Color.White);

            counterLabel.AddTo(mCounterMenu);

            var pauseButton =
                new UIv2.Components.Button(mGraphicsDevice, 90, 0, 7, 100, mButtonTexture, "Pause", font, Color.White);

            pauseButton.AddTo(menu);
            pauseButton.AddListener(MouseButtons.Left,
                                    InputState.Pressed,
                                    () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Add(mPauseScreen);
                mGameScreen.mCameraHandler.Lock();
                IsVisible             = false;
                mWasVisible           = false;
                mGameScreen.IsVisible = false;
            });

            mHPLabel = new UIv2.Components.Label(mGraphicsDevice,
                                                 0,
                                                 0,
                                                 45,
                                                 100,
                                                 "HP: ",
                                                 font,
                                                 Color.White);
            mHPLabel.AddTo(menu);

            mTimeLabel = new UIv2.Components.Label(mGraphicsDevice,
                                                   0,
                                                   0,
                                                   10,
                                                   100,
                                                   "",
                                                   font,
                                                   Color.White);
            mTimeLabel.AddTo(menu);

            var levelLabel = new UIv2.Components.Label(mGraphicsDevice,
                                                       10,
                                                       0,
                                                       7,
                                                       100,
                                                       "Level: Tutorial",
                                                       font,
                                                       Color.White);

            levelLabel.AddTo(menu);
            for (var i = 0; i < 0; i++)
            {
                var morang = new OrangUtan(mGameScreen.mLevel.mOrangUtanMesh,
                                           mGameScreen.mLevel.mTerrain,
                                           mGameScreen.mLevel.mSilverback,
                                           mGameScreen.mLevel,
                                           ref mRandom);
                //morang.mScene = mGameScreen.mLevel;
                mGameScreen.mLevel.Add(morang);
            }

            // Create selection button for Baboon
            mApe1Button =
                new UIv2.Components.Button(mGraphicsDevice, 30, 0, 7, 100, mButtonTexture, "Orang", font, Color.White);
            mApe1Button.AddTo(menu);
            mApe1Button.AddListener(MouseButtons.Left,
                                    InputState.Pressed,
                                    () =>
            {
                SoundManager.AddSound(mClickSound);

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    if (mGameScreen.mLevel.mOrangutanBatch.mActors.Count > 0)
                    {
                        UnHiglightSelectedActorBatch();
                        mActorBatch      = mGameScreen.mLevel.mOrangutanBatch;
                        mHighlitedButton = mApe1Button;
                        HighlightSelectedActorBatch();
                    }
                }
                else if (mGameScreen.mLevel.mSpawnablePrimatesCount > 0)
                {
                    mGameScreen.mLevel.mSpawnablePrimatesCount--;
                    mOrangCounter++;
                    counterLabel.Text = "Available apes to spawn: " + mGameScreen.mLevel.mSpawnablePrimatesCount;

                    var morang = new OrangUtan(mGameScreen.mLevel.mOrangUtanMesh,
                                               mGameScreen.mLevel.mTerrain,
                                               mGameScreen.mLevel.mSilverback,
                                               mGameScreen.mLevel,
                                               ref mRandom);
                    //morang.mScene = mGameScreen.mLevel;
                    mGameScreen.mLevel.Add(morang);
                    LumberChoice.AddApe(2);
                }

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    mCounterMenu.mIsVisible = false;
                    DisableUnusedApeSelectorButtons();
                }
            });

            // Create selection button for Capuchin
            mApe2Button = new UIv2.Components.Button(mGraphicsDevice,
                                                     41,
                                                     0,
                                                     7,
                                                     100,
                                                     mButtonTexture,
                                                     "Capuchin",
                                                     font,
                                                     Color.White);
            mApe2Button.AddTo(menu);
            mApe2Button.AddListener(MouseButtons.Left,
                                    InputState.Pressed,
                                    () =>
            {
                SoundManager.AddSound(mClickSound);

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    if (mGameScreen.mLevel.mCapuchinBatch.mActors.Count > 0)
                    {
                        UnHiglightSelectedActorBatch();
                        mActorBatch      = mGameScreen.mLevel.mCapuchinBatch;
                        mHighlitedButton = mApe2Button;
                        HighlightSelectedActorBatch();
                    }
                }
                else if (mGameScreen.mLevel.mSpawnablePrimatesCount > 0)
                {
                    mCapuchinCounter++;
                    counterLabel.Text = "Available apes to spawn: " + mGameScreen.mLevel.mSpawnablePrimatesCount;
                    mGameScreen.mLevel.mSpawnablePrimatesCount--;
                    var mcapuchin = new Capuchin(mGameScreen.mLevel.mCapuchinMesh,
                                                 mGameScreen.mLevel.mTerrain,
                                                 mGameScreen.mLevel.mSilverback,
                                                 mGameScreen.mLevel,
                                                 ref mRandom);
                    mGameScreen.mLevel.Add(mcapuchin);
                    LumberChoice.AddApe(3);
                }

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    mCounterMenu.mIsVisible = false;
                    DisableUnusedApeSelectorButtons();
                }
            });

            // Create selection button for Chimpaneeze
            mApe3Button =
                new UIv2.Components.Button(mGraphicsDevice, 52, 0, 7, 100, mButtonTexture, "Chimp", font, Color.White);
            mApe3Button.AddTo(menu);

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

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    if (mGameScreen.mLevel.mChimpanezzeBatch.mActors.Count > 0)
                    {
                        UnHiglightSelectedActorBatch();
                        mActorBatch      = mGameScreen.mLevel.mChimpanezzeBatch;
                        mHighlitedButton = mApe3Button;
                        HighlightSelectedActorBatch();
                    }
                }
                else if (mGameScreen.mLevel.mSpawnablePrimatesCount > 0)
                {
                    mChimpCounter++;
                    mGameScreen.mLevel.mSpawnablePrimatesCount--;
                    counterLabel.Text = "Available apes to spawn: " + mGameScreen.mLevel.mSpawnablePrimatesCount;
                    var mchimpanezee  = new Chimpanezee(mGameScreen.mLevel.mChimpanezzeMesh,
                                                        mGameScreen.mLevel.mTerrain,
                                                        mGameScreen.mLevel.mSilverback,
                                                        mGameScreen.mLevel,
                                                        ref mRandom);
                    mGameScreen.mLevel.Add(mchimpanezee);
                    LumberChoice.AddApe(1);
                }

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    mCounterMenu.mIsVisible = false;
                    DisableUnusedApeSelectorButtons();
                }
            }
                                    );

            // Create selection button for Gibbon
            mApe4Button =
                new UIv2.Components.Button(mGraphicsDevice, 63, 0, 7, 100, mButtonTexture, "Gibbon", font, Color.White);
            mApe4Button.AddTo(menu);
            mApe4Button.AddListener(MouseButtons.Left,
                                    InputState.Pressed,
                                    () =>
            {
                SoundManager.AddSound(mClickSound);

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    if (mGameScreen.mLevel.mGibbonBatch.mActors.Count > 0)
                    {
                        UnHiglightSelectedActorBatch();
                        mActorBatch      = mGameScreen.mLevel.mGibbonBatch;
                        mHighlitedButton = mApe4Button;
                        HighlightSelectedActorBatch();
                    }
                }
                else if (mGameScreen.mLevel.mSpawnablePrimatesCount > 0)
                {
                    mGibbonCounter++;
                    mGameScreen.mLevel.mSpawnablePrimatesCount--;
                    counterLabel.Text = "Available apes to spawn: " + mGameScreen.mLevel.mSpawnablePrimatesCount;

                    var mgibbon = new Gibbon(mGameScreen.mLevel.mGibbonMesh,
                                             mGameScreen.mLevel.mTerrain,
                                             mGameScreen.mLevel.mSilverback,
                                             mGameScreen.mLevel,
                                             ref mRandom);
                    mGameScreen.mLevel.Add(mgibbon);
                    LumberChoice.AddApe(4);
                }

                if (mGameScreen.mLevel.mSpawnablePrimatesCount == 0)
                {
                    mCounterMenu.mIsVisible = false;
                    DisableUnusedApeSelectorButtons();
                }
            });

            // Display the level text before the level starts
            if (mGameScreen.mLevel.mLevelStory != null)
            {
                mGameScreen.mCameraHandler.Lock();
                var textMenu = new UIv2.Menu(mGraphicsDevice, 5, 5, 90, 90);
                textMenu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice, 50, 30, pixel => new Color(0.0f, 0.0f, 0.0f, 0.15f)), 5, 5, 90, 90);
                var heading = new UIv2.Components.Label(mGraphicsDevice, 5, 5, 90, 15, mGameScreen.mLevel.mLevelTitle, subHeaderFont, Color.DarkSlateGray);
                heading.FontType = FontManager.FontType.Subheading;
                heading.AddTo(textMenu);
                var textLabel = new UIv2.Components.Label(mGraphicsDevice, 25, 28, 50, 35, mGameScreen.mLevel.mLevelStory, font, Color.White);
                textLabel.DisableAutobreak();
                textLabel.AddTo(textMenu);
                mContinueLabel = new UIv2.Components.Label(mGraphicsDevice, 25, 80, 50, 10, "Press the left mouse button to continue", font, Color.White);
                mContinueLabel.AddTo(textMenu);
                var textButton = new UIv2.Components.Button(mGraphicsDevice, 0, 0, 100, 100, textureTransparent, "", font, Color.White);
                textButton.AddTo(textMenu);
                textButton.AddListener(MouseButtons.Left,
                                       InputState.Pressed,
                                       () =>
                {
                    menu.mIsVisible         = true;
                    mCounterMenu.mIsVisible = true;
                    textMenu.mIsVisible     = false;
                    mGameScreen.mCameraHandler.Unlock();
                });
                mMenuList.Add(textMenu);
                menu.mIsVisible         = false;
                mCounterMenu.mIsVisible = false;
            }

            mMenuList.Add(menu);
        }
Exemple #11
0
        public void LoadContent(GraphicsDeviceManager deviceManager, ContentManager contentManager, int windowWidth, int windowHeight)
        {
            mScreenWidth  = windowWidth;
            mScreenHeight = windowHeight;

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

            Device       = deviceManager.GraphicsDevice;
            mSpriteBatch = new SpriteBatch(deviceManager.GraphicsDevice);

            // Unlock the framerate. Later we want to remove this piece of code
            mGraphicsDevice = deviceManager.GraphicsDevice;
            mSpriteBatch    = new SpriteBatch(deviceManager.GraphicsDevice);

            // Load font
            var font       = contentManager.Load <SpriteFont>("Font");
            var headerFont = contentManager.Load <SpriteFont>("Heading");

            IsVisible = true;

            // Load background image
            mBackgroundImage = contentManager.Load <Texture2D>("Forest");

            mMenuList = new List <UIv2.Menu>();
            var menu = new UIv2.Menu(mGraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice, 50, 30, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);
            mMenuList.Add(menu);

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

            // Congratulations!
            var congratz = new UIv2.Components.Label(mGraphicsDevice, 10, 0, 80, 30, "Congratulations!", headerFont, Color.DarkSlateGray);

            congratz.FontType = FontManager.FontType.Heading;
            congratz.AddTo(menu);

            // You've won
            var win = new UIv2.Components.Label(mGraphicsDevice, 10, 30, 80, 30, "You've won", headerFont, Color.DarkSlateGray);

            win.FontType = FontManager.FontType.Heading;
            win.AddTo(menu);

            var winString = "Nice work dude!";
            var winLabel  = new UIv2.Components.Label(mGraphicsDevice, 20, 60, 60, 10, winString, font, Color.White);

            winLabel.AddTo(menu);

            if (mHudScreen.mGameScreen.mLevel.mNextLevelFilename != "null")
            {
                var nextLevelButton = new UIv2.Components.Button(mGraphicsDevice, 40, 70, 20, 7, texture2D, "Next level", font, Color.White);
                nextLevelButton.AddTo(menu);
                nextLevelButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
                {
                    var nextLevelFilename = mHudScreen.mGameScreen.mLevel.mNextLevelFilename;
                    // Check if path is relative
                    if (!Path.IsPathRooted(nextLevelFilename))
                    {
                        var levelFilename = mHudScreen.mGameScreen.mLevel.mLevelFilename;
                        var directoryPath = Path.GetDirectoryName(levelFilename);
                        nextLevelFilename = directoryPath + "/" + nextLevelFilename;
                    }
                    SoundManager.AddSound(mClickSound);
                    ScreenManager.Remove(this);
                    IsVisible         = false;
                    var loadingScreen = new LoadingScreen(nextLevelFilename);
                    ScreenManager.Add(loadingScreen);
                });
            }
            else
            {
                winLabel.Text += " You've finished the game.";
                if (Statistic.CurrentSaveTime < Statistic.MinimalTime || Statistic.MinimalTime == 0)
                {
                    Statistic.MinimalTime   = Statistic.CurrentSaveTime;
                    Achievements.Gamemaster = true;
                    if (Statistic.MinimalTime < 3600000)
                    {
                        Achievements.Speedrunner = true;
                    }
                }
            }

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

            backButton.AddTo(menu);
            backButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                SoundManager.AddSound(mClickSound);
                ScreenManager.Remove(this);
                IsVisible = false;
            });
        }
        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
            mGraphicsDevice = deviceManager.GraphicsDevice;
            mSpriteBatch    = new SpriteBatch(deviceManager.GraphicsDevice);

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

            IsVisible = true;

            // Load backround Image
            mBackgroundImageOptions = contentManager.Load <Texture2D>("forest");

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

            var menu = new UIv2.Menu(mGraphicsDevice, 5, 5, 90, 90);

            menu.WithBackground(UIv2.Menu.CreateTexture2D(deviceManager.GraphicsDevice, 50, 30, pixel => new Color(0.0f, 0.0f, 0.0f, 0.2f)), 5, 5, 90, 90);
            mMenuList.Add(menu);

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

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

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


            var resolutionLabel = new Label(mGraphicsDevice, 10, 20, 30, 3, "Resolution", font, Color.White);

            resolutionLabel.AddTo(menu);
            var resolutionValueBox = new Label(mGraphicsDevice, 60, 20, 20, 3, "", font, Color.White);

            resolutionValueBox.AddTo(menu);
            var resolutionSlider = new UIv2.Components.Slider(mGraphicsDevice, menu, 40, 20, 20, 3, texture2D, texture2DSliderPoint, 25, 200, Options.Resolution);


            // We want to allow the user to set the resolution to 25%.
            // Lets assume the user has a 4K monitor then we would allow
            // a resolution range of [1024x540-8192x4320]. The higher resolution
            // is for PCs which have a lot of hardware power and will be used for super sampling
            // which gives us really clean edges (no FXAA needed anymore)

            // You can manually set the slider value
            // The ui will be updated accordingly

            // Add one or more callbacks as arguments
            // The function(s) will be called, after the value changed
            resolutionSlider.AddOnChangeListeners((val) => {
                var value  = (int)Math.Round(val);
                var width  = (int)(mScreenWidth * (value / 100.0f));
                var height = (int)(mScreenHeight * (value / 100.0f));
                resolutionValueBox.Text = width + "x" + height + " pixel";
                ScreenManager.ChangeRenderingResolution(width, height);
                Options.Resolution = value;
            });

            var musicLabel = new Label(mGraphicsDevice, 10, 28, 30, 3, "Music Volume", font, Color.White);

            musicLabel.AddTo(menu);
            var musicValueBox = new Label(mGraphicsDevice, 60, 28, 20, 3, "", font, Color.White);

            musicValueBox.AddTo(menu);

            var musicSlider = new UIv2.Components.Slider(mGraphicsDevice, menu, 40, 28, 20, 3, texture2D, texture2DSliderPoint, 0, 100, Options.MusicVolume);

            musicSlider.AddOnChangeListeners((val) => {
                var value           = (int)Math.Round(val);
                Options.MusicVolume = value;
                musicValueBox.Text  = value + "%";
                //Soundmanager has to be set
                //SoundManager.ChangeVolume("Music", value / 100.0f);
            });


            var effectLabel = new Label(mGraphicsDevice, 10, 36, 30, 3, "Sound Effects Volume", font, Color.White);

            effectLabel.AddTo(menu);
            var effectValueBox = new Label(mGraphicsDevice, 60, 36, 20, 3, "", font, Color.White);

            effectValueBox.AddTo(menu);

            var effectSlider = new UIv2.Components.Slider(mGraphicsDevice, menu, 40, 36, 20, 3, texture2D, texture2DSliderPoint, 0, 100, Options.SoundEffectVolume);

            effectSlider.AddOnChangeListeners((val) => {
                var value = (int)Math.Round(val);
                Options.SoundEffectVolume = value;
                effectValueBox.Text       = value + "%";
            });

            /*
             * // TODO adding function of brightness
             * var brightnessLabel = new Label(mGraphicsDevice, 10, 44, 30, 3, "Brightness", font, Color.White);
             * brightnessLabel.AddTo(menu);
             * var brightnessValueBox = new Label(mGraphicsDevice, 60, 44, 20, 3, "", font, Color.White);
             * brightnessValueBox.AddTo(menu);
             *
             * var brightnessSlider = new UIv2.Components.Slider(mGraphicsDevice, menu, 40, 44, 20, 3, texture2D, texture2DSliderPoint, 0, 1, Options.Brightness);
             *
             * brightnessSlider.AddOnChangeListeners((val) => {
             *  var value = (int)Math.Round(val * 100); // here I'm unsure
             *  Options.Brightness = val;
             *  brightnessValueBox.Text = value + "%";
             * });
             */


            var fxaaLabel = new Label(mGraphicsDevice, 10, 44, 30, 3, "Antialiasing", font, Color.White);

            fxaaLabel.AddTo(menu);
            var fxaaButtonOn = new UIv2.Components.CheckedButton(mGraphicsDevice, 40, 44, 5, 5, texture2D, Checked, "On", font, Color.White, Options.Fxaa);

            fxaaButtonOn.AddTo(menu);
            var fxaaButtonOff = new UIv2.Components.CheckedButton(mGraphicsDevice, 46, 44, 5, 5, texture2D, Checked, "Off", font, Color.White, !Options.Fxaa);

            fxaaButtonOff.AddTo(menu);

            if (!mPauseScreen)
            {
                fxaaButtonOn.AddListener(MouseButtons.Left,
                                         InputState.Pressed,
                                         () =>
                {
                    SoundManager.AddSound(mClickSound);
                    fxaaButtonOn.Check();
                    fxaaButtonOff.Uncheck();
                    Options.Fxaa = true;
                });
                fxaaButtonOff.AddListener(MouseButtons.Left,
                                          InputState.Pressed,
                                          () =>
                {
                    SoundManager.AddSound(mClickSound);
                    fxaaButtonOff.Check();
                    fxaaButtonOn.Uncheck();
                    Options.Fxaa = false;
                });
            }

            var graphicsLabel = new Label(mGraphicsDevice, 10, 52, 30, 3, "Graphics Quality", font, Color.White);

            graphicsLabel.AddTo(menu);


            var graphicsVeryLowButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 40, 52, 8, 5, texture2D, Checked, "Very low", font, Color.White, Options.GraphicsQuality == 0);

            graphicsVeryLowButton.AddTo(menu);
            var graphicsLowButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 49, 52, 8, 5, texture2D, Checked, "Low", font, Color.White, Options.GraphicsQuality == 1);

            graphicsLowButton.AddTo(menu);
            var graphicsMediumButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 58, 52, 8, 5, texture2D, Checked, "Medium", font, Color.White, Options.GraphicsQuality == 2);

            graphicsMediumButton.AddTo(menu);
            var graphicsHighButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 67, 52, 8, 5, texture2D, Checked, "High", font, Color.White, Options.GraphicsQuality == 3);

            graphicsHighButton.AddTo(menu);
            var graphicsVeryHighButton = new UIv2.Components.CheckedButton(mGraphicsDevice, 76, 52, 8, 5, texture2D, Checked, "Very high", font, Color.White, Options.GraphicsQuality == 4);

            graphicsVeryHighButton.AddTo(menu);

            // We just want to use the handlers if this screen isn't initialized by the PauseScreen
            if (!mPauseScreen)
            {
                graphicsVeryLowButton.AddListener(MouseButtons.Left,
                                                  InputState.Pressed,
                                                  () =>
                {
                    SoundManager.AddSound(mClickSound);
                    graphicsVeryLowButton.Check();
                    graphicsLowButton.Uncheck();
                    graphicsMediumButton.Uncheck();
                    graphicsHighButton.Uncheck();
                    graphicsVeryHighButton.Uncheck();
                    Options.GraphicsQuality = 0;
                });

                graphicsLowButton.AddListener(MouseButtons.Left,
                                              InputState.Pressed,
                                              () =>
                {
                    SoundManager.AddSound(mClickSound);
                    graphicsVeryLowButton.Uncheck();
                    graphicsLowButton.Check();
                    graphicsMediumButton.Uncheck();
                    graphicsHighButton.Uncheck();
                    graphicsVeryHighButton.Uncheck();
                    Options.GraphicsQuality = 1;
                });

                graphicsMediumButton.AddListener(MouseButtons.Left,
                                                 InputState.Pressed,
                                                 () =>
                {
                    SoundManager.AddSound(mClickSound);
                    graphicsVeryLowButton.Uncheck();
                    graphicsLowButton.Uncheck();
                    graphicsMediumButton.Check();
                    graphicsHighButton.Uncheck();
                    graphicsVeryHighButton.Uncheck();
                    Options.GraphicsQuality = 2;
                });

                graphicsHighButton.AddListener(MouseButtons.Left,
                                               InputState.Pressed,
                                               () =>
                {
                    SoundManager.AddSound(mClickSound);
                    graphicsVeryLowButton.Uncheck();
                    graphicsLowButton.Uncheck();
                    graphicsMediumButton.Uncheck();
                    graphicsHighButton.Check();
                    graphicsVeryHighButton.Uncheck();
                    Options.GraphicsQuality = 3;
                });

                graphicsVeryHighButton.AddListener(MouseButtons.Left,
                                                   InputState.Pressed,
                                                   () =>
                {
                    SoundManager.AddSound(mClickSound);
                    graphicsVeryLowButton.Uncheck();
                    graphicsLowButton.Uncheck();
                    graphicsMediumButton.Uncheck();
                    graphicsHighButton.Uncheck();
                    graphicsVeryHighButton.Check();
                    Options.GraphicsQuality = 4;
                });
            }
            else
            {
                var graphicsInformationLabel = new Label(mGraphicsDevice,
                                                         20,
                                                         65,
                                                         60,
                                                         10,
                                                         "Graphics quality and Antialiasing can only be changed from the main menu",
                                                         font,
                                                         Color.Orange);
                graphicsInformationLabel.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;
            });
            var techDemoButton = new UIv2.Components.Button(mGraphicsDevice, 70, 80, 20, 7, texture2D, "Techdemo", font, Color.White);

            techDemoButton.AddTo(menu);
            techDemoButton.AddListener(MouseButtons.Left, InputState.Pressed, () =>
            {
                var techDemoScreen = new TechDemoScreen();
                ScreenManager.Add(techDemoScreen);
                IsVisible = false;
            });
        }