Show / Hide Table of Contents

Class VInputHandler

Handling VInput deivces.
處理 VInput 裝置。

Inheritance
System.Object
Element
VInputHandler
Inherited Members
Element.name
Element.Equals(String, Boolean)
Element.Contains(String, Boolean, Boolean)
Namespace: Votanic.vIO.VInput
Assembly: Votanic.vIO.dll
Syntax
public class VInputHandler : Element

Constructors

VInputHandler(Single, Single, Single)

Declare the VInput handler.
宣告 VInput 處理器。

Declaration
public VInputHandler(float axesDeadZone = 0.14F, float axesPressDetect = 0.7F, float holdingDuration = 1F)
Parameters
Type Name Description
System.Single axesDeadZone

Dead zone of axes
軸群的死區

System.Single axesPressDetect

Press detect value of axes
軸群的按下偵測值

System.Single holdingDuration

Holding seconds of hold input type
長按輸入類型的長按秒數

Properties

keyboard

VInput keyboard type of device class.
VInput 鍵盤類型的裝置類別。

Declaration
public VInputKeyboard keyboard { get; }
Property Value
Type Description
VInputKeyboard

mouse

VInput mouse type of device class.
VInput 滑鼠類型的裝置類別。

Declaration
public VInputMouse mouse { get; }
Property Value
Type Description
VInputMouse

numberOfControllers

Number of controllers scanned.
掃瞄到的控制器數目。

Declaration
public int numberOfControllers { get; }
Property Value
Type Description
System.Int32

numberOfTrackers

Number of virtual trackers.
虛擬定位器數目。

Declaration
public int numberOfTrackers { get; }
Property Value
Type Description
System.Int32

Methods

AxisDown(Int32, AxisDirection, Int32, Boolean, AssistButtons)

Return true if an axis on controller is pressed (Absolute axis value >= Press detect value).
當控制器的軸按下時傳回 true(軸絕對值 >= 按下偵測值)。

AxisDown(0, AxisDirection.Positive, 0)

