光标绘制打包至事件

This commit is contained in:
草莓 2024-12-04 00:50:18 +08:00
parent a74756a376
commit 89906515ac
7 changed files with 325 additions and 2 deletions

View File

@ -947,6 +947,8 @@ action
| drawSelector_1_s
| unknown_s
| function_s
| changeMouse_s
| removeMouse_s
| pass_s
;
@ -1813,6 +1815,31 @@ var code = '{"type": "sleep", "time": '+Int_0+Bool_0+'},\n';
return code;
*/;
changeMouse_s
: '鼠标指针变更为' EvalString '在' Div_List? ',' '画布偏移X' Number? '画布偏移Y' Number? 'X轴缩放' Number? 'Y轴缩放' Number '顺时针转角' Number '点击X偏移' Number '点击Y偏移' Number Newline
/* changeMouse_s
tooltip : changeMouse设置鼠标在某个区域内的光标
helpUrl : /_docs/#/instruction
colour : this.soundColor
allIds : ['EvalString_0']
default : ["sword","gameGroup",0,0,1,1,0,0,0]
var translate = JSON.stringify([Number_0,Number_1]);
var scale=JSON.stringify([Number_2,Number_3]);
var code = '{"type": "changeMouse", "icon":"'+EvalString_0+'","div":"'+Div_List_0+'","translate":'+translate+',"scale":'+scale+',"angle":'+Number_4+',"px":'+Number_5+',"py":'+Number_6+'},\n';
return code;
*/;
removeMouse_s
: '清除在' Div_List? '上进行的鼠标指针变更'
/* removeMouse_s
tooltip : removeMouse清除鼠标在某个区域内的光标设置
helpUrl : /_docs/#/instruction
colour : this.soundColor
default : ["gameGroup"]
var code = '{"type": "removeMouse", "div": "'+Div_List_0+'"},\n';
return code;
*/;
battle_s
: '强制战斗' IdString Newline
@ -4154,6 +4181,10 @@ Key_List
: '黄钥匙'|'蓝钥匙'|'红钥匙'|'绿钥匙'|'铁门钥匙'
/*Key_List ['yellowKey','blueKey','redKey','greenKey','steelKey']*/;
Div_List
: '游戏画面'|'战斗区域'
/*Div_List ['gameGroup','gameDraw']*/;
Move_List
: '上'|'下'|'左'|'右'|'前'|'后'|'左上'|'左下'|'右上'|'右下'|'设置速度'
/*Move_List ['up','down','left','right','forward','backward','leftup','leftdown','rightup','rightdown','speed']*/;

View File

@ -976,6 +976,15 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['stopAsync_s'].xmlText([
this.next]);
break;
case "changeMouse":
this.next = MotaActionBlocks['changeMouse_s'].xmlText([
data.icon,data.div,data.translate[0],data.translate[1],data.scale[0],data.scale[0],data.degree,data.px,data.py,this.next]);
break;
case "removeMouse":
this.next = MotaActionBlocks['removeMouse_s'].xmlText([data.div,this.next]);
break;
case "callBook": // 呼出怪物手册
this.next = MotaActionBlocks['callBook_s'].xmlText([
this.next]);

File diff suppressed because one or more lines are too long

View File

@ -197,6 +197,8 @@ editor_blocklyconfig=(function(){
]}),
MotaActionBlocks['waitAsync_s'].xmlText(),
MotaActionBlocks['stopAsync_s'].xmlText(),
MotaActionBlocks['changeMouse_s'].xmlText(),
MotaActionBlocks['removeMouse_s'].xmlText(),
MotaActionBlocks['vibrate_s'].xmlText(),
MotaActionBlocks['animate_s'].xmlText(),
MotaActionBlocks['animate_1_s'].xmlText(),

View File

