public bool Remove(long eventTypeId, Delegate callback, CallbackPhase phase) { bool result; for (int i = 0; i < this.m_List.Count; i++) { bool flag = this.m_List[i].IsEquivalentTo(eventTypeId, callback, phase); if (flag) { this.m_List.RemoveAt(i); bool flag2 = phase == CallbackPhase.TrickleDownAndTarget; if (flag2) { int num = this.trickleDownCallbackCount; this.trickleDownCallbackCount = num - 1; } else { bool flag3 = phase == CallbackPhase.TargetAndBubbleUp; if (flag3) { int num = this.bubbleUpCallbackCount; this.bubbleUpCallbackCount = num - 1; } } result = true; return(result); } } result = false; return(result); }
internal bool TryGetUserArgs <TEventType, TCallbackArgs>(EventCallback <TEventType, TCallbackArgs> callback, TrickleDown useTrickleDown, out TCallbackArgs userArgs) where TEventType : EventBase <TEventType>, new() { userArgs = default(TCallbackArgs); bool flag = callback == null; bool result; if (flag) { result = false; } else { EventCallbackList callbackListForReading = this.GetCallbackListForReading(); long eventTypeId = EventBase <TEventType> .TypeId(); CallbackPhase phase = (useTrickleDown == TrickleDown.TrickleDown) ? CallbackPhase.TrickleDownAndTarget : CallbackPhase.TargetAndBubbleUp; EventCallbackFunctor <TEventType, TCallbackArgs> eventCallbackFunctor = callbackListForReading.Find(eventTypeId, callback, phase) as EventCallbackFunctor <TEventType, TCallbackArgs>; bool flag2 = eventCallbackFunctor == null; if (flag2) { result = false; } else { userArgs = eventCallbackFunctor.userArgs; result = true; } } return(result); }
protected bool PhaseMatches(EventBase evt) { CallbackPhase phase = this.phase; CallbackPhase callbackPhase = phase; bool result; if (callbackPhase != CallbackPhase.TargetAndBubbleUp) { if (callbackPhase == CallbackPhase.TrickleDownAndTarget) { bool flag = evt.propagationPhase != PropagationPhase.TrickleDown && evt.propagationPhase != PropagationPhase.AtTarget; if (flag) { result = false; return(result); } } } else { bool flag2 = evt.propagationPhase != PropagationPhase.AtTarget && evt.propagationPhase != PropagationPhase.BubbleUp; if (flag2) { result = false; return(result); } } result = true; return(result); }
public void RegisterCallback <TEventType, TCallbackArgs>(EventCallback <TEventType, TCallbackArgs> callback, TCallbackArgs userArgs, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase <TEventType>, new() { bool flag = callback == null; if (flag) { throw new ArgumentException("callback parameter is null"); } long eventTypeId = EventBase <TEventType> .TypeId(); CallbackPhase phase = (useTrickleDown == TrickleDown.TrickleDown) ? CallbackPhase.TrickleDownAndTarget : CallbackPhase.TargetAndBubbleUp; EventCallbackList eventCallbackList = this.GetCallbackListForReading(); bool flag2 = eventCallbackList != null; if (flag2) { EventCallbackFunctor <TEventType, TCallbackArgs> eventCallbackFunctor = eventCallbackList.Find(eventTypeId, callback, phase) as EventCallbackFunctor <TEventType, TCallbackArgs>; bool flag3 = eventCallbackFunctor != null; if (flag3) { eventCallbackFunctor.userArgs = userArgs; return; } } eventCallbackList = this.GetCallbackListForWriting(); eventCallbackList.Add(new EventCallbackFunctor <TEventType, TCallbackArgs>(callback, userArgs, phase)); }
public bool Contains(long eventTypeId, Delegate callback, CallbackPhase phase) { for (int i = 0; i < m_List.Count; i++) { if (m_List[i].IsEquivalentTo(eventTypeId, callback, phase)) { return(true); } } return(false); }
public EventCallbackFunctorBase Find(long eventTypeId, Delegate callback, CallbackPhase phase) { for (int i = 0; i < m_List.Count; i++) { if (m_List[i].IsEquivalentTo(eventTypeId, callback, phase)) { return(m_List[i]); } } return(null); }
public void RegisterCallback <TEventType, TCallbackArgs>(EventCallback <TEventType, TCallbackArgs> callback, TCallbackArgs userArgs, Capture useCapture = Capture.NoCapture) where TEventType : EventBase <TEventType>, new() { long eventTypeId = EventBase <TEventType> .TypeId(); CallbackPhase phase = (useCapture != Capture.Capture) ? CallbackPhase.TargetAndBubbleUp : CallbackPhase.CaptureAndTarget; if (this.ShouldRegisterCallback(eventTypeId, callback, phase)) { EventCallbackList callbackListForWriting = this.GetCallbackListForWriting(); callbackListForWriting.Add(new EventCallbackFunctor <TEventType, TCallbackArgs>(callback, userArgs, phase)); } }
public bool Contains(long eventTypeId, Delegate callback, CallbackPhase phase) { bool result; for (int i = 0; i < this.m_List.Count; i++) { if (this.m_List[i].IsEquivalentTo(eventTypeId, callback, phase)) { result = true; return(result); } } result = false; return(result); }
private bool ShouldRegisterCallback(long eventTypeId, Delegate callback, CallbackPhase phase) { bool result; if (callback == null) { result = false; } else { EventCallbackList callbackListForReading = this.GetCallbackListForReading(); result = (callbackListForReading == null || !callbackListForReading.Contains(eventTypeId, callback, phase)); } return(result); }
public EventCallbackFunctorBase Find(long eventTypeId, Delegate callback, CallbackPhase phase) { EventCallbackFunctorBase result; for (int i = 0; i < this.m_List.Count; i++) { bool flag = this.m_List[i].IsEquivalentTo(eventTypeId, callback, phase); if (flag) { result = this.m_List[i]; return(result); } } result = null; return(result); }
private bool UnregisterCallback(long eventTypeId, Delegate callback, Capture useCapture) { bool result; if (callback == null) { result = false; } else { EventCallbackList callbackListForWriting = this.GetCallbackListForWriting(); CallbackPhase phase = (useCapture != Capture.Capture) ? CallbackPhase.TargetAndBubbleUp : CallbackPhase.CaptureAndTarget; result = callbackListForWriting.Remove(eventTypeId, callback, phase); } return(result); }
bool ShouldRegisterCallback(long eventTypeId, Delegate callback, CallbackPhase phase) { if (callback == null) { return(false); } EventCallbackList callbackList = GetCallbackListForReading(); if (callbackList != null) { return(!callbackList.Contains(eventTypeId, callback, phase)); } return(true); }
private bool UnregisterCallback(long eventTypeId, Delegate callback, TrickleDown useTrickleDown) { bool flag = callback == null; bool result; if (flag) { result = false; } else { EventCallbackList callbackListForWriting = this.GetCallbackListForWriting(); CallbackPhase phase = (useTrickleDown == TrickleDown.TrickleDown) ? CallbackPhase.TrickleDownAndTarget : CallbackPhase.TargetAndBubbleUp; result = callbackListForWriting.Remove(eventTypeId, callback, phase); } return(result); }
protected bool PhaseMatches(EventBase evt) { CallbackPhase phase = this.phase; if (phase != CallbackPhase.CaptureAndTarget) { if (phase == CallbackPhase.TargetAndBubbleUp) { if (evt.propagationPhase != PropagationPhase.AtTarget && evt.propagationPhase != PropagationPhase.BubbleUp) { return(false); } } } else if (evt.propagationPhase != PropagationPhase.Capture && evt.propagationPhase != PropagationPhase.AtTarget) { return(false); } return(true); }
public void RegisterCallback <TEventType>(EventCallback <TEventType> callback, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase <TEventType>, new() { bool flag = callback == null; if (flag) { throw new ArgumentException("callback parameter is null"); } long eventTypeId = EventBase <TEventType> .TypeId(); CallbackPhase phase = (useTrickleDown == TrickleDown.TrickleDown) ? CallbackPhase.TrickleDownAndTarget : CallbackPhase.TargetAndBubbleUp; EventCallbackList eventCallbackList = this.GetCallbackListForReading(); bool flag2 = eventCallbackList == null || !eventCallbackList.Contains(eventTypeId, callback, phase); if (flag2) { eventCallbackList = this.GetCallbackListForWriting(); eventCallbackList.Add(new EventCallbackFunctor <TEventType>(callback, phase)); } }
public bool Remove(long eventTypeId, Delegate callback, CallbackPhase phase) { for (int i = 0; i < this.m_List.Count; i++) { if (this.m_List[i].IsEquivalentTo(eventTypeId, callback, phase)) { this.m_List.RemoveAt(i); if (phase == CallbackPhase.CaptureAndTarget) { this.capturingCallbackCount--; } else if (phase == CallbackPhase.TargetAndBubbleUp) { this.bubblingCallbackCount--; } return(true); } } return(false); }
public bool Remove(long eventTypeId, Delegate callback, CallbackPhase phase) { for (int i = 0; i < m_List.Count; i++) { if (m_List[i].IsEquivalentTo(eventTypeId, callback, phase)) { m_List.RemoveAt(i); if (phase == CallbackPhase.TrickleDownAndTarget) { trickleDownCallbackCount--; } else if (phase == CallbackPhase.TargetAndBubbleUp) { bubbleUpCallbackCount--; } return(true); } } return(false); }
protected EventCallbackFunctorBase(CallbackPhase phase) { this.phase = phase; }
public abstract bool IsEquivalentTo(long eventTypeId, Delegate callback, CallbackPhase phase);
protected EventCallbackFunctorBase(CallbackPhase phase, InvokePolicy invokePolicy) { this.phase = phase; this.invokePolicy = invokePolicy; }
public EventCallbackFunctor(EventCallback <TEventType> callback, CallbackPhase phase, InvokePolicy invokePolicy = default) : base(phase, invokePolicy) { m_Callback = callback; m_EventTypeId = EventBase <TEventType> .TypeId(); }
public EventCallbackFunctor(EventCallback <TEventType, TCallbackArgs> callback, TCallbackArgs userArgs, CallbackPhase phase) : base(phase) { this.m_Callback = callback; this.m_UserArgs = userArgs; this.m_EventTypeId = EventBase <TEventType> .TypeId(); }
public EventCallbackFunctor(EventCallback <TEventType> callback, CallbackPhase phase) : base(phase) { m_Callback = callback; m_EventTypeId = EventBase <TEventType> .TypeId(); }
public override bool IsEquivalentTo(long eventTypeId, Delegate callback, CallbackPhase phase) { return(this.m_EventTypeId == eventTypeId && this.m_Callback == callback && base.phase == phase); }
public override bool IsEquivalentTo(long eventTypeId, Delegate callback, CallbackPhase phase) { return((m_EventTypeId == eventTypeId) && ((Delegate)m_Callback) == callback && (this.phase == phase)); }
public bool Contains(long eventTypeId, Delegate callback, CallbackPhase phase) { return(this.Find(eventTypeId, callback, phase) != null); }