Esempio n. 1
0
 /// <summary>
 /// 添加筛选器
 /// </summary>
 /// <param name="command"></param>
 /// <param name="condition"></param>
 /// <returns></returns>
 public static BaseCommand Fliter(this BaseCommand command, Func <object[], bool> condition)
 {
     command.usePool = true;
     command.conditionListWhenEveryArgIn.Add(condition);
     return(command);
 }
Esempio n. 2
0
 /// <summary>
 /// 获取一个监听下一次事件响应的协程
 /// </summary>
 /// <returns></returns>
 public static ReCoroutineTaskManager.CoroutineTask GetListenLatestCommandCoroutine(this BaseCommand command, Action <bool> callback = null, object bindObject = null)
 {
     return(ReCoroutineTaskManager.Instance.AddTask(DoWaitLatestCommand(command), callback, bindObject));
 }
Esempio n. 3
0
 /// <summary>
 /// 当任意事件传入(未剔除前的)
 /// </summary>
 /// <param name="command"></param>
 /// <param name="onArgIn"></param>
 /// <returns></returns>
 public static BaseCommand OnEveryArgIn(this BaseCommand command, Action onArgIn)
 {
     command.usePool = true;
     command.onEveryArgIn.Add(onArgIn);
     return(command);
 }
Esempio n. 4
0
 /// <summary>
 /// 同一帧中只取最后一条消息
 /// *该功能不支持同步的单提供器*
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public static BaseCommand PoolInOneFrame(this BaseCommand command)
 {
     command.usePool = true;
     return(command.PoolInTime(Time.deltaTime));
 }
Esempio n. 5
0
 /// <summary>
 /// 当销毁的时候执行
 /// </summary>
 /// <param name="command"></param>
 /// <param name="go"></param>
 /// <param name="act"></param>
 /// <returns></returns>
 public static BaseCommand WhenMonobehaviorDestory(this BaseCommand command, GameObject go, Action <BaseCommand> act)
 {
     go.GetCallbacks().onDestroy +=
         () => act(command);
     return(command);
 }
Esempio n. 6
0
 /// <summary>
 /// 出错时进行恢复操作
 /// </summary>
 /// <param name="command"></param>
 /// <param name="onError"></param>
 /// <returns></returns>
 public static BaseCommand OnError(this BaseCommand command, Action <Exception> onError)
 {
     command.onError = onError;
     return(command);
 }
Esempio n. 7
0
 /// <summary>
 /// 当物体销毁时移除监听器
 /// </summary>
 /// <param name="command"></param>
 /// <param name="mono"></param>
 /// <returns></returns>
 public static BaseCommand RemoveWhenDestroy(this BaseCommand command, GameObject go)
 {
     go.GetCallbacks().onDestroy +=
         () => command.StopListen();
     return(command);
 }
Esempio n. 8
0
 /// <summary>
 /// 添加计时器轮询回调
 /// </summary>
 /// <param name="command"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static BaseCommand AddEveryFrameCall(this BaseCommand command, Action everyFrameCall)
 {
     command.usePool = true;
     command.poolTimerAfterFirstClickLoopCall.Add(everyFrameCall);
     return(command);
 }
Esempio n. 9
0
 /// <summary>
 /// 设置为一次性消息
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public static BaseCommand Once(this BaseCommand command)
 {
     command.isOnce = true;
     return(command);
 }
Esempio n. 10
0
 /// <summary>
 /// 添加回调
 /// </summary>
 /// <param name="command"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static BaseCommand AddCallBack(this BaseCommand command, Action callback)
 {
     command.onEndCall.Add(callback);
     return(command);
 }
Esempio n. 11
0
 /// <summary>
 /// 添加预行为
 /// </summary>
 /// <param name="command"></param>
 /// <param name="startcall"></param>
 /// <returns></returns>
 public static BaseCommand AddStartCall(this BaseCommand command, Action startcall)
 {
     command.onStartCall.Add(startcall);
     return(command);
 }