Inventory Engine
v3.8
|
A component to handle switches More...
Inherits MoreMountains.Tools.MMTouchButton.
Public Member Functions | |
virtual void | InitializeState () |
virtual void | SetTrue () |
virtual void | SetFalse () |
virtual void | ToggleState () |
Use this method to go from one state to the other More... | |
Public Member Functions inherited from MoreMountains.Tools.MMTouchButton | |
virtual void | InvokeButtonStateChange (PointerEventData.FramePressState newState, PointerEventData data) |
Triggers the ButtonStateChange event for the specified state More... | |
virtual void | OnPointerDown (PointerEventData data) |
Triggers the bound pointer down action More... | |
virtual void | OnPointerUp (PointerEventData data) |
Triggers the bound pointer up action More... | |
virtual void | OnPointerPressed () |
Triggers the bound pointer pressed action More... | |
virtual void | OnPointerEnter (PointerEventData data) |
Triggers the bound pointer enter action when touch enters zone More... | |
virtual void | OnPointerExit (PointerEventData data) |
Triggers the bound pointer exit action when touch is out of zone More... | |
virtual void | DisableButton () |
Prevents the button from receiving touches More... | |
virtual void | EnableButton () |
Allows the button to receive touches More... | |
virtual void | OnSubmit (BaseEventData eventData) |
On submit, raises the appropriate events More... | |
Public Attributes | |
MMDebugMenuSpriteReplace | SwitchKnob |
a SpriteReplace to represent the switch knob More... | |
bool | SwitchState |
the possible states of the switch More... | |
bool | InitialState = false |
the state the switch should start in More... | |
UnityEvent | OnSwitchOn |
the methods to call when the switch is turned on More... | |
UnityEvent | OnSwitchOff |
the methods to call when the switch is turned off More... | |
UnityEvent< bool > | OnSwitchToggle |
the methods to call when the switch is turned off More... | |
Public Attributes inherited from MoreMountains.Tools.MMTouchButton | |
bool | Interactable = true |
whether or not this button can be interacted with More... | |
UnityEvent | ButtonPressedFirstTime |
The method(s) to call when the button gets pressed down. More... | |
UnityEvent | ButtonReleased |
The method(s) to call when the button gets released. More... | |
UnityEvent | ButtonPressed |
The method(s) to call while the button is being pressed. More... | |
Sprite | DisabledSprite |
the sprite to use on the button when it's in the disabled state More... | |
bool | DisabledChangeColor = false |
whether or not to change color when the button is disabled More... | |
Color | DisabledColor = Color.white |
the color to use when the button is disabled More... | |
Sprite | PressedSprite |
the sprite to use on the button when it's in the pressed state More... | |
bool | PressedChangeColor = false |
whether or not to change the button color on press More... | |
Color | PressedColor = Color.white |
the color to use when the button is pressed More... | |
Sprite | HighlightedSprite |
the sprite to use on the button when it's in the highlighted state More... | |
bool | HighlightedChangeColor = false |
whether or not to change color when highlighting the button More... | |
Color | HighlightedColor = Color.white |
the color to use when the button is highlighted More... | |
float | PressedOpacity = 1f |
the new opacity to apply to the canvas group when the button is pressed More... | |
float | IdleOpacity = 1f |
the new opacity to apply to the canvas group when the button is idle More... | |
float | DisabledOpacity = 1f |
the new opacity to apply to the canvas group when the button is disabled More... | |
float | PressedFirstTimeDelay = 0f |
the delay to apply to events when the button gets pressed for the first time More... | |
float | ReleasedDelay = 0f |
the delay to apply to events when the button gets released More... | |
float | BufferDuration = 0f |
the duration (in seconds) after a press during which the button can't be pressed again More... | |
Animator | Animator |
an animator you can bind to this button to have its states updated to reflect the button's states More... | |
string | IdleAnimationParameterName = "Idle" |
the name of the animation parameter to turn true when the button is idle More... | |
string | DisabledAnimationParameterName = "Disabled" |
the name of the animation parameter to turn true when the button is disabled More... | |
string | PressedAnimationParameterName = "Pressed" |
the name of the animation parameter to turn true when the button is pressed More... | |
bool | MouseMode = false |
If you set this to true, you'll need to actually press the button for it to be triggered, otherwise a simple hover will trigger it (better for touch input). More... | |
Protected Member Functions | |
override void | Initialization () |
On init, we set our current switch state More... | |
Protected Member Functions inherited from MoreMountains.Tools.MMTouchButton | |
virtual void | Awake () |
On Start, we get our canvasgroup and set our initial alpha More... | |
virtual void | Update () |
Every frame, if the touch zone is pressed, we trigger the OnPointerPressed method, to detect continuous press More... | |
virtual void | LateUpdate () |
At the end of every frame, we change our button's state if needed More... | |
virtual void | InvokePressedFirstTime () |
Raises the ButtonPressedFirstTime event More... | |
virtual void | InvokeReleased () |
Invokes the ButtonReleased event More... | |
virtual void | ResetButton () |
Resets the button's state and opacity More... | |
virtual void | OnEnable () |
OnEnable, we reset our button state More... | |
virtual void | SetOpacity (float newOpacity) |
Sets the canvas group's opacity to the requested value More... | |
virtual void | UpdateAnimatorStates () |
Updates animator states based on the current state of the button More... | |
Additional Inherited Members | |
Public Types inherited from MoreMountains.Tools.MMTouchButton | |
enum | ButtonStates { ButtonStates.Off, ButtonStates.ButtonDown, ButtonStates.ButtonPressed, ButtonStates.ButtonUp, ButtonStates.Disabled } |
The different possible states for the button : Off (default idle state), ButtonDown (button pressed for the first time), ButtonPressed (button being pressed), ButtonUp (button being released), Disabled (unclickable but still present on screen) ButtonDown and ButtonUp will only last one frame, the others will last however long you press them / disable them / do nothing. More... | |
Protected Attributes inherited from MoreMountains.Tools.MMTouchButton | |
bool | _zonePressed = false |
CanvasGroup | _canvasGroup |
float | _initialOpacity |
Animator | _animator |
Image | _image |
Sprite | _initialSprite |
Color | _initialColor |
float | _lastClickTimestamp = 0f |
Selectable | _selectable |
Properties inherited from MoreMountains.Tools.MMTouchButton | |
virtual bool | ReturnToInitialSpriteAutomatically [get, set] |
virtual ButtonStates | CurrentState [get, protected set] |
the current state of the button (off, down, pressed or up) More... | |
Events inherited from MoreMountains.Tools.MMTouchButton | |
System.Action< PointerEventData.FramePressState, PointerEventData > | ButtonStateChange |
A component to handle switches
|
protectedvirtual |
On init, we set our current switch state
Reimplemented from MoreMountains.Tools.MMTouchButton.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Use this method to go from one state to the other
bool MoreMountains.Tools.MMDebugMenuSwitch.InitialState = false |
the state the switch should start in
UnityEvent MoreMountains.Tools.MMDebugMenuSwitch.OnSwitchOff |
the methods to call when the switch is turned off
UnityEvent MoreMountains.Tools.MMDebugMenuSwitch.OnSwitchOn |
the methods to call when the switch is turned on
UnityEvent<bool> MoreMountains.Tools.MMDebugMenuSwitch.OnSwitchToggle |
the methods to call when the switch is turned off
MMDebugMenuSpriteReplace MoreMountains.Tools.MMDebugMenuSwitch.SwitchKnob |
a SpriteReplace to represent the switch knob
bool MoreMountains.Tools.MMDebugMenuSwitch.SwitchState |
the possible states of the switch