Example #1
0
 private void RemoveCallBack(ref Dictionary <T, EventCallBackFunction> target, T key, EventCallBackFunction cbFunction)
 {
     if (!target.ContainsKey(key))
     {
         return;
     }
     else
     {
         target[key] -= cbFunction;
     }
 }
Example #2
0
 private void AddCallBack(ref Dictionary <T, EventCallBackFunction> target, T key, EventCallBackFunction cbFunction)
 {
     if (!target.ContainsKey(key))
     {
         target.Add(key, cbFunction);
     }
     else
     {
         target[key] += cbFunction;
     }
 }
Example #3
0
    /// <param name="atPoint">-1, 0, 1</param>
    public void RemoveEventCallBackFunction(T key, EventCallBackFunction cbFunction, int atPoint = 0)
    {
        if (atPoint < -1 || atPoint > 1)
        {
            throw new IndexOutOfRangeException("-1 <= atPoint <=1");
        }

        switch (atPoint)
        {
        case -1:
            RemoveCallBack(ref callBackFunctionListBefore, key, cbFunction);
            break;

        case 0:
            RemoveCallBack(ref callBackFunctionList, key, cbFunction);
            break;

        case 1:
            RemoveCallBack(ref callBackFunctionListAfter, key, cbFunction);
            break;
        }
    }