Ctrl skip sleep
This commit is contained in:
parent
4bdf1c2ad3
commit
be5c13f717
@ -857,15 +857,16 @@ return code;
|
||||
*/;
|
||||
|
||||
sleep_s
|
||||
: '等待' Int '毫秒' Newline
|
||||
: '等待' Int '毫秒' '不可被Ctrl跳过' Bool Newline
|
||||
|
||||
|
||||
/* sleep_s
|
||||
tooltip : sleep: 等待多少毫秒
|
||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=sleep%EF%BC%9A%E7%AD%89%E5%BE%85%E5%A4%9A%E5%B0%91%E6%AF%AB%E7%A7%92
|
||||
default : [500]
|
||||
default : [500, false]
|
||||
colour : this.soundColor
|
||||
var code = '{"type": "sleep", "time": '+Int_0+'},\n';
|
||||
Bool_0 = Bool_0?', "noSkip": true':'';
|
||||
var code = '{"type": "sleep", "time": '+Int_0+Bool_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2354,7 +2355,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "sleep": // 等待多少毫秒
|
||||
this.next = MotaActionBlocks['sleep_s'].xmlText([
|
||||
data.time||0,this.next]);
|
||||
data.time||0,data.noSkip||false,this.next]);
|
||||
break;
|
||||
case "wait": // 等待用户操作
|
||||
this.next = MotaActionBlocks['wait_s'].xmlText([
|
||||
|
||||
@ -698,6 +698,14 @@ actions.prototype.keyDownCtrl = function () {
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='action' && core.status.event.data.type=='sleep'
|
||||
&& !core.status.event.data.current.noSkip) {
|
||||
if (core.isset(core.timeout.sleepTimeout)) {
|
||||
clearTimeout(core.timeout.sleepTimeout);
|
||||
core.timeout.sleepTimeout = null;
|
||||
core.events.doAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////
|
||||
|
||||
@ -20,6 +20,7 @@ function core() {
|
||||
'getItemTipTimeout': null,
|
||||
'turnHeroTimeout': null,
|
||||
'onDownTimeout': null,
|
||||
'sleepTimeout': null,
|
||||
}
|
||||
this.interval = {
|
||||
'heroMoveInterval': null,
|
||||
|
||||
@ -1178,7 +1178,8 @@ events.prototype.doAction = function() {
|
||||
}
|
||||
break;
|
||||
case "sleep": // 等待多少毫秒
|
||||
setTimeout(function() {
|
||||
core.timeout.sleepTimeout = setTimeout(function() {
|
||||
core.timeout.sleepTimeout = null;
|
||||
core.events.doAction();
|
||||
}, core.status.replay.replaying?20:data.time);
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user