Beispiel #1
0
    private void Update()
    {
        pt.Update();

        //定时替换
        if (Input.GetKeyDown(KeyCode.R))
        {
            bool succ = pt.ReplaceTimeTask(tempID, (int tid) => {
                Debug.Log("定时等待删除......");
            }, 2, PETimeUnit.Second, 0);

            if (succ)
            {
                Debug.Log("替换成功");
            }
        }

        //定时删除
        if (Input.GetKeyDown(KeyCode.D))
        {
            bool succ = pt.DeleteTimeTask(tempID);
            if (succ)
            {
                Debug.Log("删除成功");
            }
        }
    }
Beispiel #2
0
 /// <summary>
 /// 替换一个已经存在的时间定时任务
 /// </summary>
 /// <param name="tid">任务ID</param>
 /// <param name="callback">回调</param>
 /// <param name="delayTime">延时时间</param>
 /// <param name="unit">时间单位(默认毫秒)</param>
 /// <param name="count">循环次数(0循环)</param>
 /// <returns>替换结果</returns>
 public bool ReplaceTimeTask(int tid, Action callback, float delayTime, PETimeUnit unit = PETimeUnit.Millsecond, int count = 1)
 {
     return(timer.ReplaceTimeTask(tid, callback, delayTime, unit, count));
 }
Beispiel #3
0
 public bool ReplaceTimeTask(int tid, Action callback, float delay, int count = 1, PETimeUnit timeUnit = PETimeUnit.Millisecond)
 {
     return(pt.ReplaceTimeTask(tid, callback, delay, count, timeUnit));
 }