private void Awake() { reviveListener = new LambdaListener(); reviveListener.OnFinish += () => { GameManager.Instance.Player.Revive(); }; }
public void CollectionModifiedRegression() { var source = new object(); var dependent = new LambdaListener(); var secondDependent = new LambdaListener(); dependent.OnNotify = () => { ReactiveManager.Evaluate(secondDependent, () => { ReactiveManager.WasRead(dependent); return(true); }); dependent.OnNotify = null; ReactiveManager.WasChanged(dependent); }; ReactiveManager.Evaluate(dependent, () => { ReactiveManager.WasRead(source); return(true); }); ReactiveManager.WasChanged(source); }
public void once(string eventType, LambdaListener listener) { LambdaListener list = null; list = data => { removeListener(eventType, list); listener(data); }; on(eventType, list, null); }
public void InfiniteRecursionRegression() { var source = new object(); var dependent = new LambdaListener(); dependent.OnNotify = () => ReactiveManager.WasChanged(source); ReactiveManager.Evaluate(dependent, () => { ReactiveManager.WasRead(source); return(true); }); ReactiveManager.WasChanged(source); }
public void removeListener(string eventType, LambdaListener listener) { if (!listeners.ContainsKey(eventType)) { return; } var lists = listeners[eventType]; listeners[eventType] = new List<Listener>(lists.Where(l => l.Item2 != listener)); }
public void on(string eventType, LambdaListener listener) { on(eventType, listener, null); }
private void on(string eventType, LambdaListener lambdaList, IDispatch dispList) { Listener list = Tuple.Create<IDispatch, LambdaListener>(dispList, lambdaList); if (!listeners.ContainsKey(eventType)) { listeners[eventType] = new List<Listener>(); } var lists = listeners[eventType]; lists.Add(list); }