赞 | 31 |
VIP | 0 |
好人卡 | 0 |
积分 | 37 |
经验 | 0 |
最后登录 | 2024-1-10 |
在线时间 | 314 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3707
- 在线时间
- 314 小时
- 注册时间
- 2019-8-9
- 帖子
- 206
|
3楼
楼主 |
发表于 2021-1-28 12:35:10
|
只看该作者
遗憾,还是没能解决,可否再看一下,以下为我写的代码
- DataManager.maxSavefiles = function () {
- return 1;
- };
- DataManager.isAnySavefileExists = function() {
- return true;
- };
- StorageManager.saveToLocalFile = function (savefileId, json) {
- Network.instance.sendSaveJson(json);//发送至服务器
- // // 数据 = LZString 压缩到基准64(json)
- // var data = LZString.compressToBase64(json);
- // // fs = 要求("fs")
- // var fs = require('fs');
- // // 目录路径 = 本地文件目录路径()
- // var dirPath = this.localFileDirectoryPath();
- // // 文件路径 = 本地文件路径( 保存文件id )
- // var filePath = this.localFilePath(savefileId);
- // //如果(不是 fs 存在(目录路径))
- // if (!fs.existsSync(dirPath)) {
- // //fs 建立目录(目录路径)
- // fs.mkdirSync(dirPath);
- // }
- // //fs 写入文件(文件路径, 数据 )
- // fs.writeFileSync(filePath, data);
-
- };
- Scene_Title.prototype.commandContinue = function() {//点击继续游戏的指令
- function LoadGameContents(contents){
- DataManager.createGameObjects();
- DataManager.extractSaveContents(JsonEx.parse(contents));
-
- if(typeof SceneManager._scene.fadeOutAll !== "undefined"){
- if(SceneManager._scene.fadeOutAll){
- SceneManager._scene.fadeOutAll();
- }
- }
-
- if(typeof SceneManager._scene.reloadMapIfUpdated !== "undefined"){
- if(SceneManager._scene.reloadMapIfUpdated){
- SceneManager._scene.reloadMapIfUpdated();
- }
- }
-
- if(typeof $gameSystem.onAfterLoad !== "undefined"){
- if($gameSystem.onAfterLoad){
- try{
- $gameSystem.onAfterLoad();
- }catch(e){
- console.error(e);
- }
- }
- }
- SceneManager.goto(Scene_Map);
- }
- var json = Network.instance.saveJson;//获取字符串
- LoadGameContents(json);
- };
复制代码
以下为报错- TypeError: Cannot read property 'onAfterLoad' of undefined
- at LoadGameContents (SfcySaveOnline.js:45)
- at Scene_Title.commandContinue (SfcySaveOnline.js:57)
- at Window_TitleCommand.Window_Selectable.callHandler (rpg_windows.js:902)
- at Window_TitleCommand.Window_Command.callOkHandler (rpg_windows.js:1426)
- at Window_TitleCommand.Window_Selectable.processOk (rpg_windows.js:1156)
- at Window_TitleCommand.processOk (rpg_windows.js:5763)
- at Window_TitleCommand.Window_Selectable.onTouch (rpg_windows.js:1086)
- at Window_TitleCommand.Window_Selectable.processTouch (rpg_windows.js:1054)
- at Window_TitleCommand.Window_Selectable.update (rpg_windows.js:986)
- at rpg_core.js:7035
复制代码
获取到的字符串- "[null,{"globalId":"RPGMV","title":"test","characters":[["Actor1",0],["Actor1",0],["Actor1",0],["Actor1",0],["Actor1",0]],"faces":[["face1",5],["face1",1],["face1",2],["face1",3],["face1",4]],"playtime":"00:00:47","timestamp":1611762819517}]"
复制代码 |
|