type:autosave

This commit is contained in:
oc 2019-04-17 13:30:36 +08:00
parent 2eeaf5de03
commit cbd2f650a5
5 changed files with 47 additions and 4 deletions

View File

@ -1400,6 +1400,10 @@ async可选如果为true则会异步执行即不等待当前事件执行
在玩家进行一次存档,或者直接点返回游戏后,将接着执行后面的事件。录像播放将会跳过本事件。
### autoSave自动存档
`{"type": "autoSave"}` 可以立刻进行一次自动存档。录像播放不会跳过本事件。
### callLoad呼出读档界面
`{"type": "callLoad"}` 可以呼出读档页面并允许玩家进行读档。

View File

@ -338,6 +338,7 @@ action
| confirm_s
| callBook_s
| callSave_s
| autoSave_s
| callLoad_s
| unknown_s
| function_s
@ -1799,7 +1800,7 @@ callSave_s
/* callSave_s
tooltip : callSave: 呼出存档页面之后读此档将执行eachArrive
tooltip : callSave: 呼出存档页面
helpUrl : https://h5mota.com/games/template/docs/#/event?id=callSave%ef%bc%9a%e5%91%bc%e5%87%ba%e5%ad%98%e6%a1%a3%e7%95%8c%e9%9d%a2
colour : this.soundColor
var code = '{"type": "callSave"},\n';
@ -1807,6 +1808,19 @@ return code;
*/;
autoSave_s
: '自动存档'
/* autoSave_s
tooltip : autoSave: 自动存档
helpUrl : https://h5mota.com/games/template/docs/#/event?id=autoSave%ef%bc%9a%e8%87%aa%e5%8a%a8%e5%ad%98%e6%a1%a3
colour : this.soundColor
var code = '{"type": "autoSave"},\n';
return code;
*/;
callLoad_s
: '呼出读档页面'
@ -2750,6 +2764,10 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['callSave_s'].xmlText([
this.next]);
break;
case "autoSave": // 自动存档
this.next = MotaActionBlocks['autoSave_s'].xmlText([
this.next]);
break;
case "callLoad": // 呼出读档界面
this.next = MotaActionBlocks['callLoad_s'].xmlText([
this.next]);

View File

@ -161,6 +161,7 @@ editor_blockly = function () {
MotaActionBlocks['setVolume_s'].xmlText(),
MotaActionBlocks['callBook_s'].xmlText(),
MotaActionBlocks['callSave_s'].xmlText(),
MotaActionBlocks['autoSave_s'].xmlText(),
MotaActionBlocks['callLoad_s'].xmlText(),
],
'原生脚本':[

View File

@ -1480,14 +1480,28 @@ control.prototype._replayAction_key = function (action) {
////// 自动存档 //////
control.prototype.autosave = function (removeLast) {
if (core.status.event.id!=null) return;
var inEvent = false; // 检测是否是事件中的自动存档
if (core.status.event.id!=null) {
if (core.status.event.id!='action') return;
inEvent = true;
}
var x=null;
if (removeLast) x=core.status.route.pop();
core.status.route.push("turn:"+core.getHeroLoc('direction'));
if (inEvent) {
core.setFlag("__events__", core.clone(core.status.event.data));
}
else {
core.status.route.push("turn:"+core.getHeroLoc('direction'));
}
core.saves.autosave.data = core.saveData();
core.saves.autosave.updated = true;
core.saves.ids[0] = true;
core.status.route.pop();
if (inEvent) {
core.removeFlag("__events__");
}
else {
core.status.route.pop();
}
if (x) core.status.route.push(x);
}

View File

@ -1579,6 +1579,12 @@ events.prototype._action_callSave = function (data, x, y, prefix) {
}
}
events.prototype._action_autoSave = function (data, x, y, prefix) {
core.autosave();
core.drawTip("已自动存档");
core.doAction();
}
events.prototype._action_callLoad = function (data, x, y, prefix) {
if (this.__action_checkReplaying()) return;
var e = core.clone(core.status.event.data);