namespace VRTK.Prefabs.CameraRig.SimulatedCameraRig
{
using UnityEngine;
using UnityEngine.UI;
using Malimbe.XmlDocumentationAttribute;
using Zinnia.Data.Attribute;
using VRTK.Prefabs.CameraRig.UnityXRCameraRig.Input;
using Malimbe.PropertySerializationAttribute;
///
/// Sets up the key binding display.
///
public class KeyBindingDisplay : MonoBehaviour
{
///
/// The Text component to apply the instructions text to.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public Text KeyBindingText { get; protected set; }
///
/// The action for handling forward.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction Forward { get; protected set; }
///
/// The action for handling backward.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction Backward { get; protected set; }
///
/// The action for handling strafeLeft.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction StrafeLeft { get; protected set; }
///
/// The action for handling strafeRight.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction StrafeRight { get; protected set; }
///
/// The action for handling button1.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction Button1 { get; protected set; }
///
/// The action for handling button2.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction Button2 { get; protected set; }
///
/// The action for handling button3.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction Button3 { get; protected set; }
///
/// The action for handling switchToPlayer.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction SwitchToPlayer { get; protected set; }
///
/// The action for handling switchToLeftController.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction SwitchToLeftController { get; protected set; }
///
/// The action for handling switchToRightController.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction SwitchToRightController { get; protected set; }
///
/// The action for handling resetPlayer.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction ResetPlayer { get; protected set; }
///
/// The action for handling resetControllers.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction ResetControllers { get; protected set; }
///
/// The action for handling toggleInstructions.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction ToggleInstructions { get; protected set; }
///
/// The action for handling lockCursorToggle.
///
[Serialized]
[field: DocumentedByXml, Restricted]
public UnityButtonAction LockCursorToggle { get; protected set; }
///
/// The instructions text.
///
protected const string Instructions = @"Simulator Key Bindings
Movement:
Forward: {0}
Backward: {1}
Strafe Left: {2}
Strafe Right: {3}
Buttons
Button 1: {4}
Button 2: {5}
Button 3: {6}
Object Control
Move PlayArea: {7}
Move Left Controller: {8}
Move Right Controller: {9}
Reset Player: Position {10}
Reset Controller Position: {11}
Misc
Toggle Help Window: {12}
Lock Mouse Cursor: {13}";
protected virtual void OnEnable()
{
KeyBindingText.text = string.Format(
Instructions,
Forward.KeyCode,
Backward.KeyCode,
StrafeLeft.KeyCode,
StrafeRight.KeyCode,
Button1.KeyCode,
Button2.KeyCode,
Button3.KeyCode,
SwitchToPlayer.KeyCode,
SwitchToLeftController.KeyCode,
SwitchToRightController.KeyCode,
ResetPlayer.KeyCode,
ResetControllers.KeyCode,
ToggleInstructions.KeyCode,
LockCursorToggle.KeyCode
);
}
}
}