Declaration
public bool AxisDown(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type Name Description
System.Int32 index

Axis index
軸編號

AxisDirection direction

The axis pressing direction
軸按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

AssistButtons assistButtons

Assist buttons
輔助按鈕

Returns
Type Description
System.Boolean

AxisHold(Int32, AxisDirection, Int32, Boolean, AssistButtons)

Return true if an axis on controller is held for a while (Absolute axis value >= Press detect value).
當控制器的軸長按一段時間時傳回 true(軸絕對值 >= 按下偵測值)。

AxisHold(0, AxisDirection.Positive, 0)

Declaration
public bool AxisHold(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type Name Description
System.Int32 index

Axis index
軸編號

AxisDirection direction

The axis pressing direction
軸按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

AssistButtons assistButtons

Assist buttons
輔助按鈕

Returns
Type Description
System.Boolean

AxisPress(Int32, AxisDirection, Int32, Boolean, AssistButtons)

Return true if an axis on controller is pressing (Absolute axis value >= Press detect value).
當控制器的軸按住時傳回 true(軸絕對值 >= 按下偵測值)。

AxisPress(0, AxisDirection.Positive, 0)

Declaration
public bool AxisPress(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type Name Description
System.Int32 index

Axis index
軸編號

AxisDirection direction

The axis pressing direction
軸按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

AssistButtons assistButtons

Assist buttons
輔助按鈕

Returns
Type Description
System.Boolean

AxisUp(Int32, AxisDirection, Int32, Boolean, AssistButtons)

Return true if an axis on controller is released (Absolute release value >= Press detect value).
當控制器的軸放開時傳回 true(釋放絕對值 >= 按下偵測值)。

AxisUp(0, AxisDirection.Positive, 0)

Declaration
public bool AxisUp(int index, AxisDirection direction = AxisDirection.Any, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type Name Description
System.Int32 index

Axis index
軸編號

AxisDirection direction

The axis pressing direction
軸按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

AssistButtons assistButtons

Assist buttons
輔助按鈕

Returns
Type Description
System.Boolean

AxisValue(Int32, Int32, Boolean, AssistButtons)

Return the value of an axis on controller.
傳回控制器的一個軸的值。

AxisValue(0, 0)

Declaration
public float AxisValue(int index, int controller = 0, bool reversed = false, AssistButtons assistButtons = null)
Parameters
Type Name Description
System.Int32 index

Axis index
軸編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

AssistButtons assistButtons

Assist buttons
輔助按鈕

Returns
Type Description
System.Single

ButtonDown(Int32, Int32, Boolean)

Return true if a button on controller is pressed.
當控制器的按鈕按下時傳回 true。

ButtonDown(0, 0)

Declaration
public bool ButtonDown(int index, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Button index
按鈕編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

ButtonHold(Int32, Int32, Boolean)

Return true if a button on controller is held for a while.
當控制器的按鈕長按一段時間時傳回 true。

ButtonHold(0, 0)

Declaration
public bool ButtonHold(int index, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Button index
按鈕編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

ButtonPress(Int32, Int32, Boolean)

Return true if a button on controller is pressing.
當控制器的按鈕按住時傳回 true。

ButtonPress(0, 0)

Declaration
public bool ButtonPress(int index, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Button index
按鈕編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

ButtonUp(Int32, Int32, Boolean)

Return true if a button on controller is released.
當控制器的按鈕放開時傳回 true。

ButtonUp(0, 0)

Declaration
public bool ButtonUp(int index, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Button index
按鈕編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

ControllerIndex(String)

Get the controller index by name.
以控制器名稱取得控制器編號。

ControllerIndex("Controller (XBOX 360 For Windows)")

Declaration
public int ControllerIndex(string name)
Parameters
Type Name Description
System.String name

Controller name
控制器名稱

Returns
Type Description
System.Int32

DPadDown(Int32, DPadDirection, Int32, Boolean)

Return true if a dpad on controller is pressed.
當控制器的 DPad 按下時傳回 true。

DPadDown(0, DPadDirection.UpLeft, 0)

Declaration
public bool DPadDown(int index, DPadDirection direction = DPadDirection.Any, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

DPad index
DPad 編號

DPadDirection direction

The dpad pressing direction
DPad 按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

DPadHold(Int32, DPadDirection, Int32, Boolean)

Return true if a dpad on controller is held for a while.
當控制器的 DPad 長按一段時間時傳回 true。

DPadHold(0, DPadDirection.UpLeft, 0)

Declaration
public bool DPadHold(int index, DPadDirection direction = DPadDirection.Any, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

DPad index
DPad 編號

DPadDirection direction

The dpad pressing direction
DPad 按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

DPadPress(Int32, DPadDirection, Int32, Boolean)

Return true if a dpad on controller is pressing.
當控制器的 DPad 按住時傳回 true。

DPadPress(0, DPadDirection.UpLeft, 0)

Declaration
public bool DPadPress(int index, DPadDirection direction = DPadDirection.Any, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

DPad index
DPad 編號

DPadDirection direction

The dpad pressing direction
DPad 按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

DPadUp(Int32, DPadDirection, Int32, Boolean)

Return true if a dpad on controller is released.
當控制器的 DPad 放開時傳回 true。

DPadUp(0, DPadDirection.UpLeft, 0)

Declaration
public bool DPadUp(int index, DPadDirection direction = DPadDirection.Any, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

DPad index
DPad 編號

DPadDirection direction

The dpad pressing direction
DPad 按住的方向

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

DPadValue(Int32, Int32, Boolean)

Return the value of an dpad on controller.
傳回控制器的一個 DPad 的值。

DPadValue(0, 0)

Declaration
public Vector2 DPadValue(int index, int controller = 0, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

DPad index
DPad 編號

System.Int32 controller

Controller index
控制器編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
UnityEngine.Vector2

EnableDirectInputMouse()

Enable Direct Input Mouse. This may cause Unity original getting mouse axis value function always return 0.
啟用 Direct Input 滑鼠。這可能會導致 Unity 原生獲取滑鼠軸值功能永遠傳回 0。

Declaration
public void EnableDirectInputMouse()

GetController(Int32)

Get a controller by index.
以編號取得控制器。

GetController(0)

Declaration
public VInputController GetController(int index)
Parameters
Type Name Description
System.Int32 index

Controller index
控制器編號

Returns
Type Description
VInputController

GetControllers()

Get all VInput controllers.
取得所有 VInput controllers。

Declaration
public List<VInputController> GetControllers()
Returns
Type Description
System.Collections.Generic.List<VInputController>

GetTracker(Int32)

Get a virtual tracker by index.
以編號取得虛擬定位器。

GetTracker(0)

Declaration
public VInputTracker GetTracker(int index)
Parameters
Type Name Description
System.Int32 index

Tracker index
定位器編號

Returns
Type Description
VInputTracker

Key(KeyCode)

Get the key index from keycode.
以按鈕編碼取得按鈕編號。

Key(Keycode.Space)

Declaration
public static int Key(KeyCode keycode)
Parameters
Type Name Description
UnityEngine.KeyCode keycode

Keycode
按鈕編號

Returns
Type Description
System.Int32

KeyboardDown(Int32, Boolean)

Return true if a key on kerboard is pressed.
當鍵盤按鍵按下時傳回 true。

KeyboardDown(57)

Declaration
public bool KeyboardDown(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardDown(KeyCode, Boolean)

Return true if a key on kerboard is pressed.
當鍵盤按鍵按下時傳回 true。

KeyboardDown(KeyCode.Space)

Declaration
public bool KeyboardDown(KeyCode keycode, bool reversed = false)
Parameters
Type Name Description
UnityEngine.KeyCode keycode

Keycode
按鍵編碼

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardHold(Int32, Boolean)

Return true if a key on kerboard is held for a while.
當鍵盤按鍵長按一段時間時傳回 true。

KeyboardHold(57)

Declaration
public bool KeyboardHold(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardHold(KeyCode, Boolean)

Return true if a key on kerboard is held for a while.
當鍵盤按鍵長按一段時間時傳回 true。

KeyboardHold(KeyCode.Space)

Declaration
public bool KeyboardHold(KeyCode keycode, bool reversed = false)
Parameters
Type Name Description
UnityEngine.KeyCode keycode

Keycode
按鍵編碼

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardPress(Int32, Boolean)

Return true if a key on kerboard is pressing.
當鍵盤按鍵按住時傳回 true。

KeyboardPress(57)

Declaration
public bool KeyboardPress(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardPress(KeyCode, Boolean)

Return true if a key on kerboard is pressing.
當鍵盤按鍵按住時傳回 true。

KeyboardPress(KeyCode.Space)

Declaration
public bool KeyboardPress(KeyCode keycode, bool reversed = false)
Parameters
Type Name Description
UnityEngine.KeyCode keycode

Keycode
按鍵編碼

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardUp(Int32, Boolean)

Return true if a key on kerboard is released.
當鍵盤按鍵放開時傳回 true。

KeyboardUp(57)

Declaration
public bool KeyboardUp(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyboardUp(KeyCode, Boolean)

Return true if a key on kerboard is released.
當鍵盤按鍵放開時傳回 true。

KeyboardUp(KeyCode.Space)

Declaration
public bool KeyboardUp(KeyCode keycode, bool reversed = false)
Parameters
Type Name Description
UnityEngine.KeyCode keycode

Keycode
按鍵編碼

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

KeyName(Int32)

Get the keycode from key index.
以按鈕編號取得按鈕編碼。

KeyName(57)

Declaration
public static KeyCode KeyName(int key)
Parameters
Type Name Description
System.Int32 key

Key index
按鈕編號

Returns
Type Description
UnityEngine.KeyCode

MouseAxis(Int32, Boolean)

Return the value of an axis on mouse.
傳回滑鼠的一個軸的值。

MouseAxis(0)

Declaration
public float MouseAxis(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
軸編號

System.Boolean reversed

Reverse axis value if true
當 true 時反轉軸值

Returns
Type Description
System.Single

MouseDown(Int32, Boolean)

Return true if a key on mouse is pressed.
當滑鼠按鍵按下時傳回 true。

MouseDown(0)

Declaration
public bool MouseDown(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

MouseHold(Int32, Boolean)

Return true if a key on mouse is held for a while.
當滑鼠按鍵長按一段時間時傳回 true。

MouseHold(0)

Declaration
public bool MouseHold(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

MousePress(Int32, Boolean)

Return true if a key on mouse is pressing.
當滑鼠按鍵按住時傳回 true。

MousePress(0)

Declaration
public bool MousePress(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

MouseUp(Int32, Boolean)

Return true if a key on mouse is released.
當滑鼠按鍵放開時傳回 true。

MouseUp(0)

Declaration
public bool MouseUp(int index, bool reversed = false)
Parameters
Type Name Description
System.Int32 index

Key index
按鍵編號

System.Boolean reversed

Reverse the result if true
當 true 時反轉結果

Returns
Type Description
System.Boolean

ReleaseInput()

Release VInput when stop application.
當停止應用程式時釋放 VInput。

Declaration
public void ReleaseInput()

Scan()

Scan controllers from this equipment.
掃瞄這個設備的控制器。

Declaration
public void Scan()

TrackerAccessible(Int32)

Return true if the tracker is accessible.
當定位器可讀取時傳回 true。

TrackerAccessible(0)

Declaration
public bool TrackerAccessible(int index)
Parameters
Type Name Description
System.Int32 index

Tracker index
定位器編號

Returns
Type Description
System.Boolean

TrackerPosition(Int32)

Get the position of tracker in system.
取得系統中的定位器位置。

TrackerPosition(0)

Declaration
public Vector3 TrackerPosition(int index)
Parameters
Type Name Description
System.Int32 index

Tracker index
定位器編號

Returns
Type Description
UnityEngine.Vector3

TrackerRotation(Int32)

Get the rotation of tracker in system.
取得系統中的定位器角度。

TrackerRotation(0)

Declaration
public Quaternion TrackerRotation(int index)
Parameters
Type Name Description
System.Int32 index

Tracker index
定位器編號

Returns
Type Description
UnityEngine.Quaternion

Update()

Update the current state of devices.
更新裝置目前狀態。

Declaration
public void Update()

Vibrate(Single, Single, Int32)

Vibrate a controller.
使控制器震動。

Vibrate(1, 1, 0)

Declaration
public void Vibrate(float left, float right, int controller = 0)
Parameters
Type Name Description
System.Single left

Left side strength
左邊強度

System.Single right

Right side strength
右邊強度

System.Int32 controller

Controller index
控制器編號

In This Article
Back to top Generated by DocFX