public BetaVerification(GameWindow parent)
        {
            mainLabel = new Label();
            mainLabel.Location = new Vector(350, 180);
            mainLabel.Text = "Please enter your open beta key.";

            nameBox = new TextBox();
            nameBox.Location = new Vector(325, 220);

            nameLabel = new Label();
            nameLabel.Location = new Vector(315, 200);
            nameLabel.Text = "Name:";

            keyLabel = new Label();
            keyLabel.Location = new Vector(325, 240);
            keyLabel.Text = "Beta key:";

            keyBox = new TextBox();
            keyBox.Location = new Vector(300, 260);
            keyBox.Size.X = 200;

            verifyButton = new Button();
            verifyButton.Location = new Vector(335, 290);
            verifyButton.ApplyStylishEffect();
            verifyButton.Image = "data/img/bck.bmp";
            verifyButton.Text = "Verify";

            verifyButton.MouseClick += (pos) =>
                {
                    if (OpenBetaFunctions.VerifyBetaKey(nameBox.Text, keyBox.Text))
                    {
                        Parent.Children.Remove(nameBox);
                        Parent.Children.Remove(nameLabel);
                        Parent.Children.Remove(keyBox);
                        Parent.Children.Remove(keyLabel);
                        Parent.Children.Remove(verifyButton);
                        Parent.Children.Remove(wrongKeyMessage);
                        Parent.Children.Remove(mainLabel);

                        Settings.Default.CredentialsVerified = true;
                        Settings.Default.Save();

                        if (Settings.Default.MusicStatus)
                            BackgroundMusic.StartPlayback();

                        Parent.Menu = new MainMenu(Parent);
                    }
                    else wrongKeyMessage.Visible = true;
                };

            wrongKeyMessage = new Label();
            wrongKeyMessage.Text = "The key and username do not match.";
            wrongKeyMessage.Location = new Vector(340, 310);
            wrongKeyMessage.Visible = false;

            Parent = parent;

            Parent.AddChildren(nameLabel, nameBox, mainLabel, keyLabel, keyBox, verifyButton, wrongKeyMessage);
        }
예제 #2
0
        public IngameMenu(GameWindow parent)
        {
            Parent = parent;
            Visible = false;

            float shift = 30;
            float x = parent.Width / 2;
            float y = parent.Height / 2;

            resume = new Button();
            resume.ApplyStylishEffect();
            resume.Location = new Vector(x - resume.Size.X, y - shift * 3);
            resume.Text = "Resume";
            resume.Visible = false;
            resume.MouseClick += (pos) =>
                {
                    Hide();
                    Parent.State = Window.WindowState.Game;
                };

            settings = new Button();
            settings.ApplyStylishEffect();
            settings.Location = new Vector(x - settings.Size.X + 7, y - shift * 2);
            settings.Text = "Settings";
            settings.Visible = false;
            settings.MouseClick += (pos) =>
                {

                };

            quit = new Button();
            quit.ApplyStylishEffect();
            quit.Location = new Vector(x - quit.Size.X, y - shift);
            quit.Text = "Quit";
            quit.Visible = false;
            quit.MouseClick += (pos) =>
                {
                    Game.Game.QuitLevel();
                    Parent.Menu.RenderVisibility(true);
                    Hide();
                };

            Parent.AddChildren(resume, settings, quit, this);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new level.
        /// </summary>
        /// <param name="parent">The parent window.</param>
        /// <param name="shootInterval">The interval between shooting items.</param>
        /// <param name="targetScore">The score to be reached before winning the level.</param>
        /// <param name="missedLimit">The items missed before you fail the level.</param>
        /// <param name="shootQ">The numbers of objects shot at once.</param>
        public Level(GameWindow parent, int shootInterval, int targetScore, int missedLimit,
            int shootQ)
        {
            CurrentScore = 0;
            MissedLimit = missedLimit;
            TargetScore = targetScore;
            ShootInterval = shootInterval;
            shootQuant = shootQ;

            Parent = parent;

            //score
            scoreLabel = new Label();
            scoreLabel.Location = new Vector(600, 10);
            scoreLabel.Text = "0/" + targetScore.ToString();

            scoreText = new Label();
            scoreText.Text = "Score:";
            scoreText.Location = new Vector(500, 10);

            //missed
            missedLabel = new Label();
            missedLabel.Location = new Vector(600, 30);
            missedLabel.Text = "0/" + missedLimit.ToString();

            missedText = new Label();
            missedText.Text = "Missed:";
            missedText.Location = new Vector(500, 30);

            flyingObjects = new List<FlyingObject>();
            mainTimer.Interval = 10;
            mainTimer.Tick += AnimationStep;

            Parent.AddChildren(scoreText, scoreLabel, missedText, missedLabel);

            Completed = false;
        }
예제 #4
0
        public MainMenu(GameWindow window)
        {
            ParentWindow = window;
            playGameMenu = new PlayGameMenu(this);

            play = new Button();
            play.ApplyStylishEffect();
            play.Text = "Play Game";
            play.Image = "data/img/bck.bmp";
            play.MouseClick += (pos) =>
                {
                    HideAllVisible();
                    playGameMenu.Show();
                };
            play.Location = new Vector(100, 120);

            settings = new Button();
            settings.ApplyStylishEffect();
            settings.Text = "Settings";
            //settings.Size.X = 100;
            settings.Image = "data/img/bck.bmp";
            settings.Location = new Vector(100, 150);
            settings.MouseClick += (pos) =>
                {
                    HideAllVisible();
                    settingsMenu.Visible = true;
                    settingsMenu.Show();
                };

            about = new Button();
            about.ApplyStylishEffect();
            about.Text = "About";
            //about.Size.X = 80;
            about.Image = "data/img/bck.bmp";
            about.Location = new Vector(100, 180);
            about.MouseClick += (pos) =>
                {
                    if (!credits.Visible) HideAllVisible();
                    credits.Visible = credits.Visible ? false : true;
                };

            highScores = new Button();
            highScores.ApplyStylishEffect();
            highScores.Text = "High Scores";
            highScores.Image = "data/img/bck.bmp";
            highScores.Location = new Vector(100, 210);
            highScores.MouseClick += (pos) =>
                {
                    HideAllVisible();
                    Game.Game.ShowScores();
                };

            quit = new Button();
            quit.ApplyStylishEffect();
            quit.Text = "Quit";
            //quit.Size.X = 60;
            quit.Image = "data/img/bck.bmp";
            quit.Location = new Vector(100, 240);
            quit.MouseClick += (pos) =>
                {
                    Environment.Exit(0);
                };

            credits = new Credits(this);
            credits.Visible = false;
            settingsMenu = new SettingsMenu(this);

            mainTimer.Tick += (o, e) =>
            {
                if (curShift < destShift)
                {
                    curShift += shiftIncr;

                    play.Location.X -= curShift;
                    settings.Location.X -= curShift;
                    about.Location.X -= curShift;
                    quit.Location.X -= curShift;
                    highScores.Location.X -= curShift;
                    return;
                }
                mainTimer.Stop();
            };

            ParentWindow.State = Window.WindowState.MainMenu;
            ParentWindow.AddChildren(play, settings, about, quit, credits, settingsMenu, highScores);

            LogManager.WriteInfo("Main menu created.");
        }