API reference
API reference
Select your platform
No SDKs available
No versions available

ButtonClickEventArgs Class

Extends EventArgs
Modifiers: final
Event arguments for button click events.
ButtonClickEventArgs is used to pass information about a button click interaction through the event system. It contains a HitInfo object that provides details about the interaction, such as the hit point, normal, and distance.
This class is typically used when registering event listeners for button click events on entities, allowing components to respond to user interactions.
Example usage:
// Register a button click event listener on an entity
entity.registerEventListener<ButtonClickEventArgs>(ButtonClickEventArgs.EVENT_NAME) { entity, eventArgs ->
    // Handle the button click event
    val hitPoint = eventArgs.hitInfo.hitPoint
    // Perform actions based on the click
}
// Send a button click event to an entity
dataModel.sendEvent(
    entity,
    ButtonClickEventArgs.EVENT_NAME,
    ButtonClickEventArgs.fromHitInfo(hitInfo, dataModel)
)

Signature

class ButtonClickEventArgs(val hitInfo: HitInfo, val dataModel: DataModel) : EventArgs

Constructors

ButtonClickEventArgs ( hitInfo , dataModel )
Signature
constructor(hitInfo: HitInfo, dataModel: DataModel)
Parameters
hitInfo: HitInfo
  Information about the hit/interaction that triggered the button click
dataModel: DataModel
  The data model associated with this event

Properties

dataModel : DataModel
[Get]
Signature
val dataModel: DataModel
eventName : String
[Get]
Signature
val eventName: String
handled : Boolean
[Get][Set]
Signature
var handled: Boolean
hitInfo : HitInfo
[Get]
Information about the hit/interaction that triggered the button click
Signature
val hitInfo: HitInfo
throttleTime : Int?
[Get][Set]
Signature
var throttleTime: Int?

Companion Object

Companion Object Properties

EVENT_NAME : String
[Get]
The name of the button click event, used when registering event listeners.
Signature
const val EVENT_NAME: String

Companion Object Functions

fromHitInfo ( hitInfo , dataModel )
Creates a ButtonClickEventArgs instance from a HitInfo object and DataModel.
This factory method provides a convenient way to create ButtonClickEventArgs instances when sending events.
Signature
fun fromHitInfo(hitInfo: HitInfo, dataModel: DataModel): ButtonClickEventArgs
Parameters
hitInfo: HitInfo
  Information about the hit/interaction that triggered the button click
dataModel: DataModel
  The data model associated with this event
Returns
  A new ButtonClickEventArgs instance
Did you find this page helpful?