Options
All
  • Public
  • Public/Protected
  • All
Menu

Module SaveLoad

Index

Variables

dataStorage

dataStorage: IDataStorage = new IndexedDbDataStorage()

globalSlot

globalSlot: number = 26

loadedGlobalSlot

loadedGlobalSlot: boolean = false

maxSlots

maxSlots: number = 5

propertiesToSerialize

propertiesToSerialize: ISerializeProperty[] = [// classes{key: "game",property: ["game"]},{key: "player",property: ["player"]},{key: "ui",property: ["ui"]},{key: "world",property: ["world"],skipCompression: true},// other{key: "gameSlotName",property: ["game", "slotName"]},{key: "gameWonGame",property: ["game", "wonGame"]},// mods{key: "saveTime",property: ["SaveLoad", "saveTime"]},{key: "modsSaveData",property: ["Mods", "saveData"]},{key: "modsUnloadable",property: ["Mods", "unloadable"]},{key: "allocatedEnums",property: ["Utilities", "Enums", "allocatedEnums"]}]

propertiesToSerializeGlobal

propertiesToSerializeGlobal: ISerializeProperty[] = [{key: "lastPlayedVersion",property: ["game", "lastPlayedVersion"]},{key: "gamesPlayed",property: ["game", "playedCount"]},{key: "options",property: ["game", "options"]},{key: "crafted",property: ["game", "crafted"]},{key: "newCrafted",property: ["game", "newCrafted"]},{key: "highscores",property: ["game", "highscores"]},{key: "milestoneData",property: ["milestoneData"]},{key: "modsSaveDataGlobal",property: ["Mods", "saveDataGlobal"]},{key: "modState",property: ["Mods", "modState"]},{key: "languagesSaveData",property: ["Languages", "saveData"]}]

saveTime

saveTime: number = 0

Functions

compressSave

  • compressSave(slot: number, saveObject: SaveObject, exporting?: boolean): void
  • Parameters

    • slot: number
    • saveObject: SaveObject
    • Default value exporting: boolean = false

    Returns void

compressString

  • compressString(str: string, exporting?: boolean): string
  • Parameters

    • str: string
    • Default value exporting: boolean = false

    Returns string

createSaveObject

  • Parameters

    • slot: number

    Returns SaveObject

decompressSave

  • decompressSave(slot: number, saveObject: SaveObject, importing?: boolean): void
  • Parameters

    • slot: number
    • saveObject: SaveObject
    • Default value importing: boolean = false

    Returns void

decompressString

  • decompressString(str: string, importing?: boolean): string
  • Parameters

    • str: string
    • Default value importing: boolean = false

    Returns string

deleteAll

  • deleteAll(callback: function): void
  • Parameters

    • callback: function
        • (): void
        • Returns void

    Returns void

deleteSlot

  • deleteSlot(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, success: boolean): void
        • Parameters

          • slot: number
          • success: boolean

          Returns void

    Returns void

exportSave

  • exportSave(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, success: boolean, json: string): void
        • Parameters

          • slot: number
          • success: boolean
          • json: string

          Returns void

    Returns void

getFirstFreeSlot

  • getFirstFreeSlot(callback: function): void
  • Parameters

    • callback: function
        • (slot: number | null): void
        • Parameters

          • slot: number | null

          Returns void

    Returns void

getSaveCount

  • getSaveCount(callback: function, callbackPerSlot?: function): void
  • Parameters

    • callback: function
        • (usedCount: number, usedSlots: number[]): void
        • Parameters

          • usedCount: number
          • usedSlots: number[]

          Returns void

    • Optional callbackPerSlot: function
        • (slot: number, isUsed: boolean): void
        • Parameters

          • slot: number
          • isUsed: boolean

          Returns void

    Returns void

getSaveSlots

  • getSaveSlots(callback: function): void
  • Parameters

    • callback: function
        • (slot: number, isUsed: boolean): void
        • Parameters

          • slot: number
          • isUsed: boolean

          Returns void

    Returns void

importSave

  • importSave(slot: number, data: string, callback: function): void
  • Parameters

    • slot: number
    • data: string
    • callback: function
        • (slot: number | null, bytes: number | null): void
        • Parameters

          • slot: number | null
          • bytes: number | null

          Returns void

    Returns void

initialize

  • initialize(): void
  • Returns void

isEnabled

  • isEnabled(): boolean
  • Returns boolean

isSlotUsed

  • isSlotUsed(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, isUsed: boolean): void
        • Parameters

          • slot: number
          • isUsed: boolean

          Returns void

    Returns void

load

  • load(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, success: boolean): void
        • Parameters

          • slot: number
          • success: boolean

          Returns void

    Returns void

loadPartial

  • loadPartial(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, success: boolean, saveObject: SaveObject): void
        • Parameters

          • slot: number
          • success: boolean
          • saveObject: SaveObject

          Returns void

    Returns void

loadPartialData

  • loadPartialData(saveObject: SaveObject, object: any, key: string, saveObjectKey?: string, skipCompression?: boolean): void
  • Parameters

    • saveObject: SaveObject
    • object: any
    • key: string
    • Default value saveObjectKey: string = key
    • Default value skipCompression: boolean = false

    Returns void

loadPartialDataInside

  • loadPartialDataInside(saveObject: SaveObject, saveObjectKey: string, key?: string | undefined): any
  • Parameters

    • saveObject: SaveObject
    • saveObjectKey: string
    • Default value key: string | undefined = undefined

    Returns any

save

  • save(slot: number, callback: function): void
  • Parameters

    • slot: number
    • callback: function
        • (slot: number, bytes: number): void
        • Parameters

          • slot: number
          • bytes: number

          Returns void

    Returns void

saveObjectToSlot

  • saveObjectToSlot(slot: number, saveObject: SaveObject, callback: function): void
  • Parameters

    • slot: number
    • saveObject: SaveObject
    • callback: function
        • (slot: number, bytes: number): void
        • Parameters

          • slot: number
          • bytes: number

          Returns void

    Returns void

savePartialData

  • savePartialData(slot: number, object: any, key: string, saveObjectKey: string, callback: function): void
  • Parameters

    • slot: number
    • object: any
    • key: string
    • saveObjectKey: string
    • callback: function
        • (slot: number, bytes: number): void
        • Parameters

          • slot: number
          • bytes: number

          Returns void

    Returns void

savePartialDataInside

  • savePartialDataInside(slot: number, saveObjectKey: string, key: string, value: any, callback: function): void
  • Parameters

    • slot: number
    • saveObjectKey: string
    • key: string
    • value: any
    • callback: function
        • (slot: number, bytes: number): void
        • Parameters

          • slot: number
          • bytes: number

          Returns void

    Returns void

transferSaves

  • transferSaves(): void
  • Returns void

useLocalStorage

  • useLocalStorage(): void
  • Returns void

Generated using TypeDoc