event:wait
This commit is contained in:
parent
49679ff24d
commit
fd57f77c95
@ -168,6 +168,7 @@ action
|
||||
| setHeroIcon_s
|
||||
| update_s
|
||||
| sleep_s
|
||||
| wait_s
|
||||
| battle_s
|
||||
| openDoor_s
|
||||
| changeFloor_s
|
||||
@ -455,6 +456,18 @@ var code = '{"type": "sleep", "time": '+Int_0+'},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
wait_s
|
||||
: '等待用户操作'
|
||||
;
|
||||
|
||||
/* wait_s
|
||||
tooltip : wait: 等待用户操作
|
||||
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=wait-%e7%ad%89%e5%be%85%e7%94%a8%e6%88%b7%e6%93%8d%e4%bd%9c
|
||||
colour : this.soundColor
|
||||
var code = '{"type": "wait"},\n';
|
||||
return code;
|
||||
*/
|
||||
|
||||
battle_s
|
||||
: '强制战斗' IdString Newline
|
||||
;
|
||||
@ -1433,6 +1446,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['sleep_s'].xmlText([
|
||||
data.time,this.next]);
|
||||
break;
|
||||
case "wait": // 等待用户操作
|
||||
this.next = MotaActionBlocks['wait_s'].xmlText([
|
||||
this.next]);
|
||||
break;
|
||||
case "revisit": // 立刻重新执行该事件
|
||||
this.next = MotaActionBlocks['revisit_s'].xmlText([
|
||||
this.next]);
|
||||
|
||||
@ -102,6 +102,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['disableShop_s'].xmlText(),
|
||||
'<label text="特效/声音"></label>',
|
||||
MotaActionBlocks['sleep_s'].xmlText(),
|
||||
MotaActionBlocks['wait_s'].xmlText(),
|
||||
MotaActionBlocks['animate_s'].xmlText(),
|
||||
MotaActionBlocks['setFg_0_s'].xmlText(),
|
||||
MotaActionBlocks['setFg_1_s'].xmlText(),
|
||||
|
||||
@ -519,6 +519,10 @@ name是可选的,代表目标行走图的文件名。
|
||||
]
|
||||
```
|
||||
|
||||
### wait:等待用户操作
|
||||
|
||||
使用 `{"type": "wait"}` 可以等待用户进行操作(如点击、回车等)。
|
||||
|
||||
### battle: 强制战斗
|
||||
|
||||
调用battle可强制与某怪物进行战斗(而无需去触碰到它)。
|
||||
|
||||
@ -712,7 +712,7 @@ actions.prototype.longClick = function () {
|
||||
core.drawText();
|
||||
return true;
|
||||
}
|
||||
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
|
||||
if (core.status.event.id=='action' && (core.status.event.data.type=='text' || core.status.event.data.type=='wait')) {
|
||||
core.doAction();
|
||||
return true;
|
||||
}
|
||||
@ -725,7 +725,7 @@ actions.prototype.keyDownCtrl = function () {
|
||||
core.drawText();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
|
||||
if (core.status.event.id=='action' && (core.status.event.data.type=='text' || core.status.event.data.type=='wait')) {
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
@ -766,7 +766,7 @@ actions.prototype.keyUpConfirmBox = function (keycode) {
|
||||
////// 自定义事件时的点击操作 //////
|
||||
actions.prototype.clickAction = function (x,y) {
|
||||
|
||||
if (core.status.event.data.type=='text') {
|
||||
if (core.status.event.data.type=='text' || core.status.event.data.type=='wait') {
|
||||
// 文字
|
||||
core.doAction();
|
||||
return;
|
||||
@ -808,7 +808,7 @@ actions.prototype.keyDownAction = function (keycode) {
|
||||
|
||||
////// 自定义事件时,放开某个键的操作 //////
|
||||
actions.prototype.keyUpAction = function (keycode) {
|
||||
if (core.status.event.data.type=='text' && (keycode==13 || keycode==32 || keycode==67)) {
|
||||
if ((core.status.event.data.type=='text' || core.status.event.data.type=='wait') && (keycode==13 || keycode==32 || keycode==67)) {
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@ enemys.prototype.hasSpecial = function (special, test) {
|
||||
|
||||
////// 获得所有特殊属性的名称 //////
|
||||
enemys.prototype.getSpecialText = function (enemyId) {
|
||||
if (enemyId == undefined) return "";
|
||||
var enemy = this.enemys[enemyId];
|
||||
var enemy = core.material.enemys[enemyId];
|
||||
if (!core.isset(enemy)) return [];
|
||||
var special = enemy.special;
|
||||
var text = [];
|
||||
if (this.hasSpecial(special, 1)) text.push("先攻");
|
||||
|
||||
@ -57,8 +57,7 @@ events.prototype.init = function () {
|
||||
callback();
|
||||
},
|
||||
'action': function (data, core, callback) {
|
||||
core.events.doEvents(data.event.data, data.x, data.y);
|
||||
if (core.isset(callback)) callback();
|
||||
core.events.insertAction(data.event.data, data.x, data.y, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -670,6 +669,10 @@ events.prototype.doAction = function() {
|
||||
}, data.time);
|
||||
}
|
||||
break;
|
||||
case "wait":
|
||||
if (core.status.replay.replaying)
|
||||
core.events.doAction();
|
||||
break;
|
||||
case "revisit": // 立刻重新执行该事件
|
||||
{
|
||||
var block=core.getBlock(x,y); // 重新获得事件
|
||||
|
||||
@ -167,6 +167,8 @@ utils.prototype.formatBigNumber = function (x) {
|
||||
x = parseFloat(x);
|
||||
if (!core.isset(x)) return '???';
|
||||
|
||||
if (x<=999999) return x;
|
||||
|
||||
var all = [
|
||||
{"val": 1e20, "c": "g"},
|
||||
{"val": 1e16, "c": "j"},
|
||||
@ -177,7 +179,7 @@ utils.prototype.formatBigNumber = function (x) {
|
||||
|
||||
for (var i=0;i<all.length;i++) {
|
||||
var one = all[i];
|
||||
if (x>=100*one.val) {
|
||||
if (x>=10*one.val) {
|
||||
var v = x/one.val;
|
||||
return v.toFixed(Math.max(0, Math.floor(4-Math.log10(v+1)))) + one.c;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user