Esempio n. 1
0
        public MainMenu(PictureBox BG, TitleScreen Title)
        {
            Name       = "Main Menu";
            this.Title = Title;

            Button b;

            Buttons.Add(new Button());
            b           = Buttons.Last();
            b.Text      = "New Game";
            b.FlatStyle = FlatStyle.Flat;
            b.Font      = bFont;
            b.Parent    = BG;
            b.Size      = new Size(275, 86);
            //b.Image = GetButtonImage(b, Globals.GameDir + "\\Title.jpg");
            b.Location = new Point(BG.Width / 2 - b.Width / 2, BG.Height / 2 - (b.Height * 4 + SPACING * 3) / 2);
            b.Click   += NewGame_Click;

            Buttons.Add(new Button());
            b           = Buttons.Last();
            b.Text      = "Load Game";
            b.Font      = bFont;
            b.Parent    = BG;
            b.FlatStyle = FlatStyle.Flat;
            b.Size      = new Size(275, 86);
            //b.Image = GetButtonImage(b, Globals.GameDir + "\\Title.jpg");
            b.Location = new Point(BG.Width / 2 - b.Width / 2, BG.Height / 2 - (b.Height * 4 + SPACING * 3) / 2 + 1 * (b.Height + SPACING));
            b.Click   += LoadGame_Click;

            Buttons.Add(new Button());
            b           = Buttons.Last();
            b.Text      = "About";
            b.FlatStyle = FlatStyle.Flat;
            b.Font      = bFont;
            b.Parent    = BG;
            b.Size      = new Size(275, 86);
            //b.Image = GetButtonImage(b, Globals.GameDir + "\\Title.jpg");
            b.Location = new Point(BG.Width / 2 - b.Width / 2, BG.Height / 2 - (b.Height * 4 + SPACING * 3) / 2 + 2 * (b.Height + SPACING));
            b.Click   += About_Click;

            Buttons.Add(new Button());
            b           = Buttons.Last();
            b.Text      = "Exit";
            b.FlatStyle = FlatStyle.Flat;
            b.Font      = bFont;
            b.Parent    = BG;
            b.Size      = new Size(275, 86);
            //b.Image = GetButtonImage(b, Globals.GameDir + "\\Title.jpg");
            b.Location = new Point(BG.Width / 2 - b.Width / 2, BG.Height / 2 - (b.Height * 4 + SPACING * 3) / 2 + 3 * (b.Height + SPACING));
            b.Click   += Close_Click;

            SelectedIndex = 0;

            if (Globals.DEBUGMODE == true)
            {
                Buttons.Add(new Button());
                b           = Buttons.Last();
                b.Text      = "TO EDITOR";
                b.FlatStyle = FlatStyle.Flat;
                b.Font      = bFont;
                b.Parent    = BG;
                b.Size      = new Size(275, 86);
                //b.Image = GetButtonImage(b, Globals.GameDir + "\\Title.jpg");
                b.Location = new Point(BG.Width - b.Width - 10, BG.Height - b.Height - 10);
                b.Click   += ToEditor_Click;
            }

            foreach (Button bu in Buttons)
            {
                bu.TabStop = false;
                bu.FlatAppearance.BorderSize = 1;
                bu.MouseMove += MouseEnter;
            }

            Mask = new PictureBox();
            Mask.SendToBack();
            Mask.Parent    = BG;
            Mask.Location  = new Point(Buttons.First().Location.X - 50, Buttons.First().Location.Y - 30);
            Mask.Size      = new Size(Buttons.First().Width + 100, (b.Height * 4 + SPACING * 3) + 60);
            Mask.BackColor = Color.FromArgb(150, 0, 0, 0);
        }