Esempio n. 1
0
 public override bool Equals(object obj)
 {
     if (!(obj is ButtonDelegateKey))
     {
         return(false);
     }
     else
     {
         ButtonDelegateKey other = (ButtonDelegateKey)obj;
         return(inputName.Equals(other.inputName) && axisAsButtonThreshold == other.axisAsButtonThreshold);
     }
 }
Esempio n. 2
0
    public static void RemoveButtonDelegate(string inputName, float axisAsButtonThreshold, ButtonDelegate buttonDelegate)
    {
        if (isApplicationQuitting || (instance == null))
        {
            return;
        }

        ButtonDelegateKey key = new ButtonDelegateKey(inputName, axisAsButtonThreshold);

        if (dictButtonDelegates.ContainsKey(key))
        {
            ButtonDelegateEntry dictEntry = dictButtonDelegates[key];
            dictEntry.buttonDelegate -= buttonDelegate;

            if (dictEntry.buttonDelegate == null)
            {
                dictButtonDelegates.Remove(key);
            }
        }
    }
Esempio n. 3
0
    public static void AddButtonDelegate(string inputName, float axisAsButtonThreshold, ButtonDelegate buttonDelegate)
    {
        if (isApplicationQuitting)
        {
            return;
        }

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

        ButtonDelegateKey key = new ButtonDelegateKey(inputName, axisAsButtonThreshold);

        if (!dictButtonDelegates.ContainsKey(key))
        {
            ButtonDelegateEntry entry = new ButtonDelegateEntry(buttonDelegate);
            dictButtonDelegates.Add(key, entry);
        }
        else
        {
            dictButtonDelegates[key].buttonDelegate += buttonDelegate;
        }
    }