public static void OnActionComplete(DefferedAction action) { lock (_pendingActions) { _pendingActions.Remove(action.Key); } }
/**********************************************************************************/ public static void Run(int delayMilliseconds, Action action, [CallerFilePath] string instanceKey = null) { DefferedAction inst = null; lock (_pendingActions) { _pendingActions.TryGetValue(instanceKey, out inst); } if (inst != null) { inst.Update(delayMilliseconds, action); } else { inst = new DefferedAction(delayMilliseconds, instanceKey, action, OnActionComplete); lock (_pendingActions) { _pendingActions[instanceKey] = inst; } } }