Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: DialogService

[19:7] extends: EngineService

Wraps FXGL's DialogService, the engine service that shows modal dialog scenes from inside a game (message, confirmation, choice, input, error, progress). Reached at runtime via fxgl.getDialogService (chunk 6); obtain a wrapper via adopt. Each show method returns immediately; the dialog closes when the user responds or when the returned DialogBox (for progress) is closed by the caller.

Methods

  • DialogService (Ajo = null)

    Creates a DialogService wrapper. Empty by default (populated later via adopt); the (Ajo) form wraps an existing instance from fxgl.getDialogService.

    • @p Ajo is an optional AussomJavaObject around a DialogService.
  • adopt (object Ajo)

    Wraps an existing DialogService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a DialogService.
    • @r A new wrapper.
  • showMessageBox (string Message, callback Cb = null)

    Shows a simple message box. The optional callback fires after the user dismisses the box.

    • @p Message is the body text.
    • @p Cb is an optional callback that runs after dismiss.
    • @r this object
  • showConfirmationBox (string Message, callback Cb)

    Shows a yes/no confirmation box. The callback receives a bool.

    • @p Message is the body text.
    • @p Cb is a callback taking a bool (true on yes, false on no).
    • @r this object
  • showInputBox (string Message, callback Cb)

    Shows a text input box. The callback receives the entered string.

    • @p Message is the prompt text.
    • @p Cb is a callback taking the entered string.
    • @r this object
  • showErrorBox (string Message, callback Cb = null)

    Shows an error box with the given message.

    • @p Message is the error text.
    • @p Cb is an optional callback that runs after dismiss.
    • @r this object
  • showProgressBox (string Message)

    Shows a progress box (indeterminate) until the returned DialogBox is closed.

    • @p Message is the progress message.
    • @r A DialogBox wrapper; call close() when the work is done.
  • _noop ()

  • showInputBoxFiltered (string Message, callback Filter, callback Cb)

    Shows an input box with a predicate filter. The filter callback receives the candidate string and returns true to accept it. The result callback receives the final accepted string.

    • @p Message is the prompt text.
    • @p Filter is a callback (string) -> bool.
    • @p Cb is a callback (string) -> void.
    • @r this object
  • showInputBoxWithCancel (string Message, callback Filter, callback Cb)

    Shows an input box with a Cancel button alongside OK. The callback receives the entered string or null when cancelled.

    • @p Message is the prompt text.
    • @p Filter is a callback (string) -> bool.
    • @p Cb is a callback (string) -> void.
    • @r this object
  • showChoiceBox (string Message, list Options, callback Cb)

    Shows a choice box with the supplied options. The callback receives the selected option.

    • @p Message is the prompt text.
    • @p Options is a list of selectable options.
    • @p Cb is a callback (option) -> void.
    • @r this object
  • showErrorBoxThrowable (object ThrowableObj)

    Shows a Throwable-based error box.

    • @p ThrowableObj is an AussomJavaObject around a Throwable.
    • @r this object
  • showBox (string Message, object ContentObj, list Buttons)

    Shows a generic box with arbitrary content. The buttons list contains JavaFX Button AJOs that close the dialog when clicked.

    • @p Message is the title text.
    • @p ContentObj is an AussomJavaObject around the content Node.
    • @p Buttons is a list of Button AussomJavaObjects.
    • @r this object
  • showProgressBoxBound (string Message, object ProgressObj, callback Cb)

    Shows a progress box bound to the given ReadOnlyDoubleProperty. The supplied callback fires when progress reaches 1.0 and the box auto-dismisses.

    • @p Message is the progress message.
    • @p ProgressObj is an AussomJavaObject around a ReadOnlyDoubleProperty.
    • @p Cb is a callback () -> void fired on completion.
    • @r this object
  • showChoiceBoxVarargs (string Message, callback Cb, FirstOption, list RestOptions)

    Varargs-style showChoiceBox: pass the first option and an Aussom list of additional options. FXGL builds the choice dialog with the combined option list and fires the callback with the selected value.

    • @p Message is the prompt text.
    • @p Cb is a callback (option) -> void.
    • @p FirstOption is the first option (any value).
    • @p RestOptions is a list of the remaining options.
    • @r this object
  • showChoiceBoxEnum (string Message, string EnumClassName, callback Cb)

    Shows a choice box for every value of the named Java enum class. Useful when the choices are an existing enum.

    • @p Message is the prompt text.
    • @p EnumClassName is the fully qualified enum class name.
    • @p Cb is a callback (option) -> void.
    • @r this object