@ -143,5 +143,247 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
]
}
]
},
"CommonEventTemplate": {
"检测音乐如果没有开启则系统提示开启": [
{
"type": "if",
"condition": "!core.musicStatus.bgmStatus",
"true": [
"\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳"
],
"false": []
}
],
"仿新新魔塔一次性商人": [
{
"type": "if",
"condition": "switch:A",
"true": [
"\t[行商,trader]\b[this]这是购买我的道具后我给玩家的提示。",
{
"type": "comment",
"text": "下一条指令可视情况使用或不使用"
},
{
"type": "hide",
"remove": true,
"time": 250,
"loc": [
[]
]
}
],
"false": [
{
"type": "confirm",
"text": "我有3把黄钥匙\n你出50金币就卖给你。",
"yes": [
{
"type": "if",
"condition": "status:money>=50",
"true": [
{
"type": "setValue",
"name": "status:money",
"operator": "-=",
"value": "50"
},
{
"type": "setValue",
"name": "item:yellowKey",
"operator": "+=",
"value": "3"
},
{
"type": "playSound",
"name": "确定",
"stop": true
},
{
"type": "setValue",
"name": "switch:A",
"value": "true"
}
],
"false": [
{
"type": "playSound",
"name": "操作失败"
},
"\t[行商,trader]\b[this]你的金币不足!"
]
}
],
"no": []
}
]
}
],
"全地图选中一个点": [
{
"type": "comment",
"text": "全地图选中一个点,需要用鼠标或触屏操作"
},
{
"type": "setValue",
"name": "temp:X",
"value": "status:x"
},
{
"type": "setValue",
"name": "temp:Y",
"value": "status:y"
},
{
"type": "tip",
"text": "再次点击闪烁位置确认"
},
{
"type": "while",
"condition": "true",
"data": [
{
"type": "drawSelector",
"image": "winskin.png",
"code": 1,
"x": "32*temp:X",
"y": "32*temp:Y",
"width": 32,
"height": 32
},
{
"type": "wait"
},
{
"type": "if",
"condition": "(flag:type === 1)",
"true": [
{
"type": "if",
"condition": "((temp:X===flag:x)&&(temp:Y===flag:y))",
"true": [
{
"type": "break",
"n": 1
}
]
},
{
"type": "setValue",
"name": "temp:X",
"value": "flag:x"
},
{
"type": "setValue",
"name": "temp:Y",
"value": "flag:y"
}
]
}
]
},
{
"type": "drawSelector",
"code": 1
},
{
"type": "comment",
"text": "流程进行到这里可以对[X,Y]点进行处理,比如"
},
{
"type": "closeDoor",
"id": "yellowDoor",
"loc": [
"temp:X",
"temp:Y"
]
}
],
"多阶段Boss战斗": [
{
"type": "comment",
"text": "多阶段boss请直接作为战后事件使用"
},
{
"type": "setValue",
"name": "switch:A",
"operator": "+=",
"value": "1"
},
{
"type": "switch",
"condition": "switch:A",
"caseList": [
{
"case": "1",
"action": [
{
"type": "setBlock",
"number": "redSlime",
"loc": [
[]
]
},
"\t[2阶段boss,redSlime]\b[this]你以为你已经打败我了吗?没听说过史莱姆有九条命吗?"
]
},
{
"case": "2",
"action": [
{
"type": "setBlock",
"number": "blackSlime",
"loc": [
[]
]
},
"\t[3阶段boss,blackSlime]\b[this]不能消灭我的,只会让我更强大!"
]
},
{
"case": "3",
"action": [
{
"type": "setBlock",
"number": "slimelord",
"loc": [
[]
]
},
"\t[4阶段boss,slimelord]\b[this]我还能打!"
]
},
{
"case": "4",
"action": [
"\t[4阶段boss,slimelord]我一定会回来的!"
]
}
]
}
],
"光标修改": [
{
"type": "changeMouse",
"icon": "sword1",
"div": "gameGroup",
"translate": [
0,
0
],
"scale": [
1,
1
],
"angle": 0,
"px": 0,
"py": 0
},
{
"type": "removeMouse",
"div": "gameGroup"
}
]
}
}

View File

@ -18,7 +18,32 @@ main.floors.jiuguan=
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"events": {
"1,4": [
{
"type": "changeMouse",
"icon": "sword3",
"div": "gameGroup",
"translate": [
0,
0
],
"scale": [
1,
1
],
"angle": 0,
"px": 0,
"py": 0
}
],
"7,6": [
{
"type": "removeMouse",
"div": "gameGroup"
}
]
},
"changeFloor": {},
"beforeBattle": {},
"afterBattle": {},
@ -72,5 +97,11 @@ main.floors.jiuguan=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"bg2map": [
],
"fg2map": [
]
}

View File

@ -4,6 +4,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this._afterLoadResources = function () {
// 本函数将在所有资源加载完毕后,游戏开启前被执行
core.ui.statusBar.init();
core.registerEvent("changeMouse", function (data) {
core.changeMouse(data.icon, data.div, data.translate[0], data.translate[1], data.scale[0], data.scale[1], data.angel, data.px, data.py)
core.doAction()
})
core.registerEvent("removeMouse", function (data) {
core.removeMouse(data.div)
core.doAction()
})
}
},
"drawLight": function () {