Beispiel #1
0
        static void Main()
        {
            // Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            var form = new GameForm();

            Application.Run(form);
        }
Beispiel #2
0
        public WinnerForm(GameForm source)
        {
            InitializeComponent();
            ClientSize = new Size(500, 665);
            var table = new TableLayoutPanel();
            var label = new Label
            {
                Text   = "Congratulations! Level complete!",
                Dock   = DockStyle.Fill,
                Image  = animatedImage,
                Bounds = new Rectangle(0, 0, 500, 500)
            };

            var buttonNextLevel = new Button
            {
                Text   = "Next Level",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 500, 500, 50),
            };

            buttonNextLevel.Click += (sender, args) => { source.NextLevel(); source.Show(); Close(); };

            var buttonRepeat = new Button
            {
                Text   = "Repeat",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 550, 500, 50)
            };

            buttonRepeat.Click += (sender, args) => { source.RepeatLevel(); source.Show(); this.Close(); };

            var buttonQuit = new Button()
            {
                Text   = "Quit game",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 600, 500, 50)
            };

            buttonQuit.Click += (sender, args) => source.Close();

            table.RowStyles.Clear();
            table.Controls.Add(label);
            table.Controls.Add(buttonNextLevel);
            table.Controls.Add(buttonRepeat);
            table.Controls.Add(buttonQuit);
            table.Dock = DockStyle.Fill;

            Controls.Add(table);
        }
Beispiel #3
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(usernameTextBox.Text))
            {
                MessageBox.Show("The Username is empty! Please enter a Username!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(passwordTextBox.Text))
            {
                MessageBox.Show("The Password is empty! Please enter a Password!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (passwordTextBox.Text.Length < 6)
            {
                MessageBox.Show("The Password invalid! Please enter a Password (min. 6 Letters)!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string   username = usernameTextBox.Text.ToLower();
            string   password = EncryptMD5(passwordTextBox.Text);
            Database database = new Database();
            string   dataset  = database.Select("Verified", "Username='******' AND Password='******'");

            if (dataset != "")
            {
                if (dataset == "True")
                {
                    GameForm form = new GameForm(this);
                }
                else
                {
                    DialogResult result = MessageBox.Show("You are not verified yet! Please verify your Account first! Do you want to open the Verifysection?", "Error!",
                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                    switch (result)
                    {
                    case DialogResult.Yes:
                        Process.Start("http://dasdarki.de/pacman/index_logged.php?mod=verification");
                        break;

                    case DialogResult.No:

                        break;
                    }
                }
            }
            else
            {
                MessageBox.Show("The Combination of Username and Password does not exist!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public Fruit(GameForm gameForm, int deadTime = 10)
        {
            this.point    = point;
            this.deadTime = deadTime;
            this.gameForm = gameForm;

            randomFruit();

            if (tipo == FruitType.CHERRY)
            {
                point = 100;
            }
            else if (tipo == FruitType.STRBRRY)
            {
                point = 150;
            }
        }
Beispiel #5
0
        public GameController(GameForm gameForm, Player player, List <enemy> enemies)
        {
            this.gameForm = gameForm;
            this.player   = player;
            int posX = gameForm.Width;
            int posY = gameForm.Height;

            player.SetPos(posX / 2, posY / 2);

            this.enemies = enemies;

            foreach (enemy enemy in enemies)
            {
                enemy.OnKill += Die;
            }

            gameForm.LoadEnemies(enemies);
        }
Beispiel #6
0
        private void StartGame(object sender, IniciarEventArgs e)
        {
            Player player = new Player(0, 0, e.name);

            List <enemy> enemies = new List <enemy>();

            enemy red  = new enemy(player);
            enemy pink = new enemy(player);

            enemies.Add(red);
            enemies.Add(pink);

            GameForm       gameForm       = new GameForm(player, mainMenu);
            GameController gameController = new GameController(gameForm, player, enemies);

            mainMenu.Hide();
            gameForm.Show();
        }
Beispiel #7
0
 public GameController(GameForm gameForm)
 {
     gameView = gameForm;
 }