示例#1
0
 public override void ToRight(BaseGround bg, int a, int b)
 {
     /*  saveY++;
      * if (!JudgeRight(bg, a, b))
      * saveY--;*/
     y++;
 }
示例#2
0
 public override void ToDown(BaseGround bg, int a, int b)
 {
     /* saveX++;
      * if (JudgeTodown(bg, a, b))
      *   saveX--;*/
     x++;
 }
示例#3
0
        public void Timer_Elapsed(object source, System.Timers.ElapsedEventArgs e)
        {
            if (replay == true)
            {
                bs = GetSqureRandom();
                bs.InitSqure();

                bswait = GetSqureRandom();
                bswait.InitSqure();

                one        = new BaseGround(25, 30);
                one.bswait = bswait;
                one.InitBackground();
                one.Sum(bs);
                replay = false;
            }
            if (one.AutoChange(bs, 1))
            {
                autodown = true;
            }

            if (one.changebool == true)
            {
                // Console.WriteLine("切换");
                bs     = bswait;
                bswait = GetSqureRandom();//下一个图形
                bswait.InitSqure();
                one.bswait = bswait;
                one.RemenberGround();   //记住背景坐标
                one.Sum(bs);
                one.changebool = false; //判断置假
            }
        }
示例#4
0
 public override void ToLeft(BaseGround bg, int a, int b)
 {
     saveY--;
     if (!JudgeLeft(bg, a, b))
     {
         saveY++;
     }
 }
示例#5
0
 public override void ToRight(BaseGround bg, int a, int b)
 {
     saveY++;
     if (!JudgeRight(bg, a, b))
     {
         saveY--;
     }
 }
示例#6
0
 public override void ToLeft(BaseGround bg, int a, int b)
 {/*
   *     saveY--;
   * if (!JudgeLeft(bg, a, b))
   *     saveY++;
   */
     y--;
 }
示例#7
0
 public override void ToDown(BaseGround bg, int a, int b)
 {
     saveX++;
     if (JudgeTodown(bg, a, b))
     {
         saveX--;
     }
 }
示例#8
0
 public override void Revolve(BaseGround bg, int a, int b)
 {
     if (count == 0)
     {
         for (int i = 1; i < a - 1; i++)
         {
             for (int j = 1; j < b / 2 + 1; j++)
             {
                 if (bg[i, j] == 1)
                 {
                     if (bg[i, j - 1] == 0 && bg[i + 2, j] == 0)
                     {
                         count = 1;
                         Refresh();
                         str[0, 0] = 1;
                         str[1, 0] = 1;
                         str[1, 1] = 1;
                         str[2, 1] = 1;
                         return;
                     }
                     else
                     {
                         return;
                     }
                 }
             }
         }
     }
     else
     {
         for (int i = 1; i < a - 1; i++)
         {
             for (int j = 1; j < b / 2 + 1; j++)
             {
                 if (bg[i, j] == 1)
                 {
                     if (bg[i, j + 1] == 0 && bg[i + 2, j] == 0)
                     {
                         count = 0;
                         Refresh();
                         str[0, 1] = 1;
                         str[1, 0] = 1;
                         str[1, 1] = 1;
                         str[2, 0] = 1;
                         return;
                     }
                     else
                     {
                         return;
                     }
                 }
             }
         }
     }
 }
示例#9
0
 public override bool JudgeCreate(BaseGround bg, int x, int y)
 {
     for (int j = 1; j < y; j++)
     {
         for (int i = x - 2; i > 0; i--)
         {
             if (bg[i, j] == 1 && bg[i + 1, j] != 0)
             {
                 return(true);
             }
             else if (bg[i, j] == 1 && bg[i + 1, j] == 0)
             {
                 break;
             }
         }
     }
     return(false);
 }
