Exemple #1
0
        public KeyCode LoadAction()
        {
            InputAction action = InputManager.GetAction(this.inputActions[0].actionId, this.inputActions[0].contextId);

            return((this.id < action.keys.Length) ? action.keys[this.id] : KeyCode.None);
        }
 private void SaveKeys(InputAction action, int id, KeyCode keyCode)
 {
     PlayerPrefs.SetString(this.GeneratePersistentKey(action, id), keyCode.ToString());
 }
 public void RegisterDefaultInputAction(InputAction action)
 {
     this.RegisterInputAction(action);
 }
 private void LoadInputAction(InputAction inputAction)
 {
     this.LoadSavedKey(inputAction, 0);
     this.LoadSavedKey(inputAction, 1);
 }
 private string GeneratePersistentKey(InputAction action, int id) =>
 action.contextId.ToString() + action.actionId + id;
 public bool CheckAction(string actionName)
 {
     if (!this.Suspended)
     {
         HashSet <string> .Enumerator enumerator = this.activeContexts.GetEnumerator();
         while (enumerator.MoveNext())
         {
             string current = enumerator.Current;
             HashSet <InputAction> .Enumerator enumerator2 = this.contextToActions[current].GetEnumerator();
             while (enumerator2.MoveNext())
             {
                 InputAction action = enumerator2.Current;
                 if (action.actionId.actionName == actionName)
                 {
                     KeyCode[] codeArray = action.keys;
                     int       length    = codeArray.Length;
                     int       index     = 0;
                     while (true)
                     {
                         if (index >= length)
                         {
                             MultiKeys[] multiKeys = action.multiKeys;
                             int         num3      = multiKeys.Length;
                             for (int i = 0; i < num3; i++)
                             {
                                 MultiKeys keys = multiKeys[i];
                                 codeArray = keys.keys;
                                 length    = codeArray.Length;
                                 if (length > 0)
                                 {
                                     bool flag = true;
                                     int  num5 = 0;
                                     while (true)
                                     {
                                         if (num5 >= length)
                                         {
                                             if (!flag)
                                             {
                                                 break;
                                             }
                                             return(true);
                                         }
                                         flag &= this.keysPressed.Contains((int)codeArray[num5]);
                                         num5++;
                                     }
                                 }
                             }
                             break;
                         }
                         if (this.keysPressed.Contains((int)codeArray[index]))
                         {
                             return(true);
                         }
                         index++;
                     }
                 }
             }
         }
         HashSet <InputAction> .Enumerator enumerator3 = this.pendingActions.GetEnumerator();
         while (enumerator3.MoveNext())
         {
             InputAction current = enumerator3.Current;
             if (current.actionId.actionName == actionName)
             {
                 return(true);
             }
         }
     }
     return(false);
 }