示例#1
0
 void InitializeGame()
 {
     GDI_Computing_Method.Map_Initialize(200);          //初始化地图与坐标
     GDI_Computing_Method.Obstacle_Initialize(oe_info); //初始化障碍物
     System.Threading.Thread.Sleep(200);
     GDI_Computing_Method.Snake_ArrayList_Initialize(Snake, game_info);
     GDI_Draw.Map_Draw_Cache();
 }
示例#2
0
 private void SYS_Update_Tick(object sender, EventArgs e)
 {
     if (Snake.PH <= 0)
     {
         game_info.Game_State = (int)GDI_Computing_Method.Game_Info.game_state_enum.Lose;
     }
     if (game_info.Game_State == (int)GDI_Computing_Method.Game_Info.game_state_enum.Start)
     {
         GDI_Computing_Method.Snake_ArrayList_WayKey(game_info);
         GDI_Computing_Method.Snake_ArrayList_Update(Snake);
         GDI_Computing_Method.Game_InFo_UpDate(Snake, game_info, food, oe_info);
         GDI_Computing_Method.Snake_Co_MakeUp(Snake);
         GDI_Computing_Method.Food_Co_MakeUp(food);//食物丢送
         Check_Update.Enabled = true;
         GDI_Draw.Board_Draw(GDI_Draw.Board_GP, game_info, Snake);
     }
     else if (game_info.Game_State == (int)GDI_Computing_Method.Game_Info.game_state_enum.Ready)
     {
         GDI_Computing_Method.Snake_ArrayList_WayKey(game_info);
         GDI_Computing_Method.Snake_Co_MakeUp(Snake);
         GDI_Computing_Method.Food_Co_MakeUp(food);//食物丢送
         Check_Update.Enabled = false;
         GDI_Draw.Board_Draw(GDI_Draw.Board_GP, game_info, Snake);
         GDI_Draw.Board_GP.DrawImage(Properties.Resources.game_ready, 0, 0, GDI_Computing_Method.paper_x, GDI_Computing_Method.paper_y);
     }
     else if (game_info.Game_State == (int)GDI_Computing_Method.Game_Info.game_state_enum.Stop)
     {
         GDI_Computing_Method.Snake_ArrayList_WayKey(game_info);
         GDI_Computing_Method.Snake_Co_MakeUp(Snake);
         GDI_Computing_Method.Food_Co_MakeUp(food);//食物丢送
         Check_Update.Enabled = false;
         GDI_Draw.Board_Draw(GDI_Draw.Board_GP, game_info, Snake);
         GDI_Draw.Board_GP.DrawImage(Properties.Resources.info_stop, 0, 0, GDI_Computing_Method.paper_x, GDI_Computing_Method.paper_y);
     }
     else if (game_info.Game_State == (int)GDI_Computing_Method.Game_Info.game_state_enum.Win)
     {
         Check_Update.Enabled = false;
         SYS_Update.Enabled   = false;
         DialogResult dr;
         dr = MessageBox.Show("你赢了,是否再来一局?", "恭喜你", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             Start_Game();
         }
         else
         {
             game_info.Game_State = (int)GDI_Computing_Method.Game_Info.game_state_enum.UnReady;
         }
     }
     else if (game_info.Game_State == (int)GDI_Computing_Method.Game_Info.game_state_enum.Lose)
     {
         Check_Update.Enabled = false;
         SYS_Update.Enabled   = false;
         DialogResult dr;
         dr = MessageBox.Show("你输了,是否再来一局?", "十分抱歉", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             Start_Game();
         }
         else
         {
             game_info.Game_State = (int)GDI_Computing_Method.Game_Info.game_state_enum.UnReady;
         }
     }
 }