Loading...
Searching...
No Matches
PixelCrushers.InputDeviceManager Class Reference

This script checks for joystick and keyboard input. More...

Inheritance diagram for PixelCrushers.InputDeviceManager:
Collaboration diagram for PixelCrushers.InputDeviceManager:

Public Types

enum  KeyInputSwitchesModeTo { Keyboard , Mouse }
 

Public Member Functions

delegate bool GetButtonDownDelegate (string buttonName)
 
delegate float GetAxisDelegate (string axisName)
 
void Awake ()
 
void OnDestroy ()
 
void Start ()
 
void SetInputDevice (InputDevice newDevice)
 
void Update ()
 
bool IsUsingJoystick ()
 
bool IsUsingMouse ()
 
void BrieflyIgnoreMouseMovement ()
 
bool IsUsingKeyboard ()
 
bool IsBackButtonDown ()
 
void SetCursor (bool visible)
 
void ForceCursor (bool visible)
 

Static Public Member Functions

static bool IsButtonDown (string buttonName)
 
static bool IsButtonUp (string buttonName)
 
static bool IsKeyDown (KeyCode keyCode)
 
static bool IsAnyKeyDown ()
 
static float GetAxis (string axisName)
 
static Vector3 GetMousePosition ()
 
static bool DefaultGetKeyDown (KeyCode keyCode)
 
static bool DefaultGetAnyKeyDown ()
 
static bool DefaultGetButtonDown (string buttonName)
 
static bool DefaultGetButtonUp (string buttonName)
 
static float DefaultGetAxis (string axisName)
 
static Vector3 DefaultGetMousePosition ()
 
static bool DefaultGetMouseButtonDown (int buttonNumber)
 

Public Attributes

InputDevice inputDevice = InputDevice.Joystick
 
KeyCode[] joystickKeyCodesToCheck = new KeyCode[] { KeyCode.JoystickButton0, KeyCode.JoystickButton1, KeyCode.JoystickButton2, KeyCode.JoystickButton7 }
 
string[] joystickButtonsToCheck = new string[0]
 
string[] joystickAxesToCheck = new string[0]
 
float joystickAxisThreshold = 0.5f
 
string[] keyButtonsToCheck = new string[0]
 
KeyCode[] keyCodesToCheck = new KeyCode[] { KeyCode.Escape }
 
KeyInputSwitchesModeTo keyInputSwitchesModeTo = KeyInputSwitchesModeTo.Mouse
 
bool alwaysAutoFocus = false
 
bool detectMouseControl = true
 
float mouseMoveThreshold = 0.1f
 
bool controlCursorState = true
 
bool enforceCursorOnPause = false
 
bool controlGraphicRaycasters = false
 
KeyCode[] backKeyCodes = new KeyCode[] { KeyCode.JoystickButton1 }
 
string[] backButtons = new string[] { "Cancel" }
 
string submitButton = "Submit"
 
bool singleton = true
 
UnityEvent onUseKeyboard = new UnityEvent()
 
UnityEvent onUseJoystick = new UnityEvent()
 
UnityEvent onUseMouse = new UnityEvent()
 
UnityEvent onUseTouch = new UnityEvent()
 
GetButtonDownDelegate GetButtonDown = null
 
GetButtonDownDelegate GetButtonUp = null
 
GetAxisDelegate GetInputAxis = null
 

Properties

static InputDeviceManager instance [get, set]
 
static InputDevice currentInputDevice [get]
 Current input device detected by InputDeviceManager.
 
static bool deviceUsesCursor [get]
 Returns true if current input device uses mouse cursor.
 
static CursorLockMode cursorLockMode [get, set]
 Lock mode to use when locking cursor.
 
static bool autoFocus [get]
 Automatically select (and keep selected) a selectable on the current UIPanel.
 
static bool isBackButtonDown [get]
 
static bool isInputAllowed [get, set]
 Allow user input?
 

Detailed Description

This script checks for joystick and keyboard input.

If the player uses a joystick, it enables autofocus. If the player uses the mouse or keyboard, it disables autofocus.

