コード例 #1
0
        public override void LoadContent()
        {
            SpriteFont font = FingerGames.Instance.Content.Load <SpriteFont>(@"Fonts\MenuFont");

            HorizontalStackPanel horizontalPanel = new HorizontalStackPanel();

            horizontalPanel.VerticalAlignment = VerticalAlignment.Top;
            horizontalPanel.FixedSize         = false;
            horizontalPanel.Bounds            = new Rectangle(0, 0, 800, 480);
            horizontalPanel.Padding           = new Rectangle(10, 10, 10, 10);

            foreach (BaseGame game in new BaseGame[] { new Games.FingerRacerGame(FingerGames.Instance.GameManager), new Games.FingerRunnerGame(FingerGames.Instance.GameManager), new Games.FingerTwisterGame(FingerGames.Instance.GameManager) })
            {
                _games.Add(game);

                game.LoadContent();
                XnaImageButton imageButton = new XnaImageButton(game.Logo, new Rectangle(5, 5, 240, 240));
                imageButton.Tag       = game;
                imageButton.BackColor = Color.Gray;
                imageButton.Click    += new EventHandler(imageButton_Click);

                XnaButton textButton = new XnaButton(new Rectangle(5, 5, 240, 60));
                textButton.BorderWidth = 0;
                textButton.BackColor   = Color.Transparent;
                textButton.Text        = game.Title;
                textButton.Font        = font;
                textButton.Tag         = game;
                textButton.Click      += new EventHandler(imageButton_Click);

                VerticalStackPanel panel = new VerticalStackPanel();
                panel.Bounds = new Rectangle(0, 0, 240, 0);
                panel.HorizontalAlignment = HorizontalAlignment.Center;
                panel.AddChild(imageButton);
                panel.AddChild(textButton);

                horizontalPanel.AddChild(panel);
            }

            VerticalStackPanel vertPanel = new VerticalStackPanel();

            vertPanel.Bounds = new Rectangle(0, 0, 800, 0);
            vertPanel.HorizontalAlignment = HorizontalAlignment.Center;
            vertPanel.AddChild(horizontalPanel);

            XnaButton playAllText = new XnaButton(new Rectangle(0, 480 - 60, 800, 60));

            playAllText.BorderWidth = 0;
            playAllText.BackColor   = Color.Transparent;
            playAllText.Text        = "Play All Games";
            playAllText.Font        = font;
            playAllText.Tag         = null;
            playAllText.Click      += new EventHandler(imageButton_Click);

            this.Children.Add(vertPanel);
            this.Children.Add(playAllText);

            base.LoadContent();
        }
コード例 #2
0
        public override void LoadContent()
        {
            SpriteFont font = FingerGames.Instance.Content.Load<SpriteFont>(@"Fonts\MenuFont");

            HorizontalStackPanel horizontalPanel = new HorizontalStackPanel();
            horizontalPanel.VerticalAlignment = VerticalAlignment.Top;
            horizontalPanel.FixedSize = false;
            horizontalPanel.Bounds = new Rectangle(0, 0, 800, 480);
            horizontalPanel.Padding = new Rectangle(10, 10, 10, 10);

            foreach (BaseGame game in new BaseGame[] { new Games.FingerRacerGame(FingerGames.Instance.GameManager), new Games.FingerRunnerGame(FingerGames.Instance.GameManager), new Games.FingerTwisterGame(FingerGames.Instance.GameManager) })
            {
                _games.Add(game);

                game.LoadContent();
                XnaImageButton imageButton = new XnaImageButton(game.Logo, new Rectangle(5, 5, 240, 240));
                imageButton.Tag = game;
                imageButton.BackColor = Color.Gray;
                imageButton.Click += new EventHandler(imageButton_Click);

                XnaButton textButton = new XnaButton(new Rectangle(5, 5, 240, 60));
                textButton.BorderWidth = 0;
                textButton.BackColor = Color.Transparent;
                textButton.Text = game.Title;
                textButton.Font = font;
                textButton.Tag = game;
                textButton.Click += new EventHandler(imageButton_Click);

                VerticalStackPanel panel = new VerticalStackPanel();
                panel.Bounds = new Rectangle(0, 0, 240, 0);
                panel.HorizontalAlignment = HorizontalAlignment.Center;
                panel.AddChild(imageButton);
                panel.AddChild(textButton);

                horizontalPanel.AddChild(panel);
            }

            VerticalStackPanel vertPanel = new VerticalStackPanel();
            vertPanel.Bounds = new Rectangle(0, 0, 800, 0);
            vertPanel.HorizontalAlignment = HorizontalAlignment.Center;
            vertPanel.AddChild(horizontalPanel);

            XnaButton playAllText = new XnaButton(new Rectangle(0, 480 - 60, 800, 60));
            playAllText.BorderWidth = 0;
            playAllText.BackColor = Color.Transparent;
            playAllText.Text = "Play All Games";
            playAllText.Font = font;
            playAllText.Tag = null;
            playAllText.Click += new EventHandler(imageButton_Click);

            this.Children.Add(vertPanel);
            this.Children.Add(playAllText);

            base.LoadContent();
        }
