public static void Delay <T>(this T selfBehaviour, float seconds, System.Action delayEvent) where T : MonoBehaviour { selfBehaviour.ExecuteNode(DelayAction.Allocate(seconds, delayEvent)); }
/// <summary> /// Same as Delayw /// </summary> /// <param name="senfChain"></param> /// <param name="seconds"></param> /// <returns></returns> public static IActionChain Wait(this IActionChain senfChain, float seconds) { return(senfChain.Append(DelayAction.Allocate(seconds))); }
protected override void ProcessMsg(int key, QMsg msg) { Log.I("{0}", msg.EventID); switch (key) { case (ushort)UIFilterEvent.DelayLock: Log.I("receive"); UILockOnClickEventMsg lockOnClickEventMsg = msg as UILockOnClickEventMsg; LockBtnOnClick = true; DelayAction delayAction = new DelayAction(lockOnClickEventMsg.LockTime) { OnEndedCallback = delegate { LockBtnOnClick = false; } }; StartCoroutine(delayAction.Execute()); break; case (ushort)UIFilterEvent.Lock: Log.I("Lock"); Lock = true; break; case (ushort)UIFilterEvent.UnLock: Log.I("UnLock"); Lock = false; break; case (int)UIFilterEvent.LockObjEvent: { UILockObjEventMsg lockObjEventMsg = msg as UILockObjEventMsg; if (null == LockedObj) { LockedObj = lockObjEventMsg.LockedObj; } else if (LockedObj == lockObjEventMsg.LockedObj) { // maybe two finger in one obj Log.W("error: curLockedObj is already seted"); } else if (LockedObj != lockObjEventMsg.LockedObj) { throw new Exception("error: pre obj need unlocked"); } } break; case (int)UIFilterEvent.UnlockObjEvent: { UIUnlockObjEventMsg unlockObjEventMsg = msg as UIUnlockObjEventMsg; if (unlockObjEventMsg.UnlockedObj == LockedObj) { unlockObjEventMsg.UnlockedObj = null; LockedObj = null; } else if (LockedObj == null) { Log.W("error: curLockedObj is already unlocked"); } else if (LockedObj != unlockObjEventMsg.UnlockedObj) { throw new Exception("error: pre obj need unlocked"); } } break; } }