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
202 return new List<KeyMap>
204 axisUp,
axisDown,
axisLeft,
axisRight,
axisUpLeft,
axisUpRight,
axisDownLeft,
axisDownRight,
journal,
chara,
205 inventory,
ability,
log,
fire,
chat,
console,
wait,
mouseLeft,
mouseMiddle,
mouseRight,
206 report,
quickSave,
quickLoad,
autoCombat,
emptyHand,
switchHotbar,
examine,
getAll,
dump,
mute,
226 public bool Update(
bool forcePress =
false)
228 if (Input.GetKey(
func().key) || forcePress)
330 public static List<ButtonState>
buttons =
new List<ButtonState>();
426 leftMouse.dragMargin = 32f;
427 middleMouse.clickDuration = 0.3f;
429 middleMouse.ignoreWheel =
true;
430 middleMouse.id =
"middle";
431 mouse3.clickDuration = 0.3f;
433 mouse4.clickDuration = 0.3f;
438 clickCriteria = ButtonState.ClickCriteria.ByDuration
472 Input.imeCompositionMode = (on ? IMECompositionMode.On : IMECompositionMode.Off);
477 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
478 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
479 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
491 mpos = Input.mousePosition;
492 if ((
bool)Camera.main)
501 if (!Application.isFocused)
505 GameObject gameObject = EventSystem.current?.currentSelectedGameObject;
506 if ((
bool)gameObject && gameObject.activeInHierarchy)
514 isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
515 isCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
516 isAltDown = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
526 if (!Input.inputString.IsEmpty() ||
IsAnyKeyDown(includeAxis:
true, _skipframe:
false))
540 if (Input.GetKey(
keys.
wait.
key) || Input.GetKey(KeyCode.Keypad5))
564 if (Input.GetMouseButtonDown(0))
569 if (Input.GetMouseButtonDown(1))
574 rightMouse.consumed =
false;
587 float num = Input.GetAxis(
"Mouse ScrollWheel");
588 wheel = ((num < 0f) ? (-1) : ((num > 0f) ? 1 : 0));
589 if (Input.GetKeyDown(KeyCode.PageUp))
593 if (Input.GetKeyDown(KeyCode.PageDown))
605 if (
axis == Vector2.zero)
630 public static bool IsAnyKeyDown(
bool includeAxis =
true,
bool _skipframe =
true)
640 if (includeAxis &&
axis != Vector2.zero)
651 for (
int i = 97; i < 122; i++)
653 if (Input.GetKey(i.ToEnum<KeyCode>()))
669 Consume(consumeAxis:
false, _skipFrame);
672 public static void Consume(
bool consumeAxis =
false,
int _skipFrame = 1)
742 if (Input.GetKey(
keys.
axisUp.
key) || Input.GetKey(KeyCode.UpArrow))
746 if (Input.GetKey(
keys.
axisDown.
key) || Input.GetKey(KeyCode.DownArrow))
750 if (Input.GetKey(
keys.
axisLeft.
key) || Input.GetKey(KeyCode.LeftArrow))
759 if (
axis == Vector2.zero)
761 if (Input.GetKey(KeyCode.Keypad8))
765 if (Input.GetKey(KeyCode.Keypad2))
769 if (Input.GetKey(KeyCode.Keypad4))
773 if (Input.GetKey(KeyCode.Keypad6))
794 if (Input.GetKey(KeyCode.Keypad1))
798 if (Input.GetKey(KeyCode.Keypad3))
802 if (Input.GetKey(KeyCode.Keypad7))
806 if (Input.GetKey(KeyCode.Keypad9))
826 if (Input.GetKey(KeyCode.LeftAlt) && (
axis.x == 0f ||
axis.y == 0f))
841 if (!(
axis == Vector2.zero))
848 else if (
axis == Vector2.zero)
855 axisDiagonal.x =
axis.x;
856 axisDiagonal.y =
axis.y;
871 if (
axis == Vector2.zero)
886 if (
axis != Vector2.zero)
909 if (Input.GetKeyDown(KeyCode.Alpha1))
913 else if (Input.GetKeyDown(KeyCode.Alpha2))
917 else if (Input.GetKeyDown(KeyCode.Alpha3))
921 else if (Input.GetKeyDown(KeyCode.Alpha4))
925 else if (Input.GetKeyDown(KeyCode.Alpha5))
929 else if (Input.GetKeyDown(KeyCode.Alpha6))
933 else if (Input.GetKeyDown(KeyCode.Alpha7))
937 else if (Input.GetKeyDown(KeyCode.Alpha8))
941 else if (Input.GetKeyDown(KeyCode.Alpha9))
951 if (Input.GetKeyDown(KeyCode.F1))
955 else if (Input.GetKeyDown(KeyCode.F2))
959 else if (Input.GetKeyDown(KeyCode.F3))
963 else if (Input.GetKeyDown(KeyCode.F4))
967 else if (Input.GetKeyDown(KeyCode.F5))
971 else if (Input.GetKeyDown(KeyCode.F6))
975 else if (Input.GetKeyDown(KeyCode.F7))
979 else if (Input.GetKeyDown(KeyCode.F8))
989 if (Input.GetKey(KeyCode.Alpha1))
993 else if (Input.GetKey(KeyCode.Alpha2))
997 else if (Input.GetKey(KeyCode.Alpha3))
1001 else if (Input.GetKey(KeyCode.Alpha4))
1005 else if (Input.GetKey(KeyCode.Alpha5))
1009 else if (Input.GetKey(KeyCode.Alpha6))
1013 else if (Input.GetKey(KeyCode.Alpha7))
1017 else if (Input.GetKey(KeyCode.Alpha8))
1021 else if (Input.GetKey(KeyCode.Alpha9))
1030 string inputString = Input.inputString;
1031 if (Input.GetKeyDown(KeyCode.Escape))
1035 if (Input.GetKeyDown(
keys.
wait.
key) || Input.GetKey(KeyCode.Keypad5))
1122 if (!(inputString ==
"?"))
1124 if (inputString ==
"g")