旁白剧情
This commit is contained in:
parent
56f466db86
commit
b2801fc1c6
@ -952,6 +952,7 @@ action
|
||||
| removeMouse_s
|
||||
| drawWarning_s
|
||||
| addPop_s
|
||||
| over_s
|
||||
| playStereo_s
|
||||
| moveStereo_s
|
||||
| pass_s
|
||||
@ -1060,6 +1061,20 @@ if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) {
|
||||
return code+',\n';
|
||||
*/;
|
||||
|
||||
over_s
|
||||
: '旁白文字' ':' EvalString BGNL? Newline
|
||||
'背景' EvalString? '持续时长' Int? '渐入渐出时长' Int? '音频文件' EvalString? BGNL? Newline
|
||||
'文字颜色' ColorString? Colour '描边颜色' ColorString? Colour '字体信息' EvalString? Newline
|
||||
/*over_s
|
||||
tooltip : over:这段话将出现在屏幕中心
|
||||
helpUrl : /_docs/#/instruction
|
||||
allImages : ['EvalString_1']
|
||||
allSounds : ['EvalString_2']
|
||||
default : ["这段话将在屏幕中心","bg_5043.png",3000,100,"","255,255,255,1",'rgba(255,255,255,1)',"0,0,0,1",'rgba(0,0,0,1)','bold 48px Verdana']
|
||||
var code = '{"type": "over", "text": "'+EvalString_0+'","image":"'+EvalString_1+'","time":'+Int_0+',"hidetime":'+Int_1+',"sound":"'+EvalString_2+'","textColor": ['+ColorString_0+'], "boldColor": ['+ColorString_1+'], "font": "'+EvalString_3+'"},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
cgtext_s
|
||||
: '背景' EvalString? '移除对话框' Bool? '头像' EvalString?'名字' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline
|
||||
'音频文件(需在全塔属性——使用音效注册)'EvalString? BGNL? Newline
|
||||
@ -1287,6 +1302,7 @@ 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
|
||||
|
@ -352,6 +352,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
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 "over":
|
||||
this.next = MotaActionBlocks['over_s'].xmlText([
|
||||
data.text??"",data.image??"", data.time??3000, data.hidetime??100,data.sound??"", data.textColor,'rgba('+data.textColor+')', data.boldColor,'rgba('+data.boldColor+')', data.font??"bold 48px Verdana",this.next]);
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
data.text,data.icon||"",this.next]);
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,8 +29,25 @@ main.floors.jiuguan=
|
||||
],
|
||||
"4,10": [
|
||||
{
|
||||
"type": "insert",
|
||||
"name": "chapter0"
|
||||
"type": "over",
|
||||
"text": "这段话将在屏幕中心",
|
||||
"image": "bg_5043.png",
|
||||
"time": 3000,
|
||||
"hidetime": 100,
|
||||
"sound": "",
|
||||
"textColor": [
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
1
|
||||
],
|
||||
"boldColor": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"font": "bold 48px Verdana"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -40,6 +40,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
core.doAction()
|
||||
})
|
||||
core.registerEvent("over", function (data) {
|
||||
let image = data.image ?? "";
|
||||
let time = data.time ?? 3000;
|
||||
let sound = data.sound ?? "";
|
||||
let textColor = data.textColor ?? "#FFFFFF";
|
||||
let boldColor = data.boldColor ?? "#000000";
|
||||
let font = data.font ?? "bold 48px Verdana";
|
||||
let text = data.text ?? "";
|
||||
let hidetime = data.hidetime ?? 100;
|
||||
if (!main.replayChecking && !core.isReplaying()) {
|
||||
core.over(image, time, hidetime, sound, textColor, boldColor, font, text)
|
||||
} else {
|
||||
core.doAction()
|
||||
}
|
||||
})
|
||||
core.registerEvent("cgtext", function (data) {
|
||||
if (!main.replayChecking && !core.isReplaying()) {
|
||||
core.ui.cgText.image = data.bg;
|
||||
@ -2006,6 +2021,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
main.dom.CGUI.style.height = obj.totalHeight + 'px';
|
||||
main.dom.cgText.style.width = obj.totalWidth + 'px';
|
||||
main.dom.cgText.style.height = obj.totalHeight + 'px';
|
||||
main.dom.over.style.width = obj.totalWidth + 'px';
|
||||
main.dom.over.style.height = obj.totalHeight + 'px';
|
||||
|
||||
const innerSize = (obj.canvasWidth * core.domStyle.scale) + "px";
|
||||
for (let i = 0; i < core.dom.gameCanvas.length; ++i)
|
||||
@ -2835,80 +2852,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
return;
|
||||
}
|
||||
actions.prototype._sys_keyDownCtrl = function () {
|
||||
if (core.status.event.id == 'text') {
|
||||
core.drawText();
|
||||
return true;
|
||||
}
|
||||
if (core.status.event.id == 'action' && (core.status.event.data.type == 'text' || core.status.event.data.type == 'cgtext')) {
|
||||
let time = 0
|
||||
core.registerAnimationFrame("ctrlDown", true, (timestamp) => {
|
||||
if (timestamp > time + 100) {
|
||||
time = timestamp
|
||||
if (core.status.event.id == 'action' && (core.status.event.data.type == 'text' || core.status.event.data.type == 'cgtext')) {
|
||||
main.dom.cgText.style.display = "none"
|
||||
core.doAction()
|
||||
}
|
||||
}
|
||||
})
|
||||
return true;
|
||||
}
|
||||
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep' &&
|
||||
!core.status.event.data.current.noSkip) {
|
||||
if (core.timeout.sleepTimeout && !core.hasAsync()) {
|
||||
clearTimeout(core.timeout.sleepTimeout);
|
||||
core.timeout.sleepTimeout = null;
|
||||
core.doAction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
actions.prototype.keyDownCtrl = function () {
|
||||
this.doRegisteredAction('keyDownCtrl');
|
||||
}
|
||||
core.registerAction('keyDownCtrl', '_sys_keyDownCtrl', core.actions._sys_keyDownCtrl, 0);
|
||||
actions.prototype._keyUpAction = function (keycode) {
|
||||
if (keycode == 17) {
|
||||
core.unregisterAnimationFrame("ctrlDown")
|
||||
return
|
||||
}
|
||||
if (core.status.event.data.type == 'text' && (keycode == 13 || keycode == 32 || keycode == 67)) {
|
||||
return this._clickAction_text();
|
||||
}
|
||||
if (core.status.event.data.type == 'wait') {
|
||||
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
|
||||
core.setFlag('type', 0);
|
||||
core.setFlag('keycode', keycode);
|
||||
core.setFlag('timeout', timeout);
|
||||
var executed = core.events.__action_wait_afterGet(core.status.event.data.current);
|
||||
if (executed || !core.status.event.data.current.forceChild) {
|
||||
core.status.route.push("input:" + (1e8 * timeout + keycode));
|
||||
clearTimeout(core.status.event.interval);
|
||||
delete core.status.event.timeout;
|
||||
core.doAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data.type == 'choices') {
|
||||
var data = core.status.event.data.current;
|
||||
var choices = data.choices;
|
||||
if (choices.length > 0) {
|
||||
this._selectChoices(choices.length, keycode, this._clickAction);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (core.status.event.data.type == 'confirm' && (keycode == 13 || keycode == 32 || keycode == 67)) {
|
||||
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
|
||||
delete core.status.event.timeout;
|
||||
core.setFlag('timeout', timeout);
|
||||
core.status.route.push("choices:" + (100 * timeout + core.status.event.selection));
|
||||
if (core.status.event.selection == 0)
|
||||
core.insertAction(core.status.event.ui.yes);
|
||||
else core.insertAction(core.status.event.ui.no);
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
////// 执行当前自定义事件列表中的下一个事件 //////
|
||||
events.prototype.doAction = function () {
|
||||
// 清空boxAnimate和UI层
|
||||
@ -7270,6 +7214,7 @@ core.plugin.animate = {
|
||||
MotaActionBlocks['text_0_s'].xmlText(),
|
||||
MotaActionBlocks['text_1_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList("\t[小妖精,fairy]\f[fairy.png,0,0]欢迎使用事件编辑器(双击方块可直接预览)"),
|
||||
MotaActionBlocks['over_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList([{
|
||||
"type": "cgtext",
|
||||
"bg": "bg_5043.png",
|
||||
@ -10026,5 +9971,132 @@ core.plugin.animate = {
|
||||
}
|
||||
core.ui.cgText = new cgText()
|
||||
|
||||
},
|
||||
"旁白": function () {
|
||||
// 在此增加新插件
|
||||
const over = document.createElement('canvas'); //over画布设置
|
||||
over.style.position = 'absolute';
|
||||
over.style.zIndex = 310;
|
||||
over.style.display = "none"
|
||||
over.id = 'over';
|
||||
main.dom.gameGroup.insertAdjacentElement('afterend', over)
|
||||
over.style.top = "50%"
|
||||
over.style.left = "50%"
|
||||
over.style.transform = "translate(-50%,-50%)"
|
||||
const ctx = over.getContext("2d");
|
||||
main.dom.over = over;
|
||||
|
||||
this.over = function (image, time = 3000, hidetime = 100, sound = "", textColor = "#FFFFFF", boldColor = "#000000", font = "bold 48px Verdana", text = "") {
|
||||
if (!core.isPlaying()) { return core.doAction() }
|
||||
const img = core.material.images.images?.[image]
|
||||
over.style.display = "block";
|
||||
let globalAlpha = 0
|
||||
core.registerAnimationFrame("overshow", true, () => {
|
||||
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
ctx.globalAlpha = 1
|
||||
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha++
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
if (globalAlpha >= hidetime) {
|
||||
core.unregisterAnimationFrame("overshow")
|
||||
if (sound && core.material.sounds[sound] && core.musicStatus.soundStatus) {
|
||||
core.playSound(sound, null, () => {
|
||||
core.registerAnimationFrame("overhide", true, () => {
|
||||
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
ctx.globalAlpha = 1
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha--
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
if (globalAlpha <= 0) {
|
||||
core.unregisterAnimationFrame("overhide")
|
||||
over.style.display = "none"
|
||||
core.doAction()
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
core.registerAnimationFrame("overhide", true, () => {
|
||||
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
ctx.globalAlpha = 1
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha--
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
if (ctx.globalAlpha <= 0) {
|
||||
core.unregisterAnimationFrame("overhide")
|
||||
over.style.display = "none"
|
||||
core.doAction();
|
||||
}
|
||||
})
|
||||
}, time)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user