示例#1
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; //判断置假
            }
        }
示例#2
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一次
        }