コード例 #1
0
ファイル: Form1.cs プロジェクト: michaelcoca/ch7-ex3
        private void ResetGame()
        {
            MessageBox.Show("You found me in " + totalMoves + " moves!");
            IHidingPlace foundLocation = currentLocation as IHidingPlace;

            description.Text         = "The opponent was hiding " + currentLocation.Name + " in " + totalMoves.ToString() + " moves. ";
            opponent                 = new Opponent(frontYard);
            hide.Visible             = true;
            check.Visible            = false;
            goHere.Visible           = false;
            exits.Visible            = false;
            goThroughTheDoor.Visible = false;
            totalMoves               = 0;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: michaelcoca/ch7-ex3
 private void hide_Click(object sender, EventArgs e)
 {
     opponent = new Opponent(frontYard);
     for (int i = 0; i < 10; i++)
     {
         int theCount = i + 1;
         description.Text += theCount.ToString() + "... ";
         Application.DoEvents();
         System.Threading.Thread.Sleep(200);
         opponent.Move();
     }
     description.Text += "Ready or not, here I come! ";
     Application.DoEvents();
     System.Threading.Thread.Sleep(500);
     RedrawForm();
 }