コード例 #3
0
        public XnaScoreCenter()
        {
            if (null == _menuFont)
            {
                _menuFont = FingerGames.Instance.Content.Load <SpriteFont>(@"Fonts\MenuFont");
            }

            _continueButton        = new XnaButton(new Rectangle(0, 400, 800, 80));
            _continueButton.Text   = "Tap Here to Continue...";
            _continueButton.Click += new EventHandler(_continueButton_Click);

            _horizontalScorePanel = new HorizontalStackPanel();
            _horizontalScorePanel.VerticalAlignment = VerticalAlignment.Top;
            _horizontalScorePanel.Bounds            = new Rectangle(0, 0, 800, 400);
            _horizontalScorePanel.Padding           = new Rectangle(0, 0, 0, 0);

            _nameScorePanel = new VerticalStackPanel();
            _nameScorePanel.HorizontalAlignment = HorizontalAlignment.Left;
            _nameScorePanel.FixedSize           = true;
            _nameScorePanel.Bounds      = new Rectangle(0, 0, 300, 400);
            _nameScorePanel.BorderColor = Color.White;
            _nameScorePanel.BorderWidth = 1;

            _scoreScorePanel             = new VerticalStackPanel();
            _scoreScorePanel.FixedSize   = true;
            _scoreScorePanel.Bounds      = new Rectangle(0, 0, 250, 400);
            _scoreScorePanel.BorderColor = Color.White;
            _scoreScorePanel.BorderWidth = 1;

            _totalScorePanel             = new VerticalStackPanel();
            _totalScorePanel.FixedSize   = true;
            _totalScorePanel.Bounds      = new Rectangle(0, 0, 250, 400);
            _totalScorePanel.BorderColor = Color.White;
            _totalScorePanel.BorderWidth = 1;

            XnaLabel nameLabel = new XnaButton(new Rectangle(0, 0, 300, 70));

            nameLabel.Text                = "Name";
            nameLabel.FontZoom            = 1.25f;
            nameLabel.Font                = _menuFont;
            nameLabel.HorizontalAlignment = HorizontalAlignment.Left;

            _nameScorePanel.AddChild(nameLabel);

            _scoreLabel                     = new XnaButton(new Rectangle(0, 0, 250, 70));
            _scoreLabel.Text                = "Score";
            _scoreLabel.FontZoom            = 1.25f;
            _scoreLabel.Font                = _menuFont;
            _scoreLabel.HorizontalAlignment = HorizontalAlignment.Center;

            _scoreScorePanel.AddChild(_scoreLabel);

            _totalLabel                     = new XnaButton(new Rectangle(0, 0, 250, 70));
            _totalLabel.Text                = "Overall";
            _totalLabel.FontZoom            = 1.25f;
            _totalLabel.Font                = _menuFont;
            _totalLabel.HorizontalAlignment = HorizontalAlignment.Center;

            _totalScorePanel.AddChild(_totalLabel);

            _horizontalScorePanel.AddChild(_nameScorePanel);
            _horizontalScorePanel.AddChild(_scoreScorePanel);
            _horizontalScorePanel.AddChild(_totalScorePanel);

            _scorePanel           = new VerticalStackPanel();
            _scorePanel.Bounds    = new Rectangle(0, 0, 800, 480);
            _scorePanel.FixedSize = true;

            _scorePanel.AddChild(_horizontalScorePanel);
            _scorePanel.AddChild(_continueButton);

            _loadingLabel      = new XnaLabel(new Rectangle(0, 0, 800, 480));
            _loadingLabel.Text = "Loading...";

            _continueButton.Click += new EventHandler(_continueButton_Click);
        }
