剧情音效

This commit is contained in:
草莓 2024-12-22 14:42:00 +08:00
parent 8f596865bd
commit 9259cb901a
4 changed files with 192 additions and 10 deletions

View File

@ -1062,6 +1062,7 @@ return code+',\n';
cgtext_s
: '背景' EvalString? '移除对话框' Bool? '头像' EvalString?'名字' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline
'音频文件(需在全塔属性——使用音效注册)'EvalString? BGNL? Newline
EvalString? BGNL? Newline textcgDrawingList*? Newline
@ -1069,10 +1070,11 @@ cgtext_s
tooltip : cgtext显示一段包含cg的文字剧情
helpUrl : /_docs/#/instruction
allImages : ['EvalString_0','EvalString_1']
default : ["bg_5043.png","face_050445.png",false,"菲奥奈",-300,0,"这句话显示在对话框内",[{ "name":"tati_050145a.png" , "px": 100,"filter":false }]]
allSounds : ['EvalString_3']
default : ["bg_5043.png","face_050445.png",false,"菲奥奈",-300,0,"","这句话显示在对话框内",[{ "name":"tati_050145a.png" , "px": 100,"filter":false }]]
var head ='{ "name": "'+EvalString_1+'", "px": '+Number_0+' }'
var list=',"bodyList": [\n'+textcgDrawingList_0+'\n]'
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","WindowSkin":'+Bool_0+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"text": "'+EvalString_3+'"'+list+' },\n';
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","WindowSkin":'+Bool_0+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"sound":"'+EvalString_3+'","text": "'+EvalString_4+'"'+list+' },\n';
return code;
*/;
textcgDrawingList

View File

@ -315,7 +315,7 @@ ActionParser.prototype.parseAction = function() {
return res;
}
this.next = MotaActionBlocks['cgtext_s'].xmlText([
data.bg,data.WindowSkin,data.head.name, data.name||"", data.head.px||-300,data.time, data.text,buildcgDrawing(data.bodyList), this.next]);
data.bg,data.WindowSkin,data.head.name, data.name||"", data.head.px||-300,data.time, data.sound,data.text,buildcgDrawing(data.bodyList), this.next]);
break;
case "moveTextBox": // 移动对话框

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.ui.cgText.text = data.text;
core.ui.cgText.time = data.time;
core.ui.cgText.WindowSkin = data.WindowSkin
core.ui.cgText.sound = data.sound || "";
core.ui.cgText.bodyList = core.clone(data.bodyList);
main.dom.cgText.style.display = 'block';
core.ui.cgText.update()
@ -2934,7 +2935,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
data = { "type": "text", "text": data };
// 该事件块已经被禁用
if (data._disabled) return core.doAction();
if (data.type !== 'cgtext') core.unregisterAnimationFrame("skip")
if (data.type !== 'cgtext') {
core.unregisterAnimationFrame("skip")
core.setFlag("skip", false)
}
data.floorId = data.floorId || floorId;
core.status.event.data.type = data.type;
this.doEvent(data, x, y, prefix);
@ -7273,6 +7277,7 @@ core.plugin.animate = {
"head": { "name": "face_050445.png", "px": -300 },
"name": "菲奥奈",
"time": 0,
"sound": "",
"text": "这句话显示在对话框内",
"bodyList": [
{ "name": "tati_050145a.png", "px": 100, "filter": false }
@ -9675,7 +9680,17 @@ core.plugin.animate = {
cg.onmouseup = function (e) { //鼠标抬起
try {
if (!core.isPlaying()) return false;
core.unregisterAnimationFrame("skip")
let a = core.getFlag("skip", false)
core.setFlag("skip", false)
if (a) {
const data = core.clone(core.status.event.data.current);
core.insertAction(data);
core.doAction()
}
} catch (ee) {
console.error(ee);
}
@ -9698,6 +9713,16 @@ core.plugin.animate = {
if (!core.isPlaying()) return false;
core.unregisterAnimationFrame("skip")
core.setFlag("skip", false)
let a = core.getFlag("skip", false)
core.setFlag("skip", false)
if (a) {
const data = core.clone(core.status.event.data.current);
core.insertAction(data);
core.doAction()
}
} catch (ee) {
console.error(ee);
}
@ -9725,6 +9750,7 @@ core.plugin.animate = {
this.text = ''
this.time = 0;
this.WindowSkin = false;
this.sound = "";
}
click(px, py) { //点击效果
@ -9754,6 +9780,7 @@ core.plugin.animate = {
if (timestamp > time + 100) {
time = timestamp
if (core.status.event.id == 'action' && core.status.event.data.type == 'cgtext') {
core.setFlag("skip", true)
main.dom.cgText.style.display = "none"
core.doAction()
}
@ -9766,11 +9793,10 @@ core.plugin.animate = {
data.showAll = true;
data.time = 0
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
data.sound = ""
core.insertAction(data);
core.doAction()
} else if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) { //存档
auto = false;
if (core.status.event.animateUI) return;
@ -9778,6 +9804,7 @@ core.plugin.animate = {
const current = core.clone(core.status.event.data.current)
current.showAll = true;
current.time = 0
current.sound = ""
current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除当前事件所有打字机效果
cg.style.display = "none"
const data = [{ 'type': 'callSave' }, current] //插入存档事件
@ -9796,7 +9823,7 @@ core.plugin.animate = {
data.showAll = true;
data.time = 0
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
data.sound = "";
core.insertAction(data);
core.doAction();
return;
@ -9900,7 +9927,7 @@ core.plugin.animate = {
if (config.time == 0) {
while (_drawNext());
if (auto && !core.ui.cgText.WindowSkin) {
if (auto && !this.WindowSkin && !this.sound) {
setTimeout(() => { if (auto) core.doAction() }, 2000)
}
} else {
@ -9909,7 +9936,7 @@ core.plugin.animate = {
if (!_drawNext()) {
clearInterval(core.status.event.interval);
core.status.event.interval = null;
if (auto && !core.ui.cgText.WindowSkin) setTimeout(() => { if (auto) core.doAction() }, 2000)
if (auto && !this.WindowSkin && !this.sound) setTimeout(() => { if (auto) core.doAction() }, 2000)
}
}, config.time);
}
@ -9963,7 +9990,14 @@ core.plugin.animate = {
core.fillBoldText(ctx, autoText, 1722, 966, '#FFFFFF', '#000000', "bold 48px Verdana")
}
if (this.name) core.fillBoldText(ctx, `${this.name}`, 500, 880, '#FFFFFF', '#000000', "bold 48px Verdana") //绘制名字
if (this.text) { //绘制对话
if (this.sound && core.material.sounds[this.sound] && !core.getFlag("skip", false)) {
core.playSound(this.sound, null, () => {
if (auto && !this.WindowSkin) {
setTimeout(() => { if (auto) core.doAction() }, 2000)
}
})
}
if (this.text && !core.getFlag("skip", false)) { //绘制对话
this.drawTextContent(ctx, this.text, {
left: 500,
top: 950,