protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager Content = Game.Content;
            Color selectedColor = Color.Navy;

            int selectedWallpaper = new Random().Next(4);   // Choose between four backgrounds

            switch (selectedWallpaper)
            {
                case 0:   // This is the animation. Hence, the texture2d array
                    {
                        Texture2D[] images = new Texture2D[8];
                        for (int i = 0; i < 8; i++)
                        {
                            images[i] = Content.Load<Texture2D>("Backgrounds\\exploded_bg\\water" + i.ToString());
                        }
                        backGround = new Animation(images);
                        Background = backGround;
                        break;
                    }
                case 1:
                    {
                        Texture2D bg1 = Content.Load<Texture2D>("Backgrounds\\bamboo");
                        picBackGround = new PictureBox(bg1, new Rectangle(0, 0, ProjectData.GameWidth, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg1.Width, bg1.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }
                case 2:
                    {
                        Texture2D bg2 = Content.Load<Texture2D>("Backgrounds\\temple");
                        picBackGround = new PictureBox(bg2, new Rectangle(0, 0, ProjectData.GameWidth, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg2.Width, bg2.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }
                case 3:
                    {
                        Texture2D bg3 = Content.Load<Texture2D>("Backgrounds\\marketplace");
                        picBackGround = new PictureBox(bg3, new Rectangle(0, 0, bg3.Width, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg3.Width, bg3.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }

            }

            if (selectedWallpaper > 0)
                Background = picBackGround;

            Texture2D arrowTexture = Content.Load<Texture2D>("GUI\\leftarrowUp");
            arrowImage = new PictureBox(arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height));
            arrowImage.Effect = ControlEffect.FLASH;
            ControlManager.Add(arrowImage);

            title = new Label();
            title.SpriteFont = Content.Load<SpriteFont>("Fonts\\titleFont");
            title.Text = "O  R  I  G  I  N  S";
            title.Size = title.SpriteFont.MeasureString(title.Text);

            if (selectedWallpaper == 0)
                title.Color = Color.Black;

            title.Position = new Vector2(ProjectElements.Data.ProjectData.GameWidth / 2 -
                title.Size.X / 2, ProjectData.GameHeight / 8);
            ControlManager.Add(title);

            continueGame = new LinkLabel();
            continueGame.Enabled = (ProjectData.cachedSave != null);
            continueGame.Text = "Continue...";
            continueGame.Size = continueGame.SpriteFont.MeasureString(continueGame.Text);
            continueGame.Selected += new EventHandler(menuItem_Selected);

            if (!continueGame.Enabled)
                continueGame.Color = new Color(30, 30, 30);

            ControlManager.Add(continueGame);

            startGame = new LinkLabel();
            startGame.Text = "New Game";
            startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text);
            startGame.Selected += menuItem_Selected;
            ControlManager.Add(startGame);

            loadGame = new LinkLabel();
            loadGame.Enabled = SaveDataParser.SaveStates.Count > 0;
            loadGame.Text = "Load Game";
            loadGame.Size = loadGame.SpriteFont.MeasureString(loadGame.Text);
            loadGame.Selected += menuItem_Selected;

            if (!loadGame.Enabled)
                loadGame.Color = new Color(30, 30, 30);

            ControlManager.Add(loadGame);

            exitGame = new LinkLabel();
            exitGame.Text = "Quit";
            exitGame.Size = exitGame.SpriteFont.MeasureString(exitGame.Text);
            exitGame.Selected += menuItem_Selected;
            ControlManager.Add(exitGame);

            ControlManager.NextControl();

            ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged);
            Vector2 position = new Vector2(ProjectElements.Data.ProjectData.GameWidth / 2, ProjectData.GameHeight / 1.75f);

            foreach (Control c in ControlManager)
            {
                if (c is LinkLabel)
                {
                    Vector2 offset = new Vector2(c.Size.X / 2, 0);
                    if (c.Size.X > maxItemWidth)
                        maxItemWidth = c.Size.X;
                    c.Position = position - offset;
                    position.Y += c.Size.Y + 10f;
                    c.Effect = ControlEffect.GLOW;
                    c.FlashDuration = 300;

                    if (selectedWallpaper == 0)
                    {
                        c.Color = Color.Black;
                        ((LinkLabel)c).SelectedColor = selectedColor;
                    }
                }
            }

            if (continueGame.Enabled)
                ControlManager_FocusChanged(continueGame, null);
            else
                ControlManager_FocusChanged(startGame, null);
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            Texture2D arrowTexture = Game.Content.Load<Texture2D>("GUI\\leftarrowUp");
            arrowImage = new PictureBox(arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height));
            ControlManager.Add(arrowImage);

            lblRandom = new LinkLabel();
            lblRandom.Text = "RANDOMLY GENERATED MAP";
            ControlManager.Add(lblRandom);

            lblDungeon = new LinkLabel();
            lblDungeon.Text = "DUNGEON";
            ControlManager.Add(lblDungeon);

            lblTMX = new LinkLabel();
            lblTMX.Text = "TMX MAP";
            ControlManager.Add(lblTMX);

            Vector2 position = new Vector2(ProjectData.GameWidth / 2, ProjectData.GameHeight / 1.75f);

            foreach (Control l in ControlManager)
            {
                if (l is LinkLabel)
                {
                    l.Size = l.SpriteFont.MeasureString(l.Text);
                    Vector2 offset = new Vector2(l.Size.X / 2, 0);
                    if (l.Size.X > maxItemWidth)
                        maxItemWidth = l.Size.X;
                    l.Position = position - offset;
                    position.Y += l.Size.Y + 10f;
                    l.Effect = ControlEffect.GLOW;
                    l.Selected += new EventHandler(menuItem_Selected);
                }
            }

            //lblTMX.Color = Color.DarkGray;
            //lblTMX.Enabled = false;

            ControlManager.NextControl();
            ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged);
            ControlManager_FocusChanged(lblRandom, null);
        }
        public override void LargeLoadContent(object sender)
        {
            var Content = gameRef.Content;

            background = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(10, 10), Color.Black, true).Texture;

            levelManager = new LevelManager(gameRef);
            Camera.Initialize(Vector2.Zero, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT),
                new Vector2(LevelManager.CurrentLevel.WidthInPixels, LevelManager.CurrentLevel.HeightInPixels));
            Camera.MaxClamp -= new Vector2(Camera.View.Width / 2, Camera.View.Height / 2);

            entityManager = new EntityManager(gameRef);

            if (!loadedGame)
            {
                EntityManager.Player.Name = Config.currentlyPlaying;

                if (LevelManager.CurrentLevel.PlayerSpawnPoint.X > -1 &&
                    LevelManager.CurrentLevel.PlayerSpawnPoint.Y > -1)
                    EntityManager.Player.Position = new Vector2(LevelManager.CurrentLevel.PlayerSpawnPoint.X, LevelManager.CurrentLevel.PlayerSpawnPoint.Y) * Engine.TileWidth ;
            }
            else
            {
                Config.SetLastLogin(loadedProps.Name);
                Config.currentlyPlaying = loadedProps.Name;
                EntityManager.Player.LoadFromData(loadedProps);
            }

            new Pathfinder(LevelManager.CurrentLevel);

            #region Pause_Normal
            pauseControls_Normal = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));
            {
                Label lblPauseDisplay = new Label()
                {
                    Name = "lblPauseDisplay",
                    Text = "P A U S E D",
                    Color = Color.White
                };
                lblPauseDisplay.Position = new Vector2(MainGame.GAME_WIDTH / 2 - lblPauseDisplay.Width / 2,
                    MainGame.GAME_HEIGHT / 1.8f - lblPauseDisplay.Height - 10);

                var back = new LinkLabel(1) { Name = "lnklblBack", Text = "Resume" };
                var save = new LinkLabel(2) { Name = "lnklblSave", Text = "Save Game" };
                var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit to Menu" };

                pauseControls_Normal.Add(lblPauseDisplay);
                pauseControls_Normal.Add(back);
                pauseControls_Normal.Add(save);
                pauseControls_Normal.Add(quit);

                Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f);
                foreach (Control c in pauseControls_Normal)
                {
                    if (c is LinkLabel)
                    {
                        var l = (LinkLabel)c;
                        var offset = new Vector2(c.Width / 2, 0);
                        c.Position = startPos - offset;
                        c.Selected += new EventHandler(LinkLabel_Selected);
                        c.Effect = ControlEffect.PULSE;
                        c.Color = Color.Black;
                        l.OnMouseIn += LinkLabel_OnMouseIn;

                        startPos.Y += c.Height + 10f;
                    }
                }
            }
            #endregion

            #region Pause_Save
            pauseControls_Save = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));

            Label status = new Label();
            status.AutoSize = true;
            status.Text = "Save game success!";
            status.Position = new Vector2(MainGame.GAME_WIDTH / 2 - status.Width / 2, MainGame.GAME_HEIGHT / 2 - status.Height);
            pauseControls_Save.Add(status);

            LinkLabel goBack_Save = new LinkLabel(0);
            goBack_Save.AutoSize = true;
            goBack_Save.Text = "Go Back";
            goBack_Save.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Save.Width / 2, status.Position.Y + status.Height + 10);
            goBack_Save.Selected += (o, e) => { pauseState = State_Paused.Normal; };
            goBack_Save.OnMouseIn += LinkLabel_OnMouseIn;
            pauseControls_Save.Add(goBack_Save);
            #endregion

            #region Pause_Quit
            pauseControls_Quit = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));

            Label areYouSure1 = new Label();
            areYouSure1.Name = "lblAreYouSure?";
            areYouSure1.Text = "Are you sure you want to quit?";
            areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString(
                areYouSure1.Text).X / 2, 140);
            pauseControls_Quit.Add(areYouSure1);

            LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" };
            yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50);
            yes.OnMouseIn += LinkLabel_OnMouseIn;
            yes.Selected += (o, e) => { SwitchStateWithFade(new MainMenuState(gameRef, StateManager)); };
            yes.Effect = ControlEffect.PULSE;

            LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" };
            no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y);
            no.OnMouseIn += LinkLabel_OnMouseIn;
            no.Selected += (o, e) => { pauseState = State_Paused.Normal; };
            no.Effect = ControlEffect.PULSE;

            pauseControls_Quit.Add(yes);
            pauseControls_Quit.Add(no);
            #endregion

            blurOverlay = new GaussianBlur(gameRef);
            renderTargetWidth = MainGame.GAME_WIDTH;
            renderTargetHeight = MainGame.GAME_HEIGHT;
            blurOverlay.ComputeKernel(7, 2.0f);

            mainTarget = new RenderTarget2D(gameRef.GraphicsDevice, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT);
            target1 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false,
                gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
            target2 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false,
                gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);

            blurOverlay.ComputeOffsets(renderTargetWidth, renderTargetHeight);

            quests = new QuestManager();

            Quest q = new Quest(0, (QuestGiver)EntityManager.Npcs[0], EntityManager.Player);
            q.CheckSuccess += (delegate()
            {
                return EntityManager.Player.NoClip == true;
            });
            quests.AddQuest(q);

            ((QuestGiver)EntityManager.Npcs[0]).Quest = q;
            ((QuestGiver)EntityManager.Npcs[0]).OnQuestCompleted += (delegate(object sender2, EventArgs args)
            {
                var questGiverSender = (QuestGiver)sender2;
                questGiverSender.Dialogues[0] = "Good job!";
            });

            base.LargeLoadContent(sender);
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            var Content = gameRef.Content;

            IOManager.Init();

            blackOverlay = new DrawableRectangle(GraphicsDevice,
                new Vector2(MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), Color.White, true).Texture;

            blurOverlay = new GaussianBlur(gameRef);
            blurOverlay.ComputeKernel(7, 2.0f);

            titleImage = Content.Load<Texture2D>("Images\\title");

            title = new Label();
            title.SpriteFont = Content.Load<SpriteFont>("Fonts\\title");
            title.Text = "";
            title.Color = Color.White;
            title.Position = new Vector2(MainGame.GAME_WIDTH / 2 - title.Width / 2, 90);
            controls.Add(title);

            Texture2D[] images = new Texture2D[8];
            for (int i = 0; i < images.Length; i++)
            {
                images[i] = Content.Load<Texture2D>("Images\\waterfall\\water" + i.ToString());
            }

            anim = new Animation(images);

            #region Menu State
            menuControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            var start = new LinkLabel(0) { Name = "lnklblStart", Text = "New Game" };
            var load = new LinkLabel(1) { Name = "lnklblLoad", Text = "Load Game" };
            var options = new LinkLabel(2) { Name = "lnklblOptions", Text = "Options" };
            var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit Game" };

            menuControls.Add(start);
            menuControls.Add(load);
            menuControls.Add(options);
            menuControls.Add(quit);

            Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f);
            foreach (Control c in menuControls)
            {
                if (c is LinkLabel)
                {
                    var l = (LinkLabel)c;
                    var offset = new Vector2(c.Width / 2, 0);
                    c.Position = startPos - offset;
                    c.Selected += new EventHandler(LinkLabel_Selected);
                    c.Effect = ControlEffect.PULSE;
                    c.Color = Color.Black;
                    ((LinkLabel)c).SelectedColor = Color.DarkBlue;

                    l.OnMouseIn += LinkLabel_OnMouseIn;

                    startPos.Y += c.Height + 10f;
                }
            }

            menuControls.SelectControl(0);
            #endregion

            #region New Game State
            newGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            Label prompt = new Label();
            prompt.Text = "Enter your name";
            prompt.Name = "lblNamePrompt";
            prompt.Position = new Vector2(MainGame.GAME_WIDTH / 2 -
                prompt.SpriteFont.MeasureString(prompt.Text).X / 2, 200);
            newGameControls.Add(prompt);

            TextBox name = new TextBox(GraphicsDevice);
            name.Name = "txtName";
            name.Position = new Vector2(prompt.Position.X + 40, prompt.Position.Y + prompt.Height + 10);
            name.BackColor = Color.Transparent;
            name.ForeColor = Color.White;
            newGameControls.Add(name);

            LinkLabel startGame = new LinkLabel(2) { Name = "lnklblNewGame", Text = "Start" };
            startGame.Position = new Vector2(prompt.Position.X, name.Position.Y + 44);
            startGame.OnMouseIn += LinkLabel_OnMouseIn;
            startGame.Selected += (o, e) =>
            {
                Config.currentlyPlaying = newGameControls[1].Text;
                SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager)));
            };
            startGame.Effect = ControlEffect.PULSE;

            LinkLabel cancel = new LinkLabel(3) { Name = "lnklblCancel", Text = "Cancel" };
            cancel.Position = new Vector2(prompt.Position.X + prompt.Width - cancel.Width, startGame.Position.Y);
            cancel.OnMouseIn += LinkLabel_OnMouseIn;
            cancel.Selected += (o, e) => { currentState = State.Menu; };
            cancel.Effect = ControlEffect.PULSE;

            newGameControls.Add(startGame);
            newGameControls.Add(cancel);
            #endregion

            #region Load Game State
            loadGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            List<EntityProperties> saves = new List<EntityProperties>();
            saves = IOManager.GetAllPlayerDatas();

            startPos = new Vector2(MainGame.GAME_WIDTH / 2, 0);
            int counter = 0;
            foreach (EntityProperties ep in saves)
            {
                var lnklblLoadSave = new LinkLabel(counter++);
                lnklblLoadSave.AutoSize = true;
                lnklblLoadSave.Name = "lnklblLoadSave";
                lnklblLoadSave.Text = ep.Name + " | " + ep.TimeOfSave;
                lnklblLoadSave.OnMouseIn += LinkLabel_OnMouseIn;
                lnklblLoadSave.Selected += (o, e) => { SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager, ep))); };
                lnklblLoadSave.Effect = ControlEffect.PULSE;

                var offset = new Vector2(lnklblLoadSave.Width / 2, 0);
                lnklblLoadSave.Position = startPos - offset;
                startPos.Y += lnklblLoadSave.Height + 10;
                loadGameControls.Add(lnklblLoadSave);
            }

            var goBack_Load = new LinkLabel(loadGameControls.Count);
            goBack_Load.Name = "lnklblGoBackLoad";
            goBack_Load.Text = "Go Back";
            goBack_Load.Effect = ControlEffect.PULSE;
            goBack_Load.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Load.Width / 2, MainGame.GAME_HEIGHT - goBack_Load.Height - 100);
            goBack_Load.OnMouseIn += LinkLabel_OnMouseIn;
            goBack_Load.Selected += (o, e) => { currentState = State.Menu; };
            loadGameControls.Add(goBack_Load);

            #endregion

            #region Options Game State

            #endregion

            #region Quit State
            quitControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            Label areYouSure1 = new Label();
            areYouSure1.Name = "lblAreYouSure?";
            areYouSure1.Text = "Are you sure you want to quit?";
            areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString(
                areYouSure1.Text).X / 2, 140);
            quitControls.Add(areYouSure1);

            LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" };
            yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50);
            yes.OnMouseIn += LinkLabel_OnMouseIn;
            yes.Selected += (o, e) => { gameRef.Exit(); };
            yes.Effect = ControlEffect.PULSE;

            LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" };
            no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y);
            no.OnMouseIn += LinkLabel_OnMouseIn;
            no.Selected += (o, e) => { currentState = State.Menu; };
            no.Effect = ControlEffect.PULSE;

            quitControls.Add(yes);
            quitControls.Add(no);
            #endregion

            debugFont = Content.Load<SpriteFont>("Fonts\\version");
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            var Content = GameRef.Content;
            states = SaveDataParser.SaveStates;

            if (StartMenuScreen.Background is PictureBox)
            {
                background = StartMenuScreen.Background as PictureBox;
                ControlManager.Add(background);
            }
            else
                backgroundAnim = StartMenuScreen.Background as Animation;

            Texture2D arrowTexture = Content.Load<Texture2D>("GUI\\leftarrowUp");
            arrowImage = new PictureBox(arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height));
            ControlManager.Add(arrowImage);

            for (int i = 0; i < 5; i++)
            {
                LinkLabel label = new LinkLabel();

                if (SaveDataParser.GetSaveAtIndex(i) == null)
                {
                    label.Text = "-- No Save Game Found --";
                    label.Enabled = false;
                    label.Color = Color.DarkGray;
                }
                else
                    label.Text = SaveDataParser.GetSaveAtIndex(i).Name + " -- " + SaveDataParser.GetSaveAtIndex(i).Time;

                label.Size = label.SpriteFont.MeasureString(label.Text);
                label.Selected += new EventHandler(menuItem_Selected);
                label.Effect = ControlEffect.GLOW;
                labels.Add(label);
                ControlManager.Add(label);
            }

            ControlManager.NextControl();
            ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged);

            Vector2 position = new Vector2(ProjectElements.Data.ProjectData.GameWidth / 2, 100);

            foreach (Control c in ControlManager)
            {
                if (c is LinkLabel)
                {
                    Vector2 offset = new Vector2(c.Size.X / 2, 0);
                    if (c.Size.X > maxItemWidth)
                        maxItemWidth = c.Size.X;
                    c.Position = position - offset;
                    position.Y += c.Size.Y + 10f;
                }
            }
            ControlManager_FocusChanged(labels[0], null);
        }