diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4
index e436f5d6..5bc7ce65 100644
--- a/_server/MotaAction.g4
+++ b/_server/MotaAction.g4
@@ -310,6 +310,18 @@ var code = '[\n'+action_0+']\n';
return code;
*/;
+//item 事件编辑器入口之一
+item_m
+ : '使用道具事件' BGNL? Newline action+ BEND
+
+
+/* item_m
+tooltip : 使用道具事件
+helpUrl : https://h5mota.com/games/template/_docs/#/event
+var code = '[\n'+action_0+']\n';
+return code;
+*/;
+
//为了避免关键字冲突,全部加了_s
//动作
action
diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js
index f40b7fb9..090ba314 100644
--- a/_server/editor_blockly.js
+++ b/_server/editor_blockly.js
@@ -69,6 +69,7 @@ editor_blockly = function () {
MotaActionBlocks['eachArrive_m'].xmlText(),
MotaActionBlocks['level_m'].xmlText(),
MotaActionBlocks['commonEvent_m'].xmlText(),
+ MotaActionBlocks['item_m'].xmlText(),
],
'显示文字':[
MotaActionBlocks['text_0_s'].xmlText(),
diff --git a/_server/table/comment.js b/_server/table/comment.js
index 20783952..47741b22 100644
--- a/_server/table/comment.js
+++ b/_server/table/comment.js
@@ -74,6 +74,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_lint": true,
"_data": "道具效果,仅对cls为tools或constants有效。"
},
+ "useItemEvent": {
+ "_leaf": true,
+ "_type": "event",
+ "_event": "item",
+ "_data": "使用本道具所执行的事件"
+ },
"canUseItemEffect": {
"_leaf": true,
"_type": "textarea",
diff --git a/editor-mobile.html b/editor-mobile.html
index d586ea90..6b81757f 100644
--- a/editor-mobile.html
+++ b/editor-mobile.html
@@ -211,6 +211,7 @@
+
diff --git a/editor.html b/editor.html
index 9622674b..f1d5eadd 100644
--- a/editor.html
+++ b/editor.html
@@ -207,6 +207,7 @@
+
diff --git a/libs/actions.js b/libs/actions.js
index 8ecc7460..9f63d0bd 100644
--- a/libs/actions.js
+++ b/libs/actions.js
@@ -595,12 +595,12 @@ actions.prototype._getClickLoc = function (x, y) {
size = size * core.domStyle.scale;
if (core.domStyle.isVertical) {
- statusBar.x = 0;
+ statusBar.x = 3;
statusBar.y = core.dom.statusBar.offsetHeight + 3;
}
else {
statusBar.x = core.dom.statusBar.offsetWidth + 3;
- statusBar.y = 0;
+ statusBar.y = 3;
}
var left = core.dom.gameGroup.offsetLeft + statusBar.x;
diff --git a/libs/items.js b/libs/items.js
index ad841add..8f964f81 100644
--- a/libs/items.js
+++ b/libs/items.js
@@ -13,7 +13,10 @@ items.prototype._init = function () {
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition = {};
+ if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent)
+ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent = {};
this.equipCondition = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition;
+ this.useItemEvent = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEvent;
}
////// 获得所有道具 //////
@@ -116,6 +119,14 @@ items.prototype._useItemEffect = function (itemId) {
main.log(e);
}
}
+ if (this.useItemEvent[itemId]) {
+ try {
+ core.insertAction(this.useItemEvent[itemId]);
+ }
+ catch (e) {
+ main.log(e);
+ }
+ }
}
items.prototype._afterUseItem = function (itemId) {