Search in sources :

Example 1 with ProgressDialog

use of com.almasb.fxgl.scene.ProgressDialog in project FXGL by AlmasB.

the class RESTClientSample method initInput.

@Override
protected void initInput() {
    onKeyDown(KeyCode.Q, "Get Top", () -> {
        getGameplay().getLeaderboard().loadTopTask(5).onSuccess(scores -> scores.forEach(System.out::println)).executeAsyncWithDialogFX(new ProgressDialog("Connecting to FXGL server"));
    });
    onKeyDown(KeyCode.E, "Put New Score", () -> {
        getGameplay().getLeaderboard().postNewScoreTask(new ScoreData("AlmasB", 9999)).onSuccess(n -> System.out.println("Success put")).executeAsyncWithDialogFX(new ProgressDialog("Uploading to FXGL server"));
    });
}
Also used : KeyCode(javafx.scene.input.KeyCode) DSLKt.onKeyDown(com.almasb.fxgl.app.DSLKt.onKeyDown) GameSettings(com.almasb.fxgl.settings.GameSettings) GameApplication(com.almasb.fxgl.app.GameApplication) ProgressDialog(com.almasb.fxgl.scene.ProgressDialog) ScoreData(com.almasb.fxgl.gameplay.ScoreData) ProgressDialog(com.almasb.fxgl.scene.ProgressDialog) ScoreData(com.almasb.fxgl.gameplay.ScoreData)

Example 2 with ProgressDialog

use of com.almasb.fxgl.scene.ProgressDialog in project FXGL by AlmasB.

the class SaveLoadManager method querySaveFiles.

/**
 * Asynchronously (with a progress dialog) loads save files into observable list {@link #saveFiles()}.
 */
public void querySaveFiles() {
    log.debug("Querying save files");
    loadSaveFilesTask().onSuccess(files -> {
        saveFiles.setAll(files);
        Collections.sort(saveFiles, SaveFile.RECENT_FIRST);
    }).executeAsyncWithDialogFX(new ProgressDialog("Loading save files"));
}
Also used : FS(com.almasb.fxgl.io.FS) FileExtension(com.almasb.fxgl.io.FileExtension) Files(java.nio.file.Files) FXGL(com.almasb.fxgl.app.FXGL) FXCollections(javafx.collections.FXCollections) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) Platform(javafx.application.Platform) List(java.util.List) Paths(java.nio.file.Paths) IOTask(com.almasb.fxgl.io.IOTask) Logger(com.almasb.fxgl.core.logging.Logger) ObservableList(javafx.collections.ObservableList) ProgressDialog(com.almasb.fxgl.scene.ProgressDialog) Path(java.nio.file.Path) Collections(java.util.Collections) ProgressDialog(com.almasb.fxgl.scene.ProgressDialog)

Aggregations

ProgressDialog (com.almasb.fxgl.scene.ProgressDialog)2 DSLKt.onKeyDown (com.almasb.fxgl.app.DSLKt.onKeyDown)1 FXGL (com.almasb.fxgl.app.FXGL)1 GameApplication (com.almasb.fxgl.app.GameApplication)1 Logger (com.almasb.fxgl.core.logging.Logger)1 ScoreData (com.almasb.fxgl.gameplay.ScoreData)1 FS (com.almasb.fxgl.io.FS)1 FileExtension (com.almasb.fxgl.io.FileExtension)1 IOTask (com.almasb.fxgl.io.IOTask)1 GameSettings (com.almasb.fxgl.settings.GameSettings)1 FileNotFoundException (java.io.FileNotFoundException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Platform (javafx.application.Platform)1 FXCollections (javafx.collections.FXCollections)1 ObservableList (javafx.collections.ObservableList)1