Member Enumeration Documentation

◆ KeyInputSwitchesModeTo

Member Function Documentation

◆ Awake()

void PixelCrushers.InputDeviceManager.Awake ( )
inline

◆ BrieflyIgnoreMouseMovement()

void PixelCrushers.InputDeviceManager.BrieflyIgnoreMouseMovement ( )
inline

◆ DefaultGetAnyKeyDown()

static bool PixelCrushers.InputDeviceManager.DefaultGetAnyKeyDown ( )
inlinestatic

◆ DefaultGetAxis()

static float PixelCrushers.InputDeviceManager.DefaultGetAxis ( string  axisName)
inlinestatic

◆ DefaultGetButtonDown()

static bool PixelCrushers.InputDeviceManager.DefaultGetButtonDown ( string  buttonName)
inlinestatic

◆ DefaultGetButtonUp()

static bool PixelCrushers.InputDeviceManager.DefaultGetButtonUp ( string  buttonName)
inlinestatic

◆ DefaultGetKeyDown()

static bool PixelCrushers.InputDeviceManager.DefaultGetKeyDown ( KeyCode  keyCode)
inlinestatic

◆ DefaultGetMouseButtonDown()

static bool PixelCrushers.InputDeviceManager.DefaultGetMouseButtonDown ( int  buttonNumber)
inlinestatic

◆ DefaultGetMousePosition()

static Vector3 PixelCrushers.InputDeviceManager.DefaultGetMousePosition ( )
inlinestatic

◆ ForceCursor()

void PixelCrushers.InputDeviceManager.ForceCursor ( bool  visible)
inline

◆ GetAxis()

static float PixelCrushers.InputDeviceManager.GetAxis ( string  axisName)
inlinestatic

◆ GetAxisDelegate()

delegate float PixelCrushers.InputDeviceManager.GetAxisDelegate ( string  axisName)

◆ GetButtonDownDelegate()

delegate bool PixelCrushers.InputDeviceManager.GetButtonDownDelegate ( string  buttonName)

◆ GetMousePosition()

static Vector3 PixelCrushers.InputDeviceManager.GetMousePosition ( )
inlinestatic

◆ IsAnyKeyDown()

static bool PixelCrushers.InputDeviceManager.IsAnyKeyDown ( )
inlinestatic

◆ IsBackButtonDown()

bool PixelCrushers.InputDeviceManager.IsBackButtonDown ( )
inline

◆ IsButtonDown()

static bool PixelCrushers.InputDeviceManager.IsButtonDown ( string  buttonName)
inlinestatic

◆ IsButtonUp()

static bool PixelCrushers.InputDeviceManager.IsButtonUp ( string  buttonName)
inlinestatic

◆ IsKeyDown()

static bool PixelCrushers.InputDeviceManager.IsKeyDown ( KeyCode  keyCode)
inlinestatic

◆ IsUsingJoystick()

bool PixelCrushers.InputDeviceManager.IsUsingJoystick ( )
inline

◆ IsUsingKeyboard()

bool PixelCrushers.InputDeviceManager.IsUsingKeyboard ( )
inline

◆ IsUsingMouse()

bool PixelCrushers.InputDeviceManager.IsUsingMouse ( )
inline

◆ OnDestroy()

void PixelCrushers.InputDeviceManager.OnDestroy ( )
inline

◆ SetCursor()

void PixelCrushers.InputDeviceManager.SetCursor ( bool  visible)
inline

◆ SetInputDevice()

void PixelCrushers.InputDeviceManager.SetInputDevice ( InputDevice  newDevice)
inline

◆ Start()

void PixelCrushers.InputDeviceManager.Start ( )
inline

◆ Update()

void PixelCrushers.InputDeviceManager.Update ( )
inline

Member Data Documentation

◆ alwaysAutoFocus

bool PixelCrushers.InputDeviceManager.alwaysAutoFocus = false

◆ backButtons

string [] PixelCrushers.InputDeviceManager.backButtons = new string[] { "Cancel" }

◆ backKeyCodes

