예제 #1
0
 public override bool Equals(object obj)
 {
     if (!(obj is Axis2DDelegateKey))
     {
         return(false);
     }
     else
     {
         Axis2DDelegateKey other = (Axis2DDelegateKey)obj;
         return(inputHorizontal.Equals(other.inputHorizontal) && inputVertical.Equals(other.inputVertical));
     }
 }
예제 #2
0
    public static void AddAxis2DDelegate(string inputHorizontal, string inputVertical, Axis2DDelegate axis2DDelegate)
    {
        if (isApplicationQuitting)
        {
            return;
        }

        if (instance == null)
        {
            InstantiateInstance();
        }

        Axis2DDelegateKey key = new Axis2DDelegateKey(inputHorizontal, inputVertical);

        if (!dictAxis2DDelegates.ContainsKey(key))
        {
            dictAxis2DDelegates.Add(key, axis2DDelegate);
        }
        else
        {
            dictAxis2DDelegates[key] += axis2DDelegate;
        }
    }
예제 #3
0
    public static void RemoveAxis2DDelegate(string inputHorizontal, string inputVertical, Axis2DDelegate axis2DDelegate)
    {
        if (isApplicationQuitting || (instance == null))
        {
            return;
        }

        Axis2DDelegateKey key = new Axis2DDelegateKey(inputHorizontal, inputVertical);

        if (dictAxis2DDelegates.ContainsKey(key))
        {
            Axis2DDelegate dictDelegate = dictAxis2DDelegates[key];
            dictDelegate -= axis2DDelegate;

            if (dictDelegate == null)
            {
                dictAxis2DDelegates.Remove(key);
            }
            else
            {
                dictAxis2DDelegates[key] = dictDelegate;
            }
        }
    }