cocos_add_dialog_modal
Add a centered modal dialog with backdrop, title, body, and customizable buttons to Cocos Creator scenes, inheriting UI theme colors and reducing multiple primitive calls to one.
Instructions
Build a centered modal dialog: backdrop + panel + title + body + buttons.
One call replaces 15+ primitive calls. Inherits colors from
the project's UI theme (set via cocos_set_ui_theme).
buttons: list of {"text": str, "variant": ..., "click_events": [...]?}
where variant is "primary" / "secondary" / "danger" /
"ghost" (surface-colored for cancel). Defaults to one
primary "OK" button.
Returns all created node + component IDs so the caller can wire click handlers or modify individual parts later.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| parent_node_id | Yes | ||
| title | Yes | ||
| body | No | ||
| buttons | No | ||
| width | No | ||
| height | No | ||
| backdrop_alpha | No |