2using System.Collections.Generic;
4using UnityEngine.EventSystems;
7public class EInput : MonoBehaviour
62 action = EAction.AxisUpLeft
67 action = EAction.AxisUpRight
72 action = EAction.AxisDownLeft
77 action = EAction.AxisDownRight
82 action = EAction.MenuJournal
92 action = EAction.MenuInventory
97 action = EAction.MenuAbility
117 action = EAction.AutoCombat
122 action = EAction.EmptyHand
127 action = EAction.MouseLeft
132 action = EAction.MouseRight
137 action = EAction.MouseMiddle
147 action = EAction.QuickSave
152 action = EAction.QuickLoad
157 action = EAction.SwitchHotbar
192 return new List<KeyMap>
194 axisUp,
axisDown,
axisLeft,
axisRight,
axisUpLeft,
axisUpRight,
axisDownLeft,
axisDownRight,
journal,
chara,
195 inventory,
ability,
log,
fire,
wait,
mouseLeft,
mouseMiddle,
mouseRight,
report,
quickSave,
215 public bool Update(
bool forcePress =
false)
217 if (Input.GetKey(
func().key) || forcePress)
319 public static List<ButtonState>
buttons =
new List<ButtonState>();
415 leftMouse.dragMargin = 32f;
416 middleMouse.clickDuration = 0.3f;
418 middleMouse.ignoreWheel =
true;
419 middleMouse.id =
"middle";
420 mouse3.clickDuration = 0.3f;
422 mouse4.clickDuration = 0.3f;
427 clickCriteria = ButtonState.ClickCriteria.ByDuration
461 Input.imeCompositionMode = (on ? IMECompositionMode.On : IMECompositionMode.Off);
466 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
467 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
468 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
480 mpos = Input.mousePosition;
481 if ((
bool)Camera.main)
490 if (!Application.isFocused)
494 GameObject gameObject = EventSystem.current?.currentSelectedGameObject;
495 if ((
bool)gameObject && gameObject.activeInHierarchy)
503 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
504 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
505 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
515 if (!Input.inputString.IsEmpty() ||
IsAnyKeyDown(includeAxis:
true, _skipframe:
false))
529 if (Input.GetKey(
keys.
wait.
key) || Input.GetKey(KeyCode.Keypad5))
553 if (Input.GetMouseButtonDown(0))
558 if (Input.GetMouseButtonDown(1))
563 rightMouse.consumed =
false;
576 float num = Input.GetAxis(
"Mouse ScrollWheel");
577 wheel = ((num < 0f) ? (-1) : ((num > 0f) ? 1 : 0));
578 if (Input.GetKeyDown(KeyCode.PageUp))
582 if (Input.GetKeyDown(KeyCode.PageDown))
594 if (
axis == Vector2.zero)
619 public static bool IsAnyKeyDown(
bool includeAxis =
true,
bool _skipframe =
true)
629 if (includeAxis &&
axis != Vector2.zero)
640 for (
int i = 97; i < 122; i++)
642 if (Input.GetKey(i.ToEnum<KeyCode>()))
658 Consume(consumeAxis:
false, _skipFrame);
661 public static void Consume(
bool consumeAxis =
false,
int _skipFrame = 1)
731 if (Input.GetKey(
keys.
axisUp.
key) || Input.GetKey(KeyCode.UpArrow))
735 if (Input.GetKey(
keys.
axisDown.
key) || Input.GetKey(KeyCode.DownArrow))
739 if (Input.GetKey(
keys.
axisLeft.
key) || Input.GetKey(KeyCode.LeftArrow))
748 if (
axis == Vector2.zero)
750 if (Input.GetKey(KeyCode.Keypad8))
754 if (Input.GetKey(KeyCode.Keypad2))
758 if (Input.GetKey(KeyCode.Keypad4))
762 if (Input.GetKey(KeyCode.Keypad6))
783 if (Input.GetKey(KeyCode.Keypad1))
787 if (Input.GetKey(KeyCode.Keypad3))
791 if (Input.GetKey(KeyCode.Keypad7))
795 if (Input.GetKey(KeyCode.Keypad9))
815 if (Input.GetKey(KeyCode.LeftAlt) && (
axis.x == 0f ||
axis.y == 0f))
830 if (!(
axis == Vector2.zero))
837 else if (
axis == Vector2.zero)
844 axisDiagonal.x =
axis.x;
845 axisDiagonal.y =
axis.y;
860 if (
axis == Vector2.zero)
875 if (
axis != Vector2.zero)
898 if (Input.GetKeyDown(KeyCode.Alpha1))
902 else if (Input.GetKeyDown(KeyCode.Alpha2))
906 else if (Input.GetKeyDown(KeyCode.Alpha3))
910 else if (Input.GetKeyDown(KeyCode.Alpha4))
914 else if (Input.GetKeyDown(KeyCode.Alpha5))
918 else if (Input.GetKeyDown(KeyCode.Alpha6))
922 else if (Input.GetKeyDown(KeyCode.Alpha7))
926 else if (Input.GetKeyDown(KeyCode.Alpha8))
930 else if (Input.GetKeyDown(KeyCode.Alpha9))
940 if (Input.GetKeyDown(KeyCode.F1))
944 else if (Input.GetKeyDown(KeyCode.F2))
948 else if (Input.GetKeyDown(KeyCode.F3))
952 else if (Input.GetKeyDown(KeyCode.F4))
956 else if (Input.GetKeyDown(KeyCode.F5))
960 else if (Input.GetKeyDown(KeyCode.F6))
964 else if (Input.GetKeyDown(KeyCode.F7))
968 else if (Input.GetKeyDown(KeyCode.F8))
978 if (Input.GetKey(KeyCode.Alpha1))
982 else if (Input.GetKey(KeyCode.Alpha2))
986 else if (Input.GetKey(KeyCode.Alpha3))
990 else if (Input.GetKey(KeyCode.Alpha4))
994 else if (Input.GetKey(KeyCode.Alpha5))
998 else if (Input.GetKey(KeyCode.Alpha6))
1002 else if (Input.GetKey(KeyCode.Alpha7))
1006 else if (Input.GetKey(KeyCode.Alpha8))
1010 else if (Input.GetKey(KeyCode.Alpha9))
1019 string inputString = Input.inputString;
1020 if (Input.GetKeyDown(KeyCode.Escape))
1024 if (Input.GetKeyDown(
keys.
wait.
key) || Input.GetKey(KeyCode.Keypad5))
1103 if (!(inputString ==
"?"))
1105 if (inputString ==
"g")