Esempio n. 1
0
        private void Stop()
        {
            timer1.Stop();
            stopwatch.Stop();
            timer1.Enabled = false;
            //timer1.Tick -= timer1_Tick;
            tick.Stop();
            Console.WriteLine(time + "s");
            if (currentPlayer == null)
            {
                if (!isAsked)
                {
                    string name = InputDialog.ShowDialog("Enter your name: ");
                    if (name != null && name.Trim() != "")
                    {
                        setPlayer(name);
                        currentPlayer.playerScore = score;
                        currentPlayer.playerTime  = Math.Round(time, 1);
                        prepHighscores();
                        curplayernamelb.Text = currentPlayer.playerName;
                        curscorelb.Text      = currentPlayer.playerScore.ToString();
                        displayHistory(currentPlayer.playerName, currentPlayer.playerScore.ToString());
                    }
                    else
                    {
                        curplayernamelb.Text = "Guest";
                        curscorelb.Text      = score.ToString();
                        displayHistory("Guest", score.ToString());
                    }

                    isAsked = true;
                }
                else
                {
                    curplayernamelb.Text = "Guest";
                    curscorelb.Text      = score.ToString();
                    displayHistory("Guest", score.ToString());
                }
            }
            else
            {
                currentPlayer.playerScore = score;
                currentPlayer.playerTime  = Math.Round(time, 1);
                prepHighscores();
                curplayernamelb.Text = currentPlayer.playerName;
                curscorelb.Text      = currentPlayer.playerScore.ToString();
                displayHistory(currentPlayer.playerName, currentPlayer.playerScore.ToString());
            }
            this.highscorepanel.Controls.Add(currentscorepanel);
            displayHighscores();
        }
Esempio n. 2
0
        private void changeplayerbtn_Click(object sender, EventArgs e)
        {
            iscollapsed = true;
            dropdowntimer.Start();
            string name = InputDialog.ShowDialog("Enter name (or leave blank to play as guest): ");

            if (name != null && name != "")
            {
                setPlayer(name);
            }
            else
            {
                currentPlayer      = null;
                playernamebtn.Text = "Guest";
            }
        }
Esempio n. 3
0
 private void playernamebtn_Click(object sender, EventArgs e)
 {
     if (currentPlayer == null)
     {
         string name = InputDialog.ShowDialog("Player Name: ");
         if (name != null && name != "")
         {
             setPlayer(name);
             //playernamebtn.Text = currentPlayer.playerName;
             //playernamebtn.Enabled = false;
         }
         isAsked = true;
     }
     else
     {
         dropdowntimer.Start();
     }
 }
Esempio n. 4
0
        private void setKey(string passkey, bool tobesaved = false)
        {
            string key = null, confkey = null;

            InputDialog.ShowDialog("Enter a key (leave blank if you don't want any): ", true);
            if (key != null && key.Trim() != "")
            {
                confkey = InputDialog.ShowDialog("Confirm key: ", true);
                if (confkey.Equals(key))
                {
                    currentPlayer.passkey = Cipher.Encrypt(key);
                    setkeybtn.Enabled     = false;
                    MessageBox.Show("Key saved.", "Success", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
            }
            //else
            //{
            //    currentPlayer.passkey = "";
            //    setkeybtn.Enabled = true;
            //}
        }