private static GamepadInputHandler NewInputHandler()
        {
            var result = new GamepadInputHandler();

            result.KeyMap.Add(KeyCode.Left, KeyMapItem.ToLeftStick(result.Gamepads.First(), Axis.X, -1));
            result.KeyMap.Add(KeyCode.Right, KeyMapItem.ToLeftStick(result.Gamepads.First(), Axis.X, 1));
            result.KeyMap.Add(KeyCode.Up, KeyMapItem.ToLeftStick(result.Gamepads.First(), Axis.Y, -1));
            result.KeyMap.Add(KeyCode.Down, KeyMapItem.ToLeftStick(result.Gamepads.First(), Axis.Y, 1));

            result.KeyMap.Add(KeyCode.Enter, KeyMapItem.ToButton(result.Gamepads.First(), GamepadButton.Start));
            result.KeyMap.Add(KeyCode.Escape, KeyMapItem.ToButton(result.Gamepads.First(), GamepadButton.Back));

            return(result);
        }
示例#2
0
 void OnSequencePressed(Buffer buffer, KeyMapItem item)
 {
     if (item.value is Method)
     {
         (item.value as Method).Invoke();
     }
     else if (item.value is KeyMap)
     {
         OnPseudoPressed(buffer, item);
     }
     else
     {
         Debug.Log("{" + item.value + "}");                  // Print "Pressed Sequence: N"
     }
 }
示例#3
0
 void OnPseudoPressed(Buffer buffer, KeyMapItem item)
 {
     Debug.Log("{menu:" + item.value + "}");
     textMeshPro.text = MenuTextRenderer.RenderMenu(item.value as KeyMap, 0);
 }
示例#4
0
 void OnSequencePressed(Buffer buffer, KeyMapItem item)
 {
     Debug.Log("{" + item.value + "}");                // Print "Pressed Sequence: N"
 }