Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: OfflineTimer

[15:7] extends: LocalTimer

Wraps FXGL's OfflineTimer (com.almasb.fxgl.time.OfflineTimer), a persisted-across-restarts capture timer for "24-hour reward" style features. The last capture() time is written to a Bundle so it survives game restarts when the Bundle is persisted via SaveLoadService.

Methods

  • OfflineTimer (string Name = "default", BundleObj = null)

    Creates a new OfflineTimer with the given name backed by the supplied Bundle.

    • @p Name is the unique key prefix for this timer (e.g. "daily_login").
    • @p BundleObj is a Bundle wrapper that persists the state.
  • adopt (object Ajo)

    Wraps an existing OfflineTimer AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an OfflineTimer.
    • @r A new wrapper.
  • getName ()

    Returns the timer name.

  • capture ()

    Records "now" as the last-capture time inside the bundle.

    • @r this object
  • elapsed (double DurationSeconds)

    Returns true when the elapsed time since last capture() exceeds DurationSeconds. Auto-captures and returns true on the first call.

    • @p DurationSeconds is the threshold in seconds.
    • @r A bool.