KeyCode [] PixelCrushers.InputDeviceManager.backKeyCodes = new KeyCode[] { KeyCode.JoystickButton1 }

◆ controlCursorState

bool PixelCrushers.InputDeviceManager.controlCursorState = true

◆ controlGraphicRaycasters

bool PixelCrushers.InputDeviceManager.controlGraphicRaycasters = false

◆ detectMouseControl

bool PixelCrushers.InputDeviceManager.detectMouseControl = true

◆ enforceCursorOnPause

bool PixelCrushers.InputDeviceManager.enforceCursorOnPause = false

◆ GetButtonDown

GetButtonDownDelegate PixelCrushers.InputDeviceManager.GetButtonDown = null

◆ GetButtonUp

GetButtonDownDelegate PixelCrushers.InputDeviceManager.GetButtonUp = null

◆ GetInputAxis

GetAxisDelegate PixelCrushers.InputDeviceManager.GetInputAxis = null

◆ inputDevice

InputDevice PixelCrushers.InputDeviceManager.inputDevice = InputDevice.Joystick

◆ joystickAxesToCheck

string [] PixelCrushers.InputDeviceManager.joystickAxesToCheck = new string[0]

◆ joystickAxisThreshold

float PixelCrushers.InputDeviceManager.joystickAxisThreshold = 0.5f

◆ joystickButtonsToCheck

string [] PixelCrushers.InputDeviceManager.joystickButtonsToCheck = new string[0]

◆ joystickKeyCodesToCheck

KeyCode [] PixelCrushers.InputDeviceManager.joystickKeyCodesToCheck = new KeyCode[] { KeyCode.JoystickButton0, KeyCode.JoystickButton1, KeyCode.JoystickButton2, KeyCode.JoystickButton7 }

◆ keyButtonsToCheck

string [] PixelCrushers.InputDeviceManager.keyButtonsToCheck = new string[0]

◆ keyCodesToCheck

KeyCode [] PixelCrushers.InputDeviceManager.keyCodesToCheck = new KeyCode[] { KeyCode.Escape }

◆ keyInputSwitchesModeTo

KeyInputSwitchesModeTo PixelCrushers.InputDeviceManager.keyInputSwitchesModeTo = KeyInputSwitchesModeTo.Mouse

◆ mouseMoveThreshold

float PixelCrushers.InputDeviceManager.mouseMoveThreshold = 0.1f

◆ onUseJoystick

UnityEvent PixelCrushers.InputDeviceManager.onUseJoystick = new UnityEvent()

◆ onUseKeyboard

UnityEvent PixelCrushers.InputDeviceManager.onUseKeyboard = new UnityEvent()

◆ onUseMouse

UnityEvent PixelCrushers.InputDeviceManager.onUseMouse = new UnityEvent()

◆ onUseTouch

UnityEvent PixelCrushers.InputDeviceManager.onUseTouch = new UnityEvent()

◆ singleton

bool PixelCrushers.InputDeviceManager.singleton = true

◆ submitButton

string PixelCrushers.InputDeviceManager.submitButton = "Submit"

Property Documentation

◆ autoFocus

bool PixelCrushers.InputDeviceManager.autoFocus
staticget

Automatically select (and keep selected) a selectable on the current UIPanel.

◆ currentInputDevice

InputDevice PixelCrushers.InputDeviceManager.currentInputDevice
staticget

Current input device detected by InputDeviceManager.

May changed based on input from other devices.

◆ cursorLockMode

CursorLockMode PixelCrushers.InputDeviceManager.cursorLockMode
staticgetset

Lock mode to use when locking cursor.

◆ deviceUsesCursor

bool PixelCrushers.InputDeviceManager.deviceUsesCursor
staticget

Returns true if current input device uses mouse cursor.

◆ instance

InputDeviceManager PixelCrushers.InputDeviceManager.instance
staticgetset

◆ isBackButtonDown

bool PixelCrushers.InputDeviceManager.isBackButtonDown
staticget

◆ isInputAllowed

bool PixelCrushers.InputDeviceManager.isInputAllowed
staticgetset

Allow user input?


The documentation for this class was generated from the following file: