コード例 #1
0
        private void end()
        {
            Lock = true;
            if (p1score > p2score)
            {
                p1menang.Visible = true;
                p1kalah.Visible  = false;
                p2menang.Visible = false;
                p2kalah.Visible  = true;
            }
            else if (p1score < p2score)
            {
                p1menang.Visible = false;
                p1kalah.Visible  = true;
                p2menang.Visible = true;
                p2kalah.Visible  = false;
            }
            else
            {
                p1seri.Visible = true;
                p2seri.Visible = true;
            }
            timer1.Enabled = true;

            System.Threading.Thread.Sleep(400);
            Player.RecordScore(1, p1.Name, p2.Name, p1score, p2score);
            hs t = new hs(1);

            t.ShowDialog();
            t.BringToFront();
            t.center();
        }
コード例 #2
0
        private void end()
        {
            textBox1.Enabled = false;
            if (p1correct > p2correct)
            {
                p1menang.Visible = true;
                p2kalah.Visible  = true;
            }
            else if (p1correct < p2correct)
            {
                p1kalah.Visible  = true;
                p2menang.Visible = true;
            }
            else
            {
                p1seri.Visible = true;
                p2seri.Visible = true;
            }

            System.Threading.Thread.Sleep(400);
            Player.RecordScore(7, p1.Name, p2.Name, p1correct * 50, p2correct * 50);
            hs t = new hs(7);

            t.ShowDialog();
            t.BringToFront();
            t.center();
            timer2.Enabled = true;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: z1479763604/EvanYoungSW02
 static void Main(string[] args)
 {
     Console.WriteLine("请输入一个0~9的数字");
     int t = int.Parse(Console.ReadLine());//这里错了好久!!老是直接获得ascii值
     Console.WriteLine("{0}到0的路径为", t);
     Console.Write("{0}→", t);
     hs ty = new hs();
     ty.LJ(t);
 }
コード例 #4
0
        private void tmrG2_Tick(object sender, EventArgs e)
        {
            waktuMain++;
            lblSoal.Left = (this.Width / 2 - lblSoal.Width / 2);
            pp1.Text     = pointP1.ToString();
            pp2.Text     = pointP2.ToString();

            picTiraiKiri.Visible  = false;
            picTiraiKanan.Visible = false;

            if ((60 - waktuMain) >= 10)
            {
                lblDetik.Text = "00 : " + (60 - waktuMain).ToString();
            }
            else
            {
                lblDetik.Text = "00 : 0" + (60 - waktuMain).ToString();
            }

            if (waktuMain >= 60)
            {
                tmrG2.Enabled    = false;
                lblDetik.Text    = "00 : 00";
                lblSoal.Visible  = false;
                lblHasil.Visible = true;

                gambarVisible();

                if (pointP1 > pointP2)
                {
                    lblHasil.Text = "Pemain 1 Menang !";
                }
                else if (pointP2 > pointP1)
                {
                    lblHasil.Text = "Pemain 2 Menang !";
                }
                else
                {
                    lblHasil.Text = "Permainan Seri !";
                }

                System.Threading.Thread.Sleep(400);
                Player.RecordScore(2, _p1.Name, _p2.Name, pointP1, pointP2);
                hs t = new hs(2);
                t.ShowDialog();
                t.BringToFront();
                t.center();
                timer1.Enabled = true;
            }

            if (check == 0 || (jawabP1 == false && jawabP2 == false))
            {
                //System.Threading.Thread.Sleep(1000);
                tmrWait.Enabled = true;
            }
        }
コード例 #5
0
 public void loadHighScore()
 {
     //If file exists load values
     if (File.Exists((Application.persistentDataPath + "/highscore.json")))
     {
         Debug.Log(File.ReadAllText(Application.persistentDataPath + "/highscore.json"));
         hsObj     = JsonUtility.FromJson <hs> (File.ReadAllText(Application.persistentDataPath + "/highscore.json"));
         highscore = hsObj.highscore;
         if (SoundChanger.soundChanger != null)
         {
             SoundChanger.soundChanger.musicSlider.value = hsObj.music;
             SoundChanger.soundChanger.soundSlider.value = hsObj.sound;
         }
     }
 }
コード例 #6
0
        private void tmrG5_Tick(object sender, EventArgs e)
        {
            waktuMain++;
            pp1.Text = pointP1.ToString();
            pp2.Text = pointP2.ToString();

            if ((60 - waktuMain) >= 10)
            {
                lblDetik.Text = "00 : " + (60 - waktuMain).ToString();
            }
            else
            {
                lblDetik.Text = "00 : 0" + (60 - waktuMain).ToString();
            }

            if (waktuMain >= 60 || jumlahBenarP1 >= 5 || jumlahBenarP2 >= 5)
            {
                tmrG5.Enabled    = false;
                lblDetik.Text    = "00 : 00";
                lblHasil.Visible = true;

                if (pointP1 > pointP2)
                {
                    lblHasil.Text = "Pemenang 1 Menang !";
                }
                else if (pointP2 > pointP1)
                {
                    lblHasil.Text = "Pemenang 2 Menang !";
                }
                else
                {
                    lblHasil.Text = "Permainan Seri !";
                }
                System.Threading.Thread.Sleep(4000);
                Player.RecordScore(5, p1.Name, p2.Name, pointP1, pointP2);
                hs t = new hs(5);
                t.ShowDialog();
                t.BringToFront();
                t.center();
                timer1.Enabled = true;
            }
        }
コード例 #7
0
 private void timer3_Tick(object sender, EventArgs e)
 {
     if (winner.Top > label3.Top)
     {
         winner.Top -= movefactor;
     }
     else if (winner.Left < label3.Left)
     {
         winner.Left += movefactor;
     }
     else
     {
         panel1.Visible = true;
         label1.Text    = winn.Name + " menang!";
         label1.Visible = true;
         label1.Left    = this.Width / 2 - label1.Width / 2;
         Player.RecordScore(8, p1.Name, p2.Name, p1.Score, p2.Score);
         hs d = new hs(8);
         d.ShowDialog();
         d.center();
         d.BringToFront();
         timer3.Enabled = false;
     }
 }
コード例 #8
0
        private void end()
        {
            textBox1.Enabled = false;
            timer1.Enabled   = false;
            if (p1score < p2score)
            {
                p1kalah.Visible  = true;
                p2menang.Visible = true;
                p1score         += 200;
            }
            else if (p1score > p2score)
            {
                p1menang.Visible = true;
                p2kalah.Visible  = true;
                p2score         += 100;
            }
            else
            {
                p2seri.Visible = true;
                p1seri.Visible = true;
                p1score       += 50;
                p2score       += 50;
            }

            label7.Text = "Skor: " + p1score.ToString();
            label8.Text = "Skor: " + p2score.ToString();

            System.Threading.Thread.Sleep(400);
            Player.RecordScore(4, p1.Name, p2.Name, p1score, p2score);
            hs t = new hs(4);

            t.ShowDialog();
            t.BringToFront();
            t.center();
            timer2.Enabled = true;
        }
        private void tmrG6_Tick(object sender, EventArgs e)
        {
            waktuMain++;
            pp1.Text = pointP1.ToString();
            pp2.Text = pointP2.ToString();

            if ((60 - waktuMain) >= 10)
            {
                lblDetik.Text = "00 : " + (60 - waktuMain).ToString();
            }
            else
            {
                lblDetik.Text = "00 : 0" + (60 - waktuMain).ToString();
            }

            if (waktuMain >= 60 || jumlahTotalBenarP1 == 5 || jumlahTotalBenarP2 == 5)
            {
                tmrG6.Enabled = false;
                lblDetik.Text = "00 : 00";

                lblSoal1.Visible = false;
                label1.Visible   = false;

                lblSoal2.Visible = false;
                label8.Visible   = false;

                /*
                 * label3.Parent = picTirai1Ke2;
                 * label7.Parent = picTirai2Ke2;
                 * label2.Parent = picTirai2Ke2;
                 * lblDetik.Parent = picTirai2Ke2;
                 */
                picP1Angka1.Visible  = false;
                picP1Angka2.Visible  = false;
                picP1Angka3.Visible  = false;
                picP1Angka4.Visible  = false;
                picTirai1Ke2.Visible = false;

                picP2Angka1.Visible  = false;
                picP2Angka2.Visible  = false;
                picP2Angka3.Visible  = false;
                picP2Angka4.Visible  = false;
                picTirai2Ke2.Visible = false;

                lblHasil.Visible = true;

                if (pointP1 > pointP2)
                {
                    lblHasil.Text = "Pemain 1 Menang !";
                }
                else if (pointP2 > pointP1)
                {
                    lblHasil.Text = "Pemain 2 Menang !";
                }
                else
                {
                    lblHasil.Text = "Permainan Seri !";
                }

                System.Threading.Thread.Sleep(400);
                Player.RecordScore(6, p1.Name, p2.Name, pointP1, pointP2);
                hs t = new hs(6);
                t.ShowDialog();
                t.BringToFront();
                t.center();
                timer1.Enabled = true;
            }
        }