Beispiel #1
0
 public void Subscribe(object eventType, EventRegistry.SubscriberCallback newSubscriber)
 {
     EventRegistry.EventSubscription eventSubscription;
     if (this._eventSubscriptions.ContainsKey(eventType))
     {
         eventSubscription = this._eventSubscriptions[eventType];
     }
     else
     {
         eventSubscription = new EventRegistry.EventSubscription();
         this._eventSubscriptions[eventType] = eventSubscription;
     }
     eventSubscription._callbacks.Add(newSubscriber);
 }
Beispiel #2
0
 public void Unsubscribe(object eventType, EventRegistry.SubscriberCallback unsubscriber)
 {
     if (this._eventSubscriptions.ContainsKey(eventType))
     {
         EventRegistry.EventSubscription eventSubscription = this._eventSubscriptions[eventType];
         if (eventSubscription._publishingEventIndex > -1)
         {
             int num = eventSubscription._callbacks.IndexOf(unsubscriber);
             if (num < eventSubscription._publishingEventIndex)
             {
                 eventSubscription._publishingEventIndex--;
             }
         }
         eventSubscription._callbacks.Remove(unsubscriber);
     }
 }
 private void Awake()
 {
     EventRegistry.Get(this._registry).Subscribe(TfEvent.Get(this._event), new EventRegistry.SubscriberCallback(this.OnEvent));
 }
 private void OnDestroy()
 {
     EventRegistry.Get(this._registry).Unsubscribe(TfEvent.Get(this._event), new EventRegistry.SubscriberCallback(this.OnEvent));
 }
Beispiel #5
0
 public void SendEvent()
 {
     EventRegistry.Get(this._registry).Publish(TfEvent.Get(this._event), this);
 }