弹幕系统打包事件
This commit is contained in:
parent
89906515ac
commit
21d9f1f611
@ -949,6 +949,7 @@ action
|
|||||||
| function_s
|
| function_s
|
||||||
| changeMouse_s
|
| changeMouse_s
|
||||||
| removeMouse_s
|
| removeMouse_s
|
||||||
|
| addPop_s
|
||||||
| pass_s
|
| pass_s
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -1240,6 +1241,17 @@ IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"');
|
|||||||
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
|
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
addPop_s
|
||||||
|
: '弹出弹幕' ':' EvalString BGNL? Newline
|
||||||
|
'出现像素位置x' Int 'y' Int '文字颜色' ColorString? Colour '描边颜色' ColorString? Colour BGNL? Newline
|
||||||
|
'左侧滚动' Bool? '文字跳跃' Bool? '显示时长' Int? '渐隐时长' Int? '字体信息' EvalString? '移动速度' Number? Newline
|
||||||
|
/*addPop_s
|
||||||
|
tooltip : addPop:游戏中增加一条弹幕
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ["这段话将在游戏中以弹幕显示",0,0,"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
|
setValue_s
|
||||||
: '数值操作' ':' '名称' idString_e AssignOperator_List expression '不刷新状态栏' Bool Newline
|
: '数值操作' ':' '名称' idString_e AssignOperator_List expression '不刷新状态栏' Bool Newline
|
||||||
@ -1816,13 +1828,14 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
changeMouse_s
|
changeMouse_s
|
||||||
: '鼠标指针变更为' EvalString '在' Div_List? ',' '画布偏移X' Number? '画布偏移Y' Number? 'X轴缩放' Number? 'Y轴缩放' Number '顺时针转角' Number '点击X偏移' Number '点击Y偏移' Number Newline
|
: '鼠标指针变更为' EvalString '在' Div_List? BGNL? Newline
|
||||||
|
'画布偏移X' Number? '画布偏移Y' Number? 'X轴缩放' Number? 'Y轴缩放' Number '顺时针转角' Number '点击X偏移' Number '点击Y偏移' Number Newline
|
||||||
/* changeMouse_s
|
/* changeMouse_s
|
||||||
tooltip : changeMouse:设置鼠标在某个区域内的光标
|
tooltip : changeMouse:设置鼠标在某个区域内的光标
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
colour : this.soundColor
|
colour : this.soundColor
|
||||||
allIds : ['EvalString_0']
|
allIds : ['EvalString_0']
|
||||||
default : ["sword","gameGroup",0,0,1,1,0,0,0]
|
default : ["sword0","gameGroup",0,0,1,1,0,0,0]
|
||||||
var translate = JSON.stringify([Number_0,Number_1]);
|
var translate = JSON.stringify([Number_0,Number_1]);
|
||||||
var scale=JSON.stringify([Number_2,Number_3]);
|
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';
|
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';
|
||||||
|
@ -334,6 +334,10 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
||||||
data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]);
|
data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]);
|
||||||
break;
|
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":
|
case "tip":
|
||||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||||
data.text,data.icon||"",this.next]);
|
data.text,data.icon||"",this.next]);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -105,6 +105,7 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['autoText_s'].xmlText(),
|
MotaActionBlocks['autoText_s'].xmlText(),
|
||||||
MotaActionBlocks['scrollText_s'].xmlText(),
|
MotaActionBlocks['scrollText_s'].xmlText(),
|
||||||
MotaActionBlocks['setText_s'].xmlText(),
|
MotaActionBlocks['setText_s'].xmlText(),
|
||||||
|
MotaActionBlocks['addPop_s'].xmlText(),
|
||||||
MotaActionBlocks['tip_s'].xmlText(),
|
MotaActionBlocks['tip_s'].xmlText(),
|
||||||
MotaActionBlocks['confirm_s'].xmlText(),
|
MotaActionBlocks['confirm_s'].xmlText(),
|
||||||
MotaActionBlocks['choices_s'].xmlText([
|
MotaActionBlocks['choices_s'].xmlText([
|
||||||
|
@ -366,7 +366,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
"光标修改": [
|
"光标修改": [
|
||||||
{
|
{
|
||||||
"type": "changeMouse",
|
"type": "changeMouse",
|
||||||
"icon": "sword1",
|
"icon": "sword0",
|
||||||
"div": "gameGroup",
|
"div": "gameGroup",
|
||||||
"translate": [
|
"translate": [
|
||||||
0,
|
0,
|
||||||
@ -384,6 +384,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
|||||||
"type": "removeMouse",
|
"type": "removeMouse",
|
||||||
"div": "gameGroup"
|
"div": "gameGroup"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"添加弹幕": null
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,30 +19,7 @@ main.floors.jiuguan=
|
|||||||
"eachArrive": [],
|
"eachArrive": [],
|
||||||
"parallelDo": "",
|
"parallelDo": "",
|
||||||
"events": {
|
"events": {
|
||||||
"1,4": [
|
"4,6": []
|
||||||
{
|
|
||||||
"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": {},
|
"changeFloor": {},
|
||||||
"beforeBattle": {},
|
"beforeBattle": {},
|
||||||
|
@ -12,6 +12,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
core.removeMouse(data.div)
|
core.removeMouse(data.div)
|
||||||
core.doAction()
|
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 () {
|
"drawLight": function () {
|
||||||
@ -8903,5 +8907,61 @@ core.plugin.animate = {
|
|||||||
this.removeMouse = function (div = 'gameGroup') {
|
this.removeMouse = function (div = 'gameGroup') {
|
||||||
core.dom[div].style.cursor = 'auto'
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user