コード例 #1
0
ファイル: Form1.cs プロジェクト: asadiqbalkhan/CodeNamePew
        //press enter to record score and username
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                e.SuppressKeyPress = true;

                string username = uInterface_gameOver_score.UserInput.Text;

                uInterface_gameOver_score.UserInput.Visible = false;
                game.Record(username);
                scoreboard = game.StoreScores();

                uInterface_gameOver_score.UserInput.Clear();
                this.Focus();

                gameOver_score.Visible   = false;
                gameOver_buttons.Visible = true;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: asadiqbalkhan/CodeNamePew
        public Form1()
        {
            InitializeComponent();
            Frame          = 0;
            game           = new Game(random, FormArea);
            gameOver       = false;
            game.GameOver += new EventHandler(game_GameOver);
            animationTimer.Start();

            //Panels
            mainMenu         = uInterface_main.CreatePanel(1);
            scoreBoardMenu   = uInterface_scoreBoard.CreatePanel(2);
            gameOver_score   = uInterface_gameOver_score.CreatePanel(3);
            gameOver_buttons = uInterface_gameOver_buttons.CreatePanel(4);
            pause_Interface  = uInterface_pauseInterface.CreatePanel(5);


            Controls.Add(mainMenu);
            Controls.Add(scoreBoardMenu);
            Controls.Add(gameOver_score);
            Controls.Add(gameOver_buttons);
            Controls.Add(pause_Interface);

            uInterface_main.menuImg.MouseClick      += new MouseEventHandler(menuImage_MouseClick);
            uInterface_main.btnUnmuteImg.MouseClick += new MouseEventHandler(button_MouseClick);
            uInterface_main.btnMuteImg.MouseClick   += new MouseEventHandler(button_MouseClick);

            uInterface_scoreBoard.menuImg.MouseClick += new MouseEventHandler(menuImage_MouseClick);
            uInterface_scoreBoard.menuImg.Paint      += new PaintEventHandler(scoreBoardMenu_Paint);

            uInterface_gameOver_score.menuImg.MouseClick   += new MouseEventHandler(menuImage_MouseClick);
            uInterface_gameOver_buttons.menuImg.MouseClick += new MouseEventHandler(menuImage_MouseClick);

            uInterface_gameOver_score.UserInput.KeyDown += new KeyEventHandler(textBox1_KeyDown);

            uInterface_pauseInterface.menuImg.MouseClick += new MouseEventHandler(menuImage_MouseClick);

            if (File.Exists(path))
            {
                scoreboard = game.StoreScores();
            }
        }