예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }