.StorageManager
管理保存游戏数据的存储的静态类。
The static class that manages storage for saving game data.
Kind: static class
.save(savefileId, json)
保存数据到存储
Save data to storage
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
json | String | The JSON data to save - 要保存的 JSON 数据 |
.load(savefileId) ⇒ String
从存储加载数据
Load data from storage
Kind: static function
Returns: String
- The loaded JSON data - 加载的 JSON 数据
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.exists(savefileId) ⇒ Boolean
检查存档是否存在
Check if save file exists
Kind: static function
Returns: Boolean
- True if the save file exists - 存档文件是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.remove(savefileId)
移除存档
Remove save file
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.backup(savefileId)
备份存档
Backup save file
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.backupExists(savefileId) ⇒ Boolean
检查备份是否存在
Check if backup exists
Kind: static function
Returns: Boolean
- True if backup exists - 备份是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.cleanBackup(savefileId)
清除备份
Clean backup
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.restoreBackup(savefileId)
还原备份
Restore backup
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.isLocalMode() ⇒ Boolean
检查是否本地模式
在 PC 平台上使用 NW.js,即为本地模式。
Check if in local mode
Uses NW.js on PC platform as local mode.
Kind: static function
Returns: Boolean
- True if in local mode - 是否为本地模式
.saveToLocalFile(savefileId, json)
保存到本地文件
Save to local file
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
json | String | The JSON data to save - 要保存的 JSON 数据 |
.loadFromLocalFile(savefileId) ⇒ String
从本地文件加载
Load from local file
Kind: static function
Returns: String
- The loaded data - 加载的数据
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.loadFromLocalBackupFile(savefileId) ⇒ String
从本地备份文件加载
Load from local backup file
Kind: static function
Returns: String
- The loaded backup data - 加载的备份数据
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.localFileBackupExists(savefileId) ⇒ Boolean
检查本地文件备份是否存在
Check if local file backup exists
Kind: static function
Returns: Boolean
- True if backup exists - 备份是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.localFileExists(savefileId) ⇒ Boolean
检查本地文件是否存在
Check if local file exists
Kind: static function
Returns: Boolean
- True if file exists - 文件是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.removeLocalFile(savefileId)
移除本地文件
Remove local file
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.saveToWebStorage(savefileId, json)
保存到浏览器存储
Save to web storage
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
json | String | The JSON data to save - 要保存的 JSON 数据 |
.loadFromWebStorage(savefileId) ⇒ String
从浏览器存储加载
Load from web storage
Kind: static function
Returns: String
- The loaded data - 加载的数据
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.loadFromWebStorageBackup(savefileId) ⇒ String
从浏览器存储备份加载
Load from web storage backup
Kind: static function
Returns: String
- The loaded backup data - 加载的备份数据
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.webStorageBackupExists(savefileId) ⇒ Boolean
检查浏览器存储备份是否存在
Check if web storage backup exists
Kind: static function
Returns: Boolean
- True if backup exists - 备份是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.webStorageExists(savefileId) ⇒ Boolean
检查浏览器存储是否存在
Check if web storage exists
Kind: static function
Returns: Boolean
- True if storage exists - 存储是否存在
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.removeWebStorage(savefileId)
移除浏览器存储
Remove web storage
Kind: static function
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.localFileDirectoryPath() ⇒ String
获取本地文件目录路径
Get local file directory path
Kind: static function
Returns: String
- The directory path - 目录路径
.localFilePath(savefileId) ⇒ String
获取本地文件路径
Get local file path
Kind: static function
Returns: String
- The file path - 文件路径
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |
.webStorageKey(savefileId) ⇒ String
获取浏览器存储键名
Get web storage key
Kind: static function
Returns: String
- The storage key - 存储键名
Param | Type | Description |
---|---|---|
savefileId | Number | The save file ID - 存档文件 ID |