Options
All
  • Public
  • Public/Protected
  • All
Menu

The game storage system. This class holds the game custom states. States can hold values of boolean, number, string and position (x and y) types. When setting a state value, callbacks can be called in the there are some them associated. There's also in this class an engine storage for internal states management. User can't control this last one.

Hierarchy

  • Storage

Index

Constructors

Properties

_engine_storage: {} = {}

Type declaration

  • [key_name: string]: StorageRecord
_internal_storage: {} = {}

Type declaration

  • [key_name: string]: StorageRecord
data: GoldenSun

Accessors

  • get engine_storage(): {}
  • get internal_storage(): {}

Methods

  • Adds a new game state.

    Parameters

    • key_name: string

      the state unique key name.

    • type: storage_types

      the type of the this state value.

    • initial_value: string | number | boolean | StoragePosition = null

      the initial value of the state.

    • engine_storage: boolean = false

      if true, will use engine storage instead of default storage.

    Returns void

  • Adds a callback to a state. It will be called when the value of this state change.

    Parameters

    • key_name: string

      the state unique key name.

    • callback: (() => void)

      the callback function.

        • (): void
        • Returns void

    • call_type: callback_call_types

      the call type of this callback. Can be "once" or "multiple".

    Returns number

    returns the binding id.

  • Gets the value of a state.

    Parameters

    • key_name: string

      the state unique key name.

    Returns string | number | boolean | StoragePosition

    returns the state value.

  • get_object(key_name: string): StorageRecord
  • Gets the storage object of a state.

    Parameters

    • key_name: string

      the state unique key name.

    Returns StorageRecord

    returns the storage object

  • init(): void
  • remove(key_name: string): void
  • Removes a state from the internal storage.

    Parameters

    • key_name: string

      the state unique key name.

    Returns void

  • remove_callback(key_name: string, callback_id: string | number): void
  • Removes a callback from a state.

    Parameters

    • key_name: string

      the state unique key name.

    • callback_id: string | number

      the callback id.

    Returns void

  • set(key_name: string, value: string | number | boolean | StoragePosition, engine_storage?: boolean): void
  • Sets a value of a state;

    Parameters

    • key_name: string

      the state unique key name.

    • value: string | number | boolean | StoragePosition

      the new state value to be set.

    • engine_storage: boolean = false

      if true, will use engine storage instead of default storage.

    Returns void

Generated using TypeDoc