コード例 #4
0
        public XnaScoreCenter()
        {
            if (null == _menuFont)
            {
                _menuFont = FingerGames.Instance.Content.Load<SpriteFont>(@"Fonts\MenuFont");
            }

            _continueButton = new XnaButton(new Rectangle(0, 400, 800, 80));
            _continueButton.Text = "Tap Here to Continue...";
            _continueButton.Click += new EventHandler(_continueButton_Click);

            _horizontalScorePanel = new HorizontalStackPanel();
            _horizontalScorePanel.VerticalAlignment = VerticalAlignment.Top;
            _horizontalScorePanel.Bounds = new Rectangle(0, 0, 800, 400);
            _horizontalScorePanel.Padding = new Rectangle(0, 0, 0, 0);

            _nameScorePanel = new VerticalStackPanel();
            _nameScorePanel.HorizontalAlignment = HorizontalAlignment.Left;
            _nameScorePanel.FixedSize = true;
            _nameScorePanel.Bounds = new Rectangle(0, 0, 300, 400);
            _nameScorePanel.BorderColor = Color.White;
            _nameScorePanel.BorderWidth = 1;

            _scoreScorePanel = new VerticalStackPanel();
            _scoreScorePanel.FixedSize = true;
            _scoreScorePanel.Bounds = new Rectangle(0, 0, 250, 400);
            _scoreScorePanel.BorderColor = Color.White;
            _scoreScorePanel.BorderWidth = 1;

            _totalScorePanel = new VerticalStackPanel();
            _totalScorePanel.FixedSize = true;
            _totalScorePanel.Bounds = new Rectangle(0, 0, 250, 400);
            _totalScorePanel.BorderColor = Color.White;
            _totalScorePanel.BorderWidth = 1;

            XnaLabel nameLabel = new XnaButton(new Rectangle(0, 0, 300, 70));
            nameLabel.Text = "Name";
            nameLabel.FontZoom = 1.25f;
            nameLabel.Font = _menuFont;
            nameLabel.HorizontalAlignment = HorizontalAlignment.Left;

            _nameScorePanel.AddChild(nameLabel);

            _scoreLabel = new XnaButton(new Rectangle(0, 0, 250, 70));
            _scoreLabel.Text = "Score";
            _scoreLabel.FontZoom = 1.25f;
            _scoreLabel.Font = _menuFont;
            _scoreLabel.HorizontalAlignment = HorizontalAlignment.Center;

            _scoreScorePanel.AddChild(_scoreLabel);

            _totalLabel = new XnaButton(new Rectangle(0, 0, 250, 70));
            _totalLabel.Text = "Overall";
            _totalLabel.FontZoom = 1.25f;
            _totalLabel.Font = _menuFont;
            _totalLabel.HorizontalAlignment = HorizontalAlignment.Center;

            _totalScorePanel.AddChild(_totalLabel);

            _horizontalScorePanel.AddChild(_nameScorePanel);
            _horizontalScorePanel.AddChild(_scoreScorePanel);
            _horizontalScorePanel.AddChild(_totalScorePanel);

            _scorePanel = new VerticalStackPanel();
            _scorePanel.Bounds = new Rectangle(0, 0, 800, 480);
            _scorePanel.FixedSize = true;

            _scorePanel.AddChild(_horizontalScorePanel);
            _scorePanel.AddChild(_continueButton);

            _loadingLabel = new XnaLabel(new Rectangle(0, 0, 800, 480));
            _loadingLabel.Text = "Loading...";

            _continueButton.Click += new EventHandler(_continueButton_Click);
        }