Ejemplo n.º 1
0
        public ChoicePanel(GameInterface g)
        {
            gameInterface = g;

            BackColor = Color.CornflowerBlue;
            //Size = new Size(300, 140);

            textLabel = new Label();
            textLabel.Size = new Size(280, 40);
            textLabel.Location = new Point(10, 10);
            textLabel.Font = new Font(new FontFamily("Comic Sans MS"), 14);

            for (int i = 0; i < buttons.Length; i++)
            {
                ChoiceButton b = new ChoiceButton();
                b.BackColor = Color.GhostWhite;
                b.Visible = false;
                b.Font = new Font(new FontFamily("Comic Sans MS"), 12);
                b.Location = new Point(5 + (i % 3) * 80, 100 + 50*(i/3));
                b.Click += (sender, args) =>
                {
                    buttonPressed(b);
                };
                buttons[i] = b;
                Controls.Add(b);
            }

            Controls.Add(textLabel);
        }
Ejemplo n.º 2
0
 private void buttonPressed(ChoiceButton b)
 {
     gameInterface.gameElementPressed(b.getElement());
 }