Events

You can track events that occur when the user presses certain buttons in the game.

Available events and methods to work with them:

ysdk = {
  on_event = function (eventName: "EXIT" | "HISTORY_BACK", listener: function): nil,
  dispatch_event = function (eventName: "EXIT" | "HISTORY_BACK", detail: table|nil): nil,
}

HISTORY_BACK

To track clicks on the Back button, use the following method:

ysdk.on_event("HISTORY_BACK", function (self)
    -- Showing the custom game dialog to the user with the options
    -- to confirm exiting the game, going to the internal settings, store, and so on.
end)

Alert

This event is available only if the game is launched on a TV.

EXIT

If the user confirms exiting the game in the custom dialog box that pops up after clicking Back, the game must send an exit event. To do this, use the following method:

ysdk.dispatch_event("EXIT")

Repository