Exemplo n.º 1
0
 public override void ToRight(BaseGround bg, int a, int b)
 {
     /*  saveY++;
      * if (!JudgeRight(bg, a, b))
      * saveY--;*/
     y++;
 }
Exemplo n.º 2
0
 public override void ToDown(BaseGround bg, int a, int b)
 {
     /* saveX++;
      * if (JudgeTodown(bg, a, b))
      *   saveX--;*/
     x++;
 }
Exemplo n.º 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; //判断置假
            }
        }
Exemplo n.º 4
0
 public override void ToLeft(BaseGround bg, int a, int b)
 {
     saveY--;
     if (!JudgeLeft(bg, a, b))
     {
         saveY++;
     }
 }
Exemplo n.º 5
0
 public override void ToRight(BaseGround bg, int a, int b)
 {
     saveY++;
     if (!JudgeRight(bg, a, b))
     {
         saveY--;
     }
 }
Exemplo n.º 6
0
 public override void ToLeft(BaseGround bg, int a, int b)
 {/*
   *     saveY--;
   * if (!JudgeLeft(bg, a, b))
   *     saveY++;
   */
     y--;
 }
Exemplo n.º 7
0
 public override void ToDown(BaseGround bg, int a, int b)
 {
     saveX++;
     if (JudgeTodown(bg, a, b))
     {
         saveX--;
     }
 }
Exemplo n.º 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;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
                 }
             }
         }
     }
 }
Exemplo n.º 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一次
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
 public override void Revolve(BaseGround bg, int a, int b)
 {
 }
Exemplo n.º 17
0
 public abstract void InitSqure();                              //初始化
 public abstract void Revolve(BaseGround bg, int x, int y);     //旋转
Exemplo n.º 18
0
 public abstract void Revolve(BaseGround bg, int x, int y);     //旋转
 public abstract void ToLeft(BaseGround bg, int x, int y);      //左移
Exemplo n.º 19
0
 public abstract void ToLeft(BaseGround bg, int x, int y);      //左移
 public abstract void ToRight(BaseGround bg, int x, int y);     //右移
Exemplo n.º 20
0
 public abstract void ToRight(BaseGround bg, int x, int y);     //右移
 public abstract void ToDown(BaseGround bg, int x, int y);      //加速
Exemplo n.º 21
0
 public abstract void AutoDown();                               //自动下落
 public abstract bool JudgeCreate(BaseGround bg, int x, int y); //判断是否继续下落
Exemplo n.º 22
0
 public abstract bool JudgeCreate(BaseGround bg, int x, int y); //判断是否继续下落
 public abstract bool JudgeLeft(BaseGround bg, int x, int y);
Exemplo n.º 23
0
 public abstract bool JudgeRight(BaseGround bg, int x, int y);
Exemplo n.º 24
0
 public abstract bool JudgeTodown(BaseGround bg, int x, int y);