Example #1
0
    private void TransformTimeFormat(int time)
    {
        //DateTime.
        TimerUtil.RemoveTimeOutWithCallBack(timerID);
        TimerUtil.RemoveTimeOut(timerID);

        TimeSpan ts    = new TimeSpan(0, 0, time);
        TimeSpan timer = new TimeSpan(0, 0, 1);

        timerID = TimerUtil.SetTimeOut(1f, () => {
            if (isTimePause)
            {
                return;
            }
            ts = ts.Subtract(timer);
            ui_ShowText.text = ts.ToString(@"mm\:ss");
            //Debug.Log($"当前倒计时:{ts.ToString(@"mm\:ss")}");
            if (ts.TotalSeconds <= 0)
            {
                TimerUtil.RemoveTimeOutWithCallBack(timerID);
                TimerUtil.RemoveTimeOut(timerID);
                Debug.Log($"倒计时结束,游戏结束");
                GameCtrl._Ins.EC.OnGameOver(GameCtrl._Ins.CurrPattern, false);
            }
        }, -1);
    }
Example #2
0
 public void StopBornConveyor()
 {
     TimerUtil.RemoveTimeOutWithCallBack(conveyorTimerID);
     TimerUtil.RemoveTimeOut(conveyorTimerID);
 }
Example #3
0
 public void StopBornFood()
 {
     TimerUtil.RemoveTimeOutWithCallBack(foodTimerID);
     TimerUtil.RemoveTimeOut(foodTimerID);
 }