public static int SetTimeout(CSLib.Utility.Action <object> closure, float delay, object data = null, int repeatCount = 1) { CTimeTicker timeTicker = new CTimeTicker(delay, repeatCount, data); timeTicker.CompleteFuncData = closure; timeTicker.ATickCompleteFunc = SetTimeoutComplete; timeTicker.Start(); int num = timeTicker.id = ++sTickerID; sTickerMap[num] = timeTicker; return(num); }
public static int SetInterval(CSLib.Utility.Action <object> UpdateFunc, float delay, object data = null) { if (funcList.IndexOf(UpdateFunc) == -1) { funcList.Add(UpdateFunc); CTimeTicker timeTicker = new CTimeTicker(delay, 0, data); timeTicker.TimerFuncData = UpdateFunc; timeTicker.Start(); int num = timeTicker.id = ++sTickerID; sTickerMap[num] = timeTicker; return(num); } throw new Exception("this function couldn't be setInterval twice!"); }