// TODO: Also allow stopping invokers by handler? Would need an additional collection invokersByHandler /// <summary> /// This stops the invokers which have the underlying method (not the actual handler itself) /// </summary> /// <param name="method"></param> public static void StopInvokerByMethod(UObject owner, Delegate method) { List <Invoker> invokers; if (method.Method != null && invokersByMethod.TryGetValue(method.Method, out invokers)) { for (int i = invokers.Count; i >= 0; --i) { Invoker invoker = invokers[i]; if ((invoker.Owner as UObject) == owner) { invoker.Stop(); } } } }
public static void StopAllInvokers(UObject owner) { List <Invoker> invokers; if (owner != null && invokersByUObject.TryGetValue(owner, out invokers)) { for (int i = invokers.Count - 1; i >= 0; --i) { Invoker invoker = invokers[i]; invoker.Stop(); } if (invokers.Count == 0) { invokersByUObject.Remove(owner); } } }
public static void StopAllInvokers(UObject owner, bool fullyRemove) { List <Invoker> invokers; if (owner != null && invokersByUObject.TryGetValue(owner, out invokers)) { for (int i = invokers.Count - 1; i >= 0; --i) { Invoker invoker = invokers[i]; invoker.Stop(); } if (fullyRemove) { Debug.Assert(invokers.Count == 0, "Tried to stop all invokers for UObject but there are still some alive"); invokersByUObject.Remove(owner); } } }
public static void StopInvoker(Invoker invoker) { invoker.Stop(); }