コード例 #1
0
 public static void OnActionComplete(DefferedAction action)
 {
     lock (_pendingActions)
     {
         _pendingActions.Remove(action.Key);
     }
 }
コード例 #2
0
        /**********************************************************************************/

        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;
                }
            }
        }