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]
Data model.
Signature
val dataModel: DataModel
eventName : String
[Get]
The string identifier for this event type, used to match registered Entity event listeners. Each EventArgs subclass defines its own event name constant for dispatch routing.
Signature
val eventName: String
handled : Boolean
[Get][Set]
Flag indicating whether this event has been consumed by a listener. Set to true in an event handler to prevent further propagation to other listeners registered for the same event.
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]
Minimum interval in milliseconds between consecutive dispatches of this event type. Events fired more frequently than this interval are silently dropped to prevent listener overload.
Signature
var throttleTime: Int?

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

Methods

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
ButtonClickEventArgs  A new ButtonClickEventArgs instance