Component:ButtonValueShift: Difference between revisions

From Resonite Wiki
imported>Psychpsyo
Added description and usage.
 
This is no longer a stub. Added a field description. Style. Added Related issue description. Added links.
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=ButtonValueShift`1Component.png
|Image=ButtonValueShift`1Component.png
Line 8: Line 7:
}}
}}


The ButtonValueShift component can be used to make a button add X to a value whenever it is pressed.
The '''ButtonValueShift''' component can be used to make an [[Type:IButton|IButton]] add the <code>delta</code> amount to a [[Value Type|value]] whenever it is pressed.


<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|TargetValue|IField`1|TypeString0=IField<float>| The value to shift.
|TargetValue|'''[[Type:IField`1|IField`1]]&lt;T&gt;'''|TypeAdv0=true| The value to shift.
|Delta|Float| By how much <code>TargetValue</code> should be shifted on each press.
|Delta|'''T'''|TypeAdv1=true| By how much <code>TargetValue</code> should be shifted on each press.
|Min|Float| The minimum value that can be shifted to.
|Min|'''T'''|TypeAdv2=true| The minimum value that can be shifted to.
|Max|Float| The maximum value that can be shifted to.
|Max|'''T'''|TypeAdv3=true| The maximum value that can be shifted to.
|WrapAround|Bool| Whether or not the value should wrap around to the other extreme when reaching either <code>Min</code> or <code>Max</code>.
|WrapAround|Bool| Whether or not the value should wrap around to the other extreme when reaching either <code>Min</code> or <code>Max</code>.
|MaxIsExclusive|Bool| When the current amount is at the value before max, it will stop there, unless wrap around is enabled, which then wraps around from the max value - 1.
}}
}}


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
To function, the component simply needs to be attached to a slot that also has a button component attached to it.
To function, the component simply needs to be attached to a [[Slot|slot]] that also has a button component attached to it.
From then on, pressing that button will activate the ButtonValueShift, making it shift its <code>TargetValue</code> by its <code>Delta</code>.
From then on, pressing that button will activate the '''ButtonValueShift''', making it shift its <code>TargetValue</code> by its <code>Delta</code>.


<!--T:4-->
<!--T:4-->
Line 30: Line 30:
<!--T:5-->
<!--T:5-->
== Related Issues ==
== Related Issues ==
[https://github.com/Neos-Metaverse/NeosPublic/issues/2108 <s>#2108 - ButtonValueShift "WrapAround" does not wrap around in reverse properly</s>]
It is known that you can go over the maximum by setting the <code>delta</code> higher than the max or min values, allowing the output to be outside the ranges provided.
 
[https://github.com/Neos-Metaverse/NeosPublic/issues/2431 <s>#2431 - ButtonValueShift<floatQ> is created with invalid values and fails to rotate target</s>]
 
[https://github.com/Neos-Metaverse/NeosPublic/issues/2441 <s>#2441 - ButtonValueShift<floatQ> doesn't rotate target as expected</s>]
 


<!--T:6-->
<!--T:6-->
== Related Components ==
== Related Components ==
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Button Value Shift`1]]
[[Category:Components{{#translation:}}|Button Value Shift`1]]
[[Category:Generic Components{{#translation:}}|Button Value Shift`1]]
[[Category:Components:Common UI:Button Interactions{{#translation:}}|Button Value Shift`1]]
[[Category:Components:Common UI:Button Interactions{{#translation:}}|Button Value Shift`1]]

Latest revision as of 00:18, 12 September 2024

Component image 
Button Value Shift`1 component as seen in the Scene Inspector


The ButtonValueShift component can be used to make an IButton add the delta amount to a value whenever it is pressed.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
TargetValue IField`1<T> The value to shift.
Delta T By how much TargetValue should be shifted on each press.
Min T The minimum value that can be shifted to.
Max T The maximum value that can be shifted to.
WrapAround Bool Whether or not the value should wrap around to the other extreme when reaching either Min or Max.
MaxIsExclusive Bool When the current amount is at the value before max, it will stop there, unless wrap around is enabled, which then wraps around from the max value - 1.

Usage

To function, the component simply needs to be attached to a slot that also has a button component attached to it. From then on, pressing that button will activate the ButtonValueShift, making it shift its TargetValue by its Delta.

Examples

Related Issues

It is known that you can go over the maximum by setting the delta higher than the max or min values, allowing the output to be outside the ranges provided.

Related Components