コード例 #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);
        }
コード例 #2
0
 private void SaveKeys(InputAction action, int id, KeyCode keyCode)
 {
     PlayerPrefs.SetString(this.GeneratePersistentKey(action, id), keyCode.ToString());
 }
コード例 #3
0
 public void RegisterDefaultInputAction(InputAction action)
 {
     this.RegisterInputAction(action);
 }
コード例 #4
0
 private void LoadInputAction(InputAction inputAction)
 {
     this.LoadSavedKey(inputAction, 0);
     this.LoadSavedKey(inputAction, 1);
 }
コード例 #5
0
 private string GeneratePersistentKey(InputAction action, int id) =>
 action.contextId.ToString() + action.actionId + id;
コード例 #6
0
 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);
 }