コード例 #1
0
ファイル: Form1.cs プロジェクト: RIMP-19/PlaceHolder_Arkanoid
        private void BttnStartGame_Click(object sender, EventArgs e)
        {
            tableLayoutPanel1.Hide();
            start = new LogIn {
                Dock = DockStyle.Fill
            };
            start.startGame = () =>
            {
                start.Dispose();
                Controls.Remove(start);
                Controls.Add(ca);
                bttnStartGame.Focus();

                ca.GamePage = (wo) =>
                {
                    gP = wo;
                };

                ca.TerminarJuego = () =>
                {
                    player.Score = DatosJuego.puntaje;
                    PlayerDAO.CreateNew(player);
                    DatosJuego.vidas           = 3;
                    DatosJuego.ticksRealizados = 0;
                    DatosJuego.puntaje         = 0;
                    Controls.Remove(ca);
                    ca = null;
                    ca = new ControlArkanoid
                    {
                        Dock = DockStyle.Fill,
                    };
                    ca.Width  = Width;
                    ca.Height = Height;

                    if (gP)
                    {
                        Controls.Add(w);
                    }
                    else
                    {
                        Controls.Add(gO);
                    }
                };
                bttnStartGame.Focus();
            };
            Controls.Add(start);
        }
コード例 #2
0
ファイル: LogIn.cs プロジェクト: RIMP-19/PlaceHolder_Arkanoid
        private void BtnNext_Click(object sender, EventArgs e)
        {
            if (txtUser.Text == "")
            {
                MessageBox.Show("No se permite dejar vacío el nombre.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var newPlayer = new Player
            {
                UserName = txtUser.Text,
                Score    = 0
            };

            parentForm.player.UserName = newPlayer.UserName;
            parentForm.player.Score    = newPlayer.Score;

            PlayerDAO.CreateNew(newPlayer);
            Dispose();
            startGame.Invoke();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: RIMP-19/PlaceHolder_Arkanoid
        private void Form1_Load(object sender, EventArgs e)
        {
            start = new LogIn {
                Dock = DockStyle.Fill
            };
            topScores = new HighScores {
                Dock = DockStyle.Fill
            };
            ca = new ControlArkanoid {
                Dock = DockStyle.Fill
            };
            ca.Width  = Width;
            ca.Height = Height;
            player    = new Player();

            gO = new GameOverUser
            {
                Dock = DockStyle.Fill
            };
            gO.backToMenu = () =>
            {
                Controls.Remove(gO);
                tableLayoutPanel1.Show();
            };

            w = new Winner
            {
                Dock = DockStyle.Fill
            };
            w.backToMenuW = () =>
            {
                Controls.Remove(w);
                tableLayoutPanel1.Show();
            };


            start.startGame = () =>
            {
                start.Dispose();
                Controls.Remove(start);
                Controls.Add(ca);
                bttnStartGame.Focus();

                ca.GamePage = (wo) =>
                {
                    gP = wo;
                };

                ca.TerminarJuego = () =>
                {
                    player.Score = DatosJuego.puntaje;
                    PlayerDAO.CreateNew(player);
                    DatosJuego.vidas           = 3;
                    DatosJuego.ticksRealizados = 0;
                    DatosJuego.puntaje         = 0;
                    Controls.Remove(ca);
                    ca = null;
                    ca = new ControlArkanoid
                    {
                        Dock = DockStyle.Fill,
                    };
                    ca.Width  = Width;
                    ca.Height = Height;

                    if (gP)
                    {
                        Controls.Add(w);
                    }
                    else
                    {
                        Controls.Add(gO);
                    }
                };
                bttnStartGame.Focus();
            };

            topScores.backMenu = () =>
            {
                Controls.Remove(topScores);
                tableLayoutPanel1.Show();
            };

            ca.GamePage = (wo) =>
            {
                gP = wo;
            };

            ca.TerminarJuego = () =>
            {
                player.Score = DatosJuego.puntaje;
                PlayerDAO.CreateNew(player);
                Controls.Remove(ca);
                DatosJuego.vidas           = 3;
                DatosJuego.puntaje         = 0;
                DatosJuego.ticksRealizados = 0;
                ca = null;
                ca = new ControlArkanoid
                {
                    Dock = DockStyle.Fill,
                };
                ca.Width  = Width;
                ca.Height = Height;

                if (gP)
                {
                    Controls.Add(w);
                }
                else
                {
                    Controls.Add(gO);
                }
            };
            bttnStartGame.Focus();
        }