Merge remote-tracking branch 'origin/main'
# Conflicts: # project/plugins.js
This commit is contained in:
commit
9d9519ef93
@ -947,6 +947,9 @@ action
|
||||
| drawSelector_1_s
|
||||
| unknown_s
|
||||
| function_s
|
||||
| changeMouse_s
|
||||
| removeMouse_s
|
||||
| addPop_s
|
||||
| pass_s
|
||||
;
|
||||
|
||||
@ -1238,6 +1241,17 @@ IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"');
|
||||
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
addPop_s
|
||||
: '弹出弹幕' ':' EvalString BGNL? Newline
|
||||
'出现像素位置px' Int 'py' Int '文字颜色' ColorString? Colour '描边颜色' ColorString? Colour BGNL? Newline
|
||||
'左侧滚动' Bool? '文字跳跃' Bool? '显示时长' Int? '渐隐时长' Int? '字体信息' EvalString? '移动速度' Number? Newline
|
||||
/*addPop_s
|
||||
tooltip : addPop:游戏中增加一条弹幕
|
||||
helpUrl : /_docs/#/instruction
|
||||
default : ["这段话将在游戏中以弹幕显示",32,32,"255,0,0,1",'rgba(255,0,0,1)',"0,0,0,1",'rgba(0,0,0,1)',false,false,60,30,'16px Verdana',1]
|
||||
var code = '{"type": "addPop", "value": "'+EvalString_0+'","px":'+Int_0+',"py":'+Int_1+',"color": ['+ColorString_0+'], "boldColor": ['+ColorString_1+'], "left": '+Bool_0+', "jump": '+Bool_1+', "time": '+Int_2+', "show": '+Int_3+', "font": "'+EvalString_1+'","speed":'+Number_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
setValue_s
|
||||
: '数值操作' ':' '名称' idString_e AssignOperator_List expression '不刷新状态栏' Bool Newline
|
||||
@ -1813,6 +1827,32 @@ var code = '{"type": "sleep", "time": '+Int_0+Bool_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
changeMouse_s
|
||||
: '鼠标指针变更为' EvalString '在' Div_List? BGNL? Newline
|
||||
'画布偏移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 : ["sword0","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 +4194,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']*/;
|
||||
|
@ -334,6 +334,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
||||
data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]);
|
||||
break;
|
||||
case "addPop":
|
||||
this.next = MotaActionBlocks['addPop_s'].xmlText([
|
||||
data.value,data.px, data.py, data.color,'rgba('+data.color+')', data.boldColor,'rgba('+data.boldColor+')', data.left, data.jump, data.time, data.show, data.font, data.speed,this.next]);
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
data.text,data.icon||"",this.next]);
|
||||
@ -976,6 +980,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]);
|
||||
|
@ -26,6 +26,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"bear.png",
|
||||
"bg.jpg",
|
||||
"bg2.jpg",
|
||||
"bg_5043.png",
|
||||
"brave.png",
|
||||
"d.png",
|
||||
"dl.png",
|
||||
@ -73,7 +74,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"3.png",
|
||||
"2.png",
|
||||
"1.png",
|
||||
"11.png",
|
||||
"6.png",
|
||||
"12.png",
|
||||
"Outside_B.png",
|
||||
|
@ -143,5 +143,273 @@ 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": "sword0",
|
||||
"div": "gameGroup",
|
||||
"translate": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"angle": 0,
|
||||
"px": 0,
|
||||
"py": 0
|
||||
},
|
||||
{
|
||||
"type": "removeMouse",
|
||||
"div": "gameGroup"
|
||||
}
|
||||
],
|
||||
"添加弹幕": [
|
||||
{
|
||||
"type": "addPop",
|
||||
"value": "这段话将在游戏中以弹幕显示",
|
||||
"px": 32,
|
||||
"py": 32,
|
||||
"color": [
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"boldColor": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"left": false,
|
||||
"jump": false,
|
||||
"time": 60,
|
||||
"show": 30,
|
||||
"font": "16px Verdana",
|
||||
"speed": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1233,5 +1233,11 @@ main.floors.Caimhome=
|
||||
[ 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": [
|
||||
|
||||
]
|
||||
}
|
@ -72,5 +72,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": [
|
||||
|
||||
]
|
||||
}
|
BIN
project/images/bg_5043.png
Normal file
BIN
project/images/bg_5043.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
@ -4,6 +4,18 @@ 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()
|
||||
})
|
||||
core.registerEvent("addPop", function (data) {
|
||||
core.addPop(data.value, data.px, data.py, data.color, data.boldColor, data.left, data.jump, data.time, data.show, data.font, data.speed)
|
||||
core.doAction()
|
||||
})
|
||||
}
|
||||
},
|
||||
"drawLight": function () {
|
||||
@ -7096,6 +7108,7 @@ core.plugin.animate = {
|
||||
MotaActionBlocks['scrollText_s'].xmlText(),
|
||||
MotaActionBlocks['setText_s'].xmlText(),
|
||||
MotaActionBlocks['tip_s'].xmlText(),
|
||||
MotaActionBlocks['addPop_s'].xmlText(),
|
||||
MotaActionBlocks['confirm_s'].xmlText(),
|
||||
MotaActionBlocks['choices_s'].xmlText([
|
||||
'选择剑或者盾', '流浪者', 'man', 0, '', MotaActionBlocks['choicesContext'].xmlText([
|
||||
@ -7195,6 +7208,8 @@ core.plugin.animate = {
|
||||
}),
|
||||
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(),
|
||||
@ -8639,7 +8654,8 @@ core.plugin.animate = {
|
||||
// 在此增加新插件
|
||||
const CGUI = document.createElement('canvas'); //CGui画布设置
|
||||
CGUI.style.position = 'absolute';
|
||||
CGUI.style.zIndex = 0;
|
||||
CGUI.style.zIndex = 300;
|
||||
CGUI.style.display = "none"
|
||||
CGUI.id = 'CGUI';
|
||||
main.dom.gameGroup.insertAdjacentElement('afterend', CGUI)
|
||||
CGUI.style.top = "50%"
|
||||
@ -8778,7 +8794,7 @@ core.plugin.animate = {
|
||||
onclick(px, py) { //点击
|
||||
console.log([px, py])
|
||||
if (px >= 33 && px <= 177 && py >= 33 && py <= 177) { //离开按钮是一致的,其余的记区分横竖屏
|
||||
CGUI.style.zIndex = 0
|
||||
CGUI.style.display = "none"
|
||||
core.clearMap(ctx)
|
||||
core.restart();
|
||||
}
|
||||
@ -8794,14 +8810,19 @@ core.plugin.animate = {
|
||||
}
|
||||
drawUI() {
|
||||
core.clearMap(CGUI)
|
||||
if (!core?.material?.images?.images['winskin1.png']) return
|
||||
if (!core?.material?.images?.images?.['winskin1.png']) return
|
||||
if (core.domStyle.isVertical) { //竖屏
|
||||
core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028);
|
||||
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028);
|
||||
core.fillRect(ctx, 0, 0, 1248, 2028, "#000000") //黑色背景
|
||||
ctx.globalAlpha = 0.5 //透明度
|
||||
drawImage(ctx, "backgroundvertical.png", 0, 0, 1280, 1500, 0, 0, 1248, 2028) //绘制半透明背景图片
|
||||
ctx.globalAlpha = 1 //恢复为不透明
|
||||
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillRoundRect(ctx, 45 - 6, 45 - 6, 120 + 12, 80 + 12, 6, '#444444');
|
||||
core.strokeRoundRect(ctx, 45 - 12, 45 - 12, 120 + 24, 80 + 24, 12, "#444444", 3);
|
||||
core.fillText(ctx, '离开', 100, 110, '#FFFFFF', core.ui._buildFont(33, true));
|
||||
|
||||
/*(这部分是不是写错了)
|
||||
// 添加向上翻页和向下翻页的按钮
|
||||
core.fillRoundRect(ctx, 100 - 6, 100 - 6, 120 + 12, 120 + 12, 6, '#444444');
|
||||
core.strokeRoundRect(ctx, 100 - 12, 100 - 12, 120 + 24, 120 + 120, 12, "#444444", 3);
|
||||
@ -8819,10 +8840,13 @@ core.plugin.animate = {
|
||||
// 添加浏览模式和CG模式的字样
|
||||
core.fillText(ctx, '浏览模式', 400, 180, '#FFFFFF', core.ui._buildFont(24, true));
|
||||
core.fillText(ctx, 'CG模式', 1200, 180, '#FFFFFF', core.ui._buildFont(24, true));
|
||||
*/
|
||||
} else { //横屏
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000") //黑色背景
|
||||
ctx.globalAlpha = 0.5 //透明度
|
||||
drawImage(ctx, "bg_5043.png", 0, 0, 1280, 720, 0, 0, 2028, 1248) //绘制半透明背景图片
|
||||
ctx.globalAlpha = 1 //恢复为不透明
|
||||
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillRoundRect(ctx, 45 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
|
||||
core.strokeRoundRect(ctx, 45 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
|
||||
@ -8861,8 +8885,86 @@ core.plugin.animate = {
|
||||
main.dom.CGMode.onclick = function () {
|
||||
main.core.control.checkBgm();
|
||||
|
||||
CGUI.style.zIndex = 10000
|
||||
CGUI.style.display = "block"
|
||||
main.core.ui.CG.update()
|
||||
}
|
||||
},
|
||||
"光标设置": function () {
|
||||
// 在此增加新插件
|
||||
this.changeMouse = function (icon, div = 'gameGroup', translateX = 0, translateY = 0, scaleX = 1, scaleY = 1, degree = 0, px = 0, py = 0) {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 64
|
||||
canvas.height = 64
|
||||
|
||||
const ctx = canvas.getContext("2d")
|
||||
ctx.translate(translateX, translateY) //偏移画布(x,y)
|
||||
ctx.scale(scaleX, scaleY) //(x,y轴缩放倍率,-1为沿X,Y轴翻转)
|
||||
const angle = degree * Math.PI / 180 //根据角度计算参数
|
||||
ctx.rotate(angle) //顺时针旋转(以画布原点为中心,可通过偏移画布影响中心点)
|
||||
let info = { image: core.statusBar.icons[icon], posX: 0, posY: 0, height: 32 };
|
||||
|
||||
core.drawIcon(ctx, icon, 0, 0, 32, 32)
|
||||
const data = canvas.toDataURL("image/png")
|
||||
core.dom[div].style.cursor = `url(${data}) ${px} ${py},url(${data}),auto` //div为你要改变光标的元素,默认为包含状态栏的整个游戏画面,px/py为点击点偏移像素
|
||||
}
|
||||
this.removeMouse = function (div = 'gameGroup') {
|
||||
core.dom[div].style.cursor = 'auto'
|
||||
}
|
||||
},
|
||||
"信息弹出": function () {
|
||||
// 在此增加新插件
|
||||
/* 弹出显示某个内容
|
||||
* 使用方法:core.addPop(px, py, value, color, boldColor)
|
||||
* 参数说明:
|
||||
* px & py: number 弹出位置
|
||||
* value: string 显示内容
|
||||
* color: string 填充颜色
|
||||
* boldColor: string 描边颜色
|
||||
*/
|
||||
|
||||
// 默认字体
|
||||
var fontD = '16px Verdana';
|
||||
// 默认颜色
|
||||
var colorD = 'red';
|
||||
// 默认描边颜色
|
||||
var boldColorD = 'black';
|
||||
|
||||
/** 血量弹出 */
|
||||
function pop() {
|
||||
var ctx = core.getContextByName('pop');
|
||||
if (!ctx) ctx = core.createCanvas('pop', 0, 0, core.__PIXELS__, core.__PIXELS__, 90);
|
||||
core.clearMap(ctx);
|
||||
core.setTextAlign('pop', 'left')
|
||||
var list = core.status.pop || [];
|
||||
var count = 0;
|
||||
list.forEach(function (one) {
|
||||
// 由frame计算出dy
|
||||
var dy = 6 - one.frame * 0.2;
|
||||
var dx = one.speed;
|
||||
if (one.jump) {
|
||||
one.py -= dy;
|
||||
}
|
||||
if (!one.left) {
|
||||
one.px += dx;
|
||||
} else {
|
||||
one.px -= dx;
|
||||
}
|
||||
one.frame++;
|
||||
// 绘制
|
||||
if (one.frame >= one.time) core.setAlpha(ctx, 1 - (one.frame - one.time) / one.show);
|
||||
else core.setAlpha(ctx, 1);
|
||||
core.fillBoldText(ctx, one.value, one.px, one.py, one.color || 'red', one.boldColor || 'black', one.font);
|
||||
if (one.frame >= one.time + one.show) count++;
|
||||
});
|
||||
if (count > 0) list.splice(0, count);
|
||||
}
|
||||
if (!main.replayChecking) core.registerAnimationFrame('pop', true, pop);
|
||||
|
||||
/** 添加弹出内容 */
|
||||
this.addPop = function (value, px, py, color, boldColor, left, jump, time, show, font, speed) {
|
||||
var data = { px: px, py: py, value: value, color: color || colorD, boldColor: boldColor || boldColorD, frame: 0, left: left || false, jump: jump || false, time: time || 60, show: show || 30, font: font || fontD, speed: speed || 1 };
|
||||
if (!core.status.pop) core.status.pop = [data];
|
||||
else core.status.pop.push(data);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 810 KiB |
Loading…
Reference in New Issue
Block a user