示例#10
0
 public override bool JudgeRight(BaseGround bg, int x, int y)
 {
     for (int i = 1; i < x - 1; i++)
     {
         for (int j = y / 2; j > 0; j--)
         {
             if (bg[i, j] == 1 && bg[i, j + saveY] == 0)
             {
                 break;
             }
             else if (bg[i, j] == 1 && bg[i, j + saveY] != 0)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
示例#11
0
 public override bool JudgeTodown(BaseGround bg, int x, int y)
 {
     for (int j = 1; j < y / 2 + 1; j++)
     {
         for (int i = x - 3; i > 0; i--)
         {
             if (bg[i, j + saveY] == 1 && bg[i + saveX + 1, j + saveY] != 0)
             {
                 return(true);
             }
             else if (bg[i, j + saveY] == 1 && bg[i + saveX + 1, j + saveY] == 0)
             {
                 break;
             }
         }
     }
     return(false);
 }
示例#12
0
 public override void Revolve(BaseGround bg, int a, int b)
 {
     if (count == 1)
     {
         for (int i = 1; i < a - 1; i++)
         {
             for (int j = 1; j < b / 2 + 1; j++)
             {
                 if (bg[i, j] == 1 && bg[i, j + 1] == 0 && bg[i, j + 2] == 0 && bg[i, j + 3] == 0)
                 {
                     Refresh();
                     count     = 0;
                     str[0, 0] = 1;
                     str[0, 1] = 1;
                     str[0, 2] = 1;
                     str[0, 3] = 1;
                 }
             }
         }
     }
     else
     {
         for (int i = 1; i < a - 3; i++)
         {
             for (int j = 1; j < b / 2 + 1; j++)
             {
                 if (bg[i, j] == 1 && bg[i + 1, j + 1] == 0 && bg[i + 2, j] == 0 && bg[i + 3, j] == 0)
                 {
                     Refresh();
                     count     = 1;
                     str[0, 0] = 1;
                     str[1, 0] = 1;
                     str[2, 0] = 1;
                     str[3, 0] = 1;
                 }
             }
         }
     }
 }
示例#13
0
        public void StartGame()
        {
            bs = GetSqureRandom();
            bs.InitSqure();

            bswait = GetSqureRandom();
            bswait.InitSqure();

            one        = new BaseGround(25, 30);
            one.bswait = bswait;
            one.InitBackground();
            one.Sum(bs);

            keyDownThread = new Thread(KeyDownThread);
            KeyDown      += new KeyDownEventHander(KeyDownEnvent);
            keyDownThread.Start();


            timer          = new System.Timers.Timer(1000); //定时器
            timer.Elapsed += Timer_Elapsed;
            timer.Start();                                  //1s一次
        }
示例#14
0
        public override void Revolve(BaseGround bg, int a, int b)
        {
            count++;
            switch (count % 4)
            {
            case 0:
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i, j] == 1)
                        {
                            if (bg[i + 1, j + 1] == 0)
                            {
                                Refresh();
                                str[2, 1] = 0;
                                return;
                            }
                            else
                            {
                                count--;
                                return;
                            }
                        }
                    }
                }
                ; break;

            case 1:
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i, j] == 1)
                        {
                            if (bg[i + 2, j] == 0)
                            {
                                Refresh();
                                str[1, 0] = 0;
                                return;
                            }
                            else
                            {
                                count--;
                                return;
                            }
                        }
                    }
                }
                ; break;

            case 2:
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i, j] == 1)
                        {
                            if (bg[i + 1, j - 1] == 0)
                            {
                                Refresh();
                                str[0, 1] = 0;
                                return;
                            }
                            else
                            {
                                count--;
                                return;
                            }
                        }
                    }
                }
                ; break;

            case 3:
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i - 1, j + 1] == 1)
                        {
                            if (bg[i + 1, j - 1] == 0)
                            {
                                Refresh();
                                str[1, 2] = 0;
                                return;
                            }
                            else
                            {
                                count--;
                                return;
                            }
                        }
                    }
                }
                ; break;

            default:
                break;
            }
        }
示例#15
0
        public override void Revolve(BaseGround bg, int a, int b)
        {
            if (count == 0)
            {
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i, j] == 1)
                        {
                            if (bg[i, j + 2] == 0 && bg[i + 1, j] == 0)
                            {
                                Console.WriteLine(bg[i, j]);
                                Console.WriteLine(bg[i, j + 2]);
                                Console.WriteLine(bg[i + 1, j]);

                                count = 1;
                                Refresh();
                                str[0, 1] = 1;
                                str[0, 2] = 1;
                                str[1, 0] = 1;
                                str[1, 1] = 1;
                                return;
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }
            }
            else
            {
                for (int i = 1; i < a - 1; i++)
                {
                    for (int j = 1; j < b / 2 + 1; j++)
                    {
                        if (bg[i, j] == 1)
                        {
                            if (bg[i, j - 1] == 0 && bg[i + 1, j + 1] == 0)
                            {
                                Console.WriteLine(bg[i, j]);
                                Console.WriteLine(bg[i, j - 1]);
                                Console.WriteLine(bg[i + 1, j + 2]);
                                count = 0;
                                Refresh();
                                str[0, 0] = 1;
                                str[0, 1] = 1;
                                str[1, 1] = 1;
                                str[1, 2] = 1;
                                return;
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }
            }
        }
示例#16
0
 public override void Revolve(BaseGround bg, int a, int b)
 {
 }
示例#17
0
 public abstract void InitSqure();                              //初始化
 public abstract void Revolve(BaseGround bg, int x, int y);     //旋转
示例#18
0
 public abstract void Revolve(BaseGround bg, int x, int y);     //旋转
 public abstract void ToLeft(BaseGround bg, int x, int y);      //左移
示例#19
0
 public abstract void ToLeft(BaseGround bg, int x, int y);      //左移
 public abstract void ToRight(BaseGround bg, int x, int y);     //右移
示例#20
0
 public abstract void ToRight(BaseGround bg, int x, int y);     //右移
 public abstract void ToDown(BaseGround bg, int x, int y);      //加速
示例#21
0
 public abstract void AutoDown();                               //自动下落
 public abstract bool JudgeCreate(BaseGround bg, int x, int y); //判断是否继续下落
示例#22
0
 public abstract bool JudgeCreate(BaseGround bg, int x, int y); //判断是否继续下落
 public abstract bool JudgeLeft(BaseGround bg, int x, int y);
示例#23
0
 public abstract bool JudgeRight(BaseGround bg, int x, int y);
示例#24
0
 public abstract bool JudgeTodown(BaseGround bg, int x, int y);