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