Exemplo n.º 1
0
    /// <summary>
    /// 添加Update更新监听
    /// </summary>
    /// <param name="eventEnumType"></param>
    /// <param name="eventName"></param>
    /// <param name="listener"></param>
    public static UpdateEvent_CallBack AddUpdateListener(UpdateEventEnumType eventEnumType, string eventName, UpdateEvent_CallBack listener, OperationModeEnumType operationModeEnum = OperationModeEnumType.NoPause)
    {
        UpdateEvent_CallBack _listener = listener;

        switch (eventEnumType)
        {
        case UpdateEventEnumType.FixedUpdate:
            if (fixedUpdateEvent != null)
            {
                _listener = fixedUpdateEvent.AddListener(eventName, listener, operationModeEnum);
            }
            break;

        case UpdateEventEnumType.Update:
            if (updateEvent != null)
            {
                _listener = updateEvent.AddListener(eventName, listener, operationModeEnum);
            }
            break;

        case UpdateEventEnumType.LateUpdate:
            if (lateUpdateEvent != null)
            {
                _listener = lateUpdateEvent.AddListener(eventName, listener, operationModeEnum);
            }
            break;

        default:
            break;
        }
        return(_listener);
    }
Exemplo n.º 2
0
 public void AddLateUpdateEventListener(UnityAction unityAction)
 {
     lateUpdateEvent.AddListener(unityAction);
 }