skip Sleep
This commit is contained in:
parent
f49c68799c
commit
bf7913576f
@ -788,10 +788,15 @@ name是可选的,代表目标行走图的文件名。
|
|||||||
``` js
|
``` js
|
||||||
"x,y": [ // 实际执行的事件列表
|
"x,y": [ // 实际执行的事件列表
|
||||||
{"type": "sleep", "time": 1000}, // 等待1000ms
|
{"type": "sleep", "time": 1000}, // 等待1000ms
|
||||||
"等待1000ms后才开始执行这个事件"
|
"等待1000ms后才开始执行这个事件",
|
||||||
|
{"type": "sleep", "time": 2000, "noSkip": true}, // 等待2000毫秒,且不可被跳过
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
默认的等待事件可以被Ctrl跳过,下面两种情况下不可呗跳过:
|
||||||
|
- 加上`"noSkip": true`后
|
||||||
|
- 当前存在尚未执行完毕的异步事件。
|
||||||
|
|
||||||
### battle:强制战斗
|
### battle:强制战斗
|
||||||
|
|
||||||
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
||||||
|
|||||||
@ -700,11 +700,12 @@ actions.prototype.keyDownCtrl = function () {
|
|||||||
}
|
}
|
||||||
if (core.status.event.id=='action' && core.status.event.data.type=='sleep'
|
if (core.status.event.id=='action' && core.status.event.data.type=='sleep'
|
||||||
&& !core.status.event.data.current.noSkip) {
|
&& !core.status.event.data.current.noSkip) {
|
||||||
if (core.isset(core.timeout.sleepTimeout)) {
|
if (core.isset(core.timeout.sleepTimeout) && Object.keys(core.animateFrame.asyncId).length==0) {
|
||||||
clearTimeout(core.timeout.sleepTimeout);
|
clearTimeout(core.timeout.sleepTimeout);
|
||||||
core.timeout.sleepTimeout = null;
|
core.timeout.sleepTimeout = null;
|
||||||
core.events.doAction();
|
core.events.doAction();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1209,7 +1209,7 @@ events.prototype.doAction = function() {
|
|||||||
case "waitAsync": // 等待所有异步事件执行完毕
|
case "waitAsync": // 等待所有异步事件执行完毕
|
||||||
{
|
{
|
||||||
var test = window.setInterval(function () {
|
var test = window.setInterval(function () {
|
||||||
if (Object.keys(core.animateFrame.asyncId)==0) {
|
if (Object.keys(core.animateFrame.asyncId).length==0) {
|
||||||
clearInterval(test);
|
clearInterval(test);
|
||||||
core.events.doAction();
|
core.events.doAction();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user