Beispiel #1
0
 private static void refreshGlobalKeys(keyObj pressedKey, KeyCode code)
 {
     if (pressedKey.isDown())
     {
         foreach (globalRegisterdCallback call in registerdGlobalKeys)
         {
             call.Invoke(pressedKey.text, code);
         }
     }
 }
Beispiel #2
0
        public static void refreshCallbacks(int keyID, inputTypes inputType)
        {
            KeyCode            key  = getKeyNameByID(keyID);
            List <keyRegister> keys = getAllRegisterdByKey(key);

            keycodes.refreshGlobalKeys(keycodes.keys[key], key);
            if (keys.Count > 0)
            {
                foreach (keyRegister rKey in keys)
                {
                    if (rKey.getKeyInputType() != inputTypes.pressed)
                    {
                        // single event
                        keyObj keyobj = keycodes.keys[key];
                        if (rKey.getKeyInputType() == inputTypes.up || rKey.getKeyInputType() == inputTypes.repeatedUp)
                        {
                            if (keyobj.isUp())
                            {
                                rKey.Invoke();
                            }
                        }
                        else
                        {
                            if (keyobj.isDown())
                            {
                                rKey.Invoke();
                            }
                        }
                    }
                    else
                    {
                        // is pressed
                        if (inputType == inputTypes.down)
                        {
                            rKey.Invoke();
                        }
                    }
                }
                cleanListOf(key, inputType);
            }
            if (inputType == inputTypes.up)
            {
                reopenMultipleCallbacks(key);
            }
            // last
            refreshMultipleCallbacks();
        }