赞 | 5 |
VIP | 0 |
好人卡 | 0 |
积分 | 20 |
经验 | 0 |
最后登录 | 2024-11-21 |
在线时间 | 54 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2044
- 在线时间
- 54 小时
- 注册时间
- 2021-11-20
- 帖子
- 27
|
??你这个AndroidInterface哪来的??如果自己的安卓项目里没有这个定义必定报错,dirPath的定义和使用和hh_Android_save.js里的一模一样,定义了未使用
自己抄人大佬的插件也不给个出处好意思吗
原出处github插件地址
- StorageManager.isLocalMode = function () {
- if (Utils.isNwjs() || (Utils.isMobileDevice() && window.AndroidInterface)) {
- return true;
- }
- };
- StorageManager.backup = function(savefileId) {
- if (this.exists(savefileId)) {
- if (this.isLocalMode()) {
- if (Utils.isMobileDevice()) {
- AndroidInterface.backupdata(savefileId);
- } else {
- const json = this.loadFromLocalFileMZ(savefileId);
- const zip = pako.deflate(json, { to: "string", level: 1 });
- const dirPath = this.localFileDirectoryPath();
- const filePath = this.localFilePath(savefileId) + ".bak";
- this.fsMkdir(dirPath);
- this.fsWriteFile(filePath, zip);
- }
- } else {
- const json = this.loadFromWebStorageMZ(savefileId);
- const zip = pako.deflate(json, { to: "string", level: 1 });
- const key = this.webStorageKey(savefileId) + "bak";
- localStorage.setItem(key, zip);
- }
- }
- };
- StorageManager.cleanBackup = function(savefileId) {
- if (this.backupExists(savefileId)) {
- if (this.isLocalMode()) {
- if (Utils.isMobileDevice()) {
- AndroidInterface.cleanbackup(savefileId);
- } else {
- const dirPath = this.localFileDirectoryPath();
- const filePath = this.localFilePath(savefileId);
- this.fsUnlink(filePath + ".bak");
- }
- } else {
- const key = this.webStorageKey(savefileId);
- localStorage.removeItem(key + "bak");
- }
- }
- };
复制代码 |
|