Add useItemEvent
This commit is contained in:
parent
5edafac5ca
commit
7ad5ba01e8
@ -310,6 +310,18 @@ var code = '[\n'+action_0+']\n';
|
|||||||
return code;
|
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
|
//为了避免关键字冲突,全部加了_s
|
||||||
//动作
|
//动作
|
||||||
action
|
action
|
||||||
|
|||||||
@ -69,6 +69,7 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['eachArrive_m'].xmlText(),
|
MotaActionBlocks['eachArrive_m'].xmlText(),
|
||||||
MotaActionBlocks['level_m'].xmlText(),
|
MotaActionBlocks['level_m'].xmlText(),
|
||||||
MotaActionBlocks['commonEvent_m'].xmlText(),
|
MotaActionBlocks['commonEvent_m'].xmlText(),
|
||||||
|
MotaActionBlocks['item_m'].xmlText(),
|
||||||
],
|
],
|
||||||
'显示文字':[
|
'显示文字':[
|
||||||
MotaActionBlocks['text_0_s'].xmlText(),
|
MotaActionBlocks['text_0_s'].xmlText(),
|
||||||
|
|||||||
@ -74,6 +74,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_data": "道具效果,仅对cls为tools或constants有效。"
|
"_data": "道具效果,仅对cls为tools或constants有效。"
|
||||||
},
|
},
|
||||||
|
"useItemEvent": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "event",
|
||||||
|
"_event": "item",
|
||||||
|
"_data": "使用本道具所执行的事件"
|
||||||
|
},
|
||||||
"canUseItemEffect": {
|
"canUseItemEffect": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
|||||||
@ -211,6 +211,7 @@
|
|||||||
<option value="firstArrive">firstArrive</option>
|
<option value="firstArrive">firstArrive</option>
|
||||||
<option value="eachArrive">eachArrive</option>
|
<option value="eachArrive">eachArrive</option>
|
||||||
<option value="commonEvent">commonEvent</option>
|
<option value="commonEvent">commonEvent</option>
|
||||||
|
<option value="item">item</option>
|
||||||
</select>
|
</select>
|
||||||
<button onclick="editor_blockly.confirm()">确认</button>
|
<button onclick="editor_blockly.confirm()">确认</button>
|
||||||
<button onclick="editor_blockly.parse()">解析</button>
|
<button onclick="editor_blockly.parse()">解析</button>
|
||||||
|
|||||||
@ -207,6 +207,7 @@
|
|||||||
<option value="firstArrive">firstArrive</option>
|
<option value="firstArrive">firstArrive</option>
|
||||||
<option value="eachArrive">eachArrive</option>
|
<option value="eachArrive">eachArrive</option>
|
||||||
<option value="commonEvent">commonEvent</option>
|
<option value="commonEvent">commonEvent</option>
|
||||||
|
<option value="item">item</option>
|
||||||
</select>
|
</select>
|
||||||
<button onclick="editor_blockly.confirm()">确认</button>
|
<button onclick="editor_blockly.confirm()">确认</button>
|
||||||
<button onclick="editor_blockly.parse()">解析</button>
|
<button onclick="editor_blockly.parse()">解析</button>
|
||||||
|
|||||||
@ -595,12 +595,12 @@ actions.prototype._getClickLoc = function (x, y) {
|
|||||||
size = size * core.domStyle.scale;
|
size = size * core.domStyle.scale;
|
||||||
|
|
||||||
if (core.domStyle.isVertical) {
|
if (core.domStyle.isVertical) {
|
||||||
statusBar.x = 0;
|
statusBar.x = 3;
|
||||||
statusBar.y = core.dom.statusBar.offsetHeight + 3;
|
statusBar.y = core.dom.statusBar.offsetHeight + 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
statusBar.x = core.dom.statusBar.offsetWidth + 3;
|
statusBar.x = core.dom.statusBar.offsetWidth + 3;
|
||||||
statusBar.y = 0;
|
statusBar.y = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
var left = core.dom.gameGroup.offsetLeft + statusBar.x;
|
var left = core.dom.gameGroup.offsetLeft + statusBar.x;
|
||||||
|
|||||||
@ -13,7 +13,10 @@ items.prototype._init = function () {
|
|||||||
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
|
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect;
|
||||||
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
|
if (!items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.equipCondition)
|
||||||
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.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);
|
main.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.useItemEvent[itemId]) {
|
||||||
|
try {
|
||||||
|
core.insertAction(this.useItemEvent[itemId]);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
main.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items.prototype._afterUseItem = function (itemId) {
|
items.prototype._afterUseItem = function (itemId) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user