コード例 #1
0
    public void Cleanup()
    {
        if (OnDone == null)
        {
            return;
        }

        foreach (Delegate action in OnDone.GetInvocationList())
        {
            Action handler = action as Action;
            if (handler == null)
            {
                continue;
            }

            OnDone -= handler;
        }
    }
コード例 #2
0
    public void OnFinished(Action actionToTake)
    {
        if (OnDone != null)
        {
            foreach (Delegate action in OnDone.GetInvocationList())
            {
                Action handler = action as Action;
                if (handler == null)
                {
                    continue;
                }
                if (handler == actionToTake)
                {
                    return;
                }
            }
        }

        OnDone += actionToTake;
    }
コード例 #3
0
    public void RemoveOnFinishedAction(Action actionToRemove)
    {
        if (OnDone == null)
        {
            return;
        }

        foreach (Delegate action in OnDone.GetInvocationList())
        {
            Action handler = action as Action;
            if (handler == null)
            {
                continue;
            }
            if (handler != actionToRemove)
            {
                continue;
            }
            OnDone -= actionToRemove;
            return;
        }
    }