編輯

共用方式為


BaseInteractiveElement Class

Definition

Base class for an Interactive Element. Contains state management methods, event management and the state setting logic for some Core Interaction States.

public ref class BaseInteractiveElement abstract : UnityEngine::MonoBehaviour, Microsoft::MixedReality::Toolkit::Input::IMixedRealityFocusHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealityPointerHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealitySpeechHandler, Microsoft::MixedReality::Toolkit::Input::IMixedRealityTouchHandler, UnityEngine::EventSystems::IEventSystemHandler
public abstract class BaseInteractiveElement : UnityEngine.MonoBehaviour, Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealitySpeechHandler, Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler, UnityEngine.EventSystems.IEventSystemHandler
type BaseInteractiveElement = class
    inherit MonoBehaviour
    interface IMixedRealityFocusHandler
    interface IEventSystemHandler
    interface IMixedRealityTouchHandler
    interface IMixedRealityPointerHandler
    interface IMixedRealitySpeechHandler
    interface IMixedRealityBaseInputHandler
Public MustInherit Class BaseInteractiveElement
Inherits MonoBehaviour
Implements IEventSystemHandler, IMixedRealityFocusHandler, IMixedRealityPointerHandler, IMixedRealitySpeechHandler, IMixedRealityTouchHandler
Inheritance
UnityEngine.MonoBehaviour
BaseInteractiveElement
Derived
Implements

Constructors

BaseInteractiveElement()

Fields

ClickedStateName
DefaultStateName
FocusFarStateName
FocusNearStateName
FocusStateName
SelectFarStateName
SpeechKeywordStateName
ToggleOffStateName
ToggleOnStateName
TouchStateName

Properties

Active

Whether or not this interactive element will react to input and update internally. If true, the object will react to input and update internally. If false, the object will not update internally and not react to input, i.e. state values will not be updated.

EventReceiverManager

Manages the associated state events contained in a state.

StateManager

Entry point for state management. Contains methods for state setting, getting and creating.

States

A list of the interaction states for this interactive element.

Methods

AddNewState(String)

Creates and adds a new state to track given the new state name.

AddNewStateWithEventConfiguration(String, BaseInteractionEventConfiguration)

Create and add a new state given the state name and the associated existing event configuration.

AddToggleStates()

Add the ToggleOn and ToggleOff state.

ForceSetToggleStates(Boolean)

Force set the toggle states either on or off.

GetState(String)

Gets a state by using the state name.

GetStateEvents<T>(String)

Get the events associated with a state given the type and the state name.

If the state to retrieve is a CoreInteractionState: The type name of a state's event configuration is the state name + "Events". For example, Touch state's event configuration is named TouchEvents. The Focus state's event configuration is named FocusEvents.

If the state is not a CoreInteractionState: The type is most likely StateEvents. The StateEvents type is the default type of a new state that is not a core state.

IsStateActive(String)

Check if a state is currently active.

IsStatePresent(String)

Checks if a state is currently in the States list and is being tracked by the state manager.

OnFocusEnter(FocusEventData)
OnFocusExit(FocusEventData)
OnPointerClicked(MixedRealityPointerEventData)
OnPointerDown(MixedRealityPointerEventData)
OnPointerDragged(MixedRealityPointerEventData)
OnPointerUp(MixedRealityPointerEventData)
OnSpeechKeywordRecognized(SpeechEventData)
OnTouchCompleted(HandTrackingInputEventData)
OnTouchStarted(HandTrackingInputEventData)
OnTouchUpdated(HandTrackingInputEventData)
OnValidate()
RemoveState(String)

Removes a state. The state will no longer be tracked if it is removed.

ResetAllStates()

Reset all the state values in the list to 0. State values are reset when the Active property is set to false.

SetStateAndInvokeEvent(String, Int32, BaseEventData)

Sets a state to a given state value and invokes an event with associated event data.

SetStateOff(String)

Gets and sets a state to Off and invokes the OnStateDeactivated event. Setting a state off changes the state value to 0.

SetStateOn(String)

Gets and sets a state to On and invokes the OnStateActivated event. Setting a state on changes the state value to 1.

SetToggles(Boolean)
SetToggleStates()

Set the toggle based on the current values of the ToggleOn and ToggleOff states.

Start()
TriggerClickedState()

Set the Clicked state which triggers the OnClicked event. The click behavior in the state management system is expressed by setting the Clicked state to on and then immediately setting it to off.

Note: Due to the fact that a click is triggered by setting the Clicked state to on and then immediately off, the cyan active state highlight in the inspector will not be visible.

Applies to