cgtext透明背景

This commit is contained in:
草莓 2025-03-04 16:03:11 +08:00
parent 39ad2254f8
commit 738eee1f53
3 changed files with 1150 additions and 1146 deletions

View File

@ -1137,7 +1137,7 @@ return code;
*/;
cgtext_s
: '背景' EvalString? '回忆滤镜' Bool? '移除对话框' Bool? '剧情库序列' Int '头像' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline
: '背景' EvalString? '不使用背景' Bool? '回忆滤镜' Bool? '移除对话框' Bool? '剧情库序列' Int '头像' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline
'自动等待时长' Int BGNL? Newline
textcgDrawingList+? Newline
@ -1149,7 +1149,8 @@ allImages : ['EvalString_0','EvalString_1']
default : ["bg_5043.webp",false,false,0,"face_050445.webp",-300,0,2000,"","这句话显示在对话框内",[{ "name":"tati_050145a.webp" , "px": 100,"filter":false }]]
var head ='{ "name": "'+EvalString_1+'", "px": '+Number_0+' }'
var list=',"bodyList": [\n'+textcgDrawingList_0.slice(0,-1)+'\n]'
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","memory":'+Bool_0+',"WindowSkin":'+Bool_1+',"head":'+head+' ,"index":"'+Int_0+'","time":'+Int_1+',"wait":'+Int_2+list+' },\n';
Bool_0=Bool_0?',"nobg":'+Bool_0:''
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'"'+Bool_0+',"memory":'+Bool_1+',"WindowSkin":'+Bool_2+',"head":'+head+' ,"index":"'+Int_0+'","time":'+Int_1+',"wait":'+Int_2+list+' },\n';
return code;
*/;
textcgDrawingList

View File

@ -567,6 +567,7 @@ MotaActionParser = function () {
};
this.next = MotaActionBlocks["cgtext_s"].xmlText([
data.bg,
data.nobg??false,
data.memory,
data.WindowSkin,
data.index,

View File

@ -113,8 +113,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
data.image,
data.memory,
data.hidetime || 30,
data.list || [
{
data.list || [{
text: "",
sound: "",
time: 50,
@ -122,8 +121,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
boldColor: "#000000",
font: "bold 48px Verdana",
frame: 0,
},
]
}, ]
);
} else {
core.doAction();
@ -199,20 +197,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.registerEvent("cgtext", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.ui.cgText.image = data.bg;
core.ui.cgText.nobg = data.nobg ?? false;
core.ui.cgText.memory = data.memory;
core.ui.cgText.head = core.clone(data.head);
core.ui.cgText.index = data.index;
core.ui.cgText.name = core.ui.cgText.textList[data.index][0];
core.ui.cgText.text = data.text
? data.text
: core.ui.cgText.textList[data.index][1];
core.ui.cgText.text = data.text ?
data.text :
core.ui.cgText.textList[data.index][1];
core.ui.cgText.time = data.time;
core.ui.cgText.wait = data.wait;
core.ui.cgText.WindowSkin = data.WindowSkin;
core.ui.cgText.sound =
data.sound === ""
? data.sound
: core.ui.cgText.textList[data.index][2] || "";
data.sound === "" ?
data.sound :
core.ui.cgText.textList[data.index][2] || "";
core.ui.cgText.bodyList = core.clone(data.bodyList);
main.dom.cgText.style.display = "block";
core.ui.cgText.update();
@ -15169,6 +15168,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
class cgText {
constructor() {
this.nobg = false
//绘制需要的变量
this.image = "";
this.head = { name: "face_050445.webp", px: -300 };
@ -15199,7 +15199,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
[x + w, y + h],
];
};
const inRect = ([x, y], [[sx, sy], [dx, dy]]) => {
const inRect = ([x, y], [
[sx, sy],
[dx, dy]
]) => {
return sx <= x && x <= dx && sy <= y && y <= dy;
};
const pos = [px, py];
@ -15404,9 +15407,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
config.defaultFont = config.font = config.font || globalAttribute.font;
config.time = config.time || 0;
config.letterSpacing =
config.letterSpacing == null
? textAttribute.letterSpacing || 0
: config.letterSpacing;
config.letterSpacing == null ?
textAttribute.letterSpacing || 0 :
config.letterSpacing;
config.index = 0;
config.currcolor = config.color;
@ -15460,9 +15463,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var block = config.blocks[config.index++];
if (block != null) {
// It works, why?
const scale = config.isHD
? devicePixelRatio * core.domStyle.scale
: 1;
const scale = config.isHD ?
devicePixelRatio * core.domStyle.scale :
1;
ctx.restore();
ctx.save(); //保存设置
if (core.domStyle.isVertical) {
@ -15565,17 +15568,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const indexList = this.textList;
core.setTextAlign(logctx, "left");
for (
let i = (page - 1) * 6;
i <= Math.min(this.index, page * 6 - 1);
i++
let i = (page - 1) * 6; i <= Math.min(this.index, page * 6 - 1); i++
) {
const text = this.textList[i][1].replaceAll(
/(\\(d|e|f|g|i|n|r|b|c|t|z))(\[.*?\])?/g,
""
); //取消打字机
const name = this.textList[i][0]
? "【" + this.textList[i][0] + "】"
: "";
const name = this.textList[i][0] ?
"【" + this.textList[i][0] + "】" :
"";
const sound = this.textList[i][2];
if (name) {
core.fillBoldText1(
@ -15711,7 +15712,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.canvas.width = 2028;
ctx.canvas.height = 1248;
}
if (this.nobg) {} else {
if (img) {
//绘制背景
if (this.memory) ctx.filter = "sepia(50%)";
@ -15720,6 +15721,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else {
core.fillRect(ctx, 0, 0, 2028, 1248);
}
}
this.bodyList.forEach((v) => {
//绘制立绘
const body = core.material.images.images?.[v.name];