Exemple #1
0
 public void InvokePrivate(IPrivateEventDispatchable ctx, string Event, object param = null, bool allowLateListeners = false)
 {
     InvokeSet.Enqueue(Tuple._(PrivateEvent(ctx, Event), param, allowLateListeners));
 }
Exemple #2
0
 public string PrivateEvent(IPrivateEventDispatchable obj, string Event)
 {
     return(PrivateEvent(obj.instanceId(), Event));
 }
Exemple #3
0
        public static int AddEventListenerWhenActiveAndEnabledPvt(
            this MonoBehaviour mb, string Event, Lambda listener, bool persistent = false, IPrivateEventDispatchable context = null)
        {
            Event = context == null ? Event : EventRegistry.instance.PrivateEvent(context, Event);
            ReturnState persistence = persistent ? ReturnState.Keep : ReturnState.Done;

            return(EventRegistry.instance.AddEventListener(Event, new CheckActive(mb, listener, persistent).whenActiveAndDisabled));
        }
Exemple #4
0
 public static int AddEventListenerWhenActiveAndEnabledPvt(this MonoBehaviour mb, string Event, EventRegistry.Callback listener, IPrivateEventDispatchable context)
 {
     Event = context == null ? Event : EventRegistry.instance.PrivateEvent(context, Event);
     return(EventRegistry.instance.AddEventListener(Event, new CheckActive(mb, listener).whenActiveAndDisabled));
 }
Exemple #5
0
        public static int AddEventListenerWhenActiveAndEnabledPvt <T>(
            this MonoBehaviour mb, string Event, System.Action <T> listener, bool persistent, IPrivateEventDispatchable context
            )
        {
            Event = (context == null) ? Event : EventRegistry.instance.PrivateEvent(context, Event);
            Debug.Log("Event: " + Event);
            ReturnState persistence = persistent ? ReturnState.Keep : ReturnState.Done;

            return(EventRegistry.instance.AddEventListener(Event, (object t) =>
            {
                if (mb == null)
                {
                    return ReturnState.Done;
                }
                if (mb.isActiveAndEnabled)
                {
                    listener((T)t);
                    return persistence;
                }
                else
                {
                    return ReturnState.Keep;
                }
            }));
        }