Пример #1
0
 /// <summary>
 /// Toggle the snake demo
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonSnakeDemo_Click(object sender, EventArgs e)
 {
     if (_snakeDemo == null)
     {
         _snakeDemo                    = new SnakeDemo(_touchlessMgr, pictureBoxDisplay.Bounds);
         buttonSnakeDemo.Text          = "Stop Snake Demo";
         buttonDrawDemo.Enabled        = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = false;
         labelDemoInstructions.Enabled = true;
         labelDemoInstructions.Text    = "Snake Demo Instructions:\n\n"
                                         + "Uses a single marker to control this classic snake game remake.\n"
                                         + "   Use the four areas (up/down/left/right) to direct the snake.\n"
                                         + "   The center area doesn't effect the snake direction.\n"
                                         + "   The snake won't double-back, turn 90 degrees first.\n\n"
                                         + "Collect as many little nibbles as you can to increase your score.\n"
                                         + "Watch out: the snake will grow and get faster.\n"
                                         + "Don't hit the walls and don't bite yourself.\n\n"
                                         + "Can you make more snake levels with obstacles?\n"
                                         + "Can you revise the snake's movement and controls?\n"
                                         + "Can you remake other classic games or invent a new game?\n"
                                         + "Our SDK isn't tied to Windows Forms, use XNA and more.\n\n"
                                         + "Give feedback, submit code, join the community, and more:\n"
                                         + "http://www.codeplex.com/touchless";
     }
     else
     {
         _snakeDemo.Dispose();
         _snakeDemo                    = null;
         buttonSnakeDemo.Text          = "Start Snake Demo";
         buttonDrawDemo.Enabled        = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = true;
         labelDemoInstructions.Enabled = false;
         labelDemoInstructions.Text    = "";
     }
 }