insertCommonEvent
This commit is contained in:
parent
2feed20190
commit
60d5e2cc08
@ -1010,12 +1010,24 @@ events.prototype.insertAction = function (action, x, y, callback, addToLast) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 往当前事件列表之前或之后添加一个公共事件 //////
|
////// 往当前事件列表之前或之后添加一个公共事件 //////
|
||||||
events.prototype.insertCommonEvent = function (name, x, y, callback, addToLast) {
|
events.prototype.insertCommonEvent = function (name, args, x, y, callback, addToLast) {
|
||||||
var commonEvent = this.getCommonEvent(name);
|
var commonEvent = this.getCommonEvent(name);
|
||||||
if (!commonEvent) {
|
if (!commonEvent) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置参数
|
||||||
|
core.setFlag('arg0', name);
|
||||||
|
if (args instanceof Array) {
|
||||||
|
for (var i = 0; i < args.length; ++i) {
|
||||||
|
try {
|
||||||
|
if (args[i] != null)
|
||||||
|
core.setFlag('arg'+(i+1), args[i]);
|
||||||
|
} catch (e) { main.log(e); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.insertAction({"type": "dowhile", "condition": "false", "data": commonEvent}, x, y, callback, addToLast);
|
this.insertAction({"type": "dowhile", "condition": "false", "data": commonEvent}, x, y, callback, addToLast);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1629,20 +1641,19 @@ events.prototype._action_trigger = function (data, x, y, prefix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._action_insert = function (data, x, y, prefix) {
|
events.prototype._action_insert = function (data, x, y, prefix) {
|
||||||
// 设置参数
|
|
||||||
if (data.args instanceof Array) {
|
|
||||||
for (var i = 0; i < data.args.length; ++i) {
|
|
||||||
try {
|
|
||||||
if (data.args[i] != null)
|
|
||||||
core.setFlag('arg'+(i+1), data.args[i]);
|
|
||||||
} catch (e) { main.log(e); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (data.name) { // 公共事件
|
if (data.name) { // 公共事件
|
||||||
core.setFlag('arg0', data.name);
|
|
||||||
core.insertCommonEvent(data.name);
|
core.insertCommonEvent(data.name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// 设置参数
|
||||||
|
if (data.args instanceof Array) {
|
||||||
|
for (var i = 0; i < data.args.length; ++i) {
|
||||||
|
try {
|
||||||
|
if (data.args[i] != null)
|
||||||
|
core.setFlag('arg'+(i+1), data.args[i]);
|
||||||
|
} catch (e) { main.log(e); }
|
||||||
|
}
|
||||||
|
}
|
||||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||||
core.setFlag('arg0', loc);
|
core.setFlag('arg0', loc);
|
||||||
var floorId = data.floorId;
|
var floorId = data.floorId;
|
||||||
|
|||||||
@ -113,7 +113,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shop.commonEvent) {
|
if (shop.commonEvent) {
|
||||||
core.insertAction({ "type": "insert", "name": shop.commonEvent, "args": shop.args });
|
core.insertCommonEvent(shop.commonEvent, shop.args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user