cg成就变量及任务指引变量设置

This commit is contained in:
草莓 2025-01-13 17:12:52 +08:00
parent 2bb9cefc58
commit 538a9d9176
4 changed files with 588 additions and 487 deletions

View File

@ -958,6 +958,8 @@ action
| removeMouse_s
| drawWarning_s
| addPop_s
| setq_s
| setcgs_s
| animationDrawable_s
| over_s
| overlist_s
@ -2596,6 +2598,35 @@ var code = '{"type": "rotateImage", "code": '+NInt_0+loc+', "angle": '+NInt_1+Mo
return code;
*/;
setq_s
: '设置任务目标楼层'IdString?'不填为清空当前任务指引' Newline
/* setq_s
tooltip : setq设置任务目标楼层显示在小地图
helpUrl : /_docs/#/instruction
default : [""]
allFloorIds : ['IdString_0']
colour : this.soundColor
IdString_0 = IdString_0 ? (', "id": "'+IdString_0+'"') : '';
var code = '{"type": "setq"'+IdString_0+'},\n';
return code;
*/;
setcgs_s
: 'cg回廊获取cg 文件名'EvalString?'不填为清空cg获取记录' Newline
/* setcgs_s
tooltip : setcgscg回廊中的cg获取
helpUrl : /_docs/#/instruction
default : [""]
allImages : ['EvalString_0']
colour : this.imageColor
EvalString_0 = EvalString_0 ? (', "img": "'+EvalString_0+'"') : '';
var code = '{"type": "setcgs"'+EvalString_0+'},\n';
return code;
*/;
scaleImage_s
: '图片放缩' '图片编号' NInt '中心点像素' 'x' PosString? 'y' PosString? '移动方式' MoveMode_List BGNL? '放缩比例' Number '动画时间' Int '不等待执行完毕' Bool Newline
@ -2615,6 +2646,7 @@ var code = '{"type": "scaleImage", "code": '+NInt_0+loc+', "scale": '+Number_0+M
return code;
*/;
animationDrawable_s
: '帧动画' '总显示帧数' IntString '底色' ColorString? Colour '底色不透明度' IntString? BGNL?Newline
'图片序列同一帧后面覆盖先前的默认起始帧为0结束帧为最后一帧)'BGNL?Newline

View File

@ -614,6 +614,12 @@ MotaActionParser = function () {
this.next,
]);
break;
case "setq":
this.next = MotaActionBlocks["setq_s"].xmlText([data.id, this.next]);
break;
case "setcgs":
this.next = MotaActionBlocks["setcgs_s"].xmlText([data.img, this.next]);
break;
case "comment": // 注释
this.next = MotaActionBlocks["comment_s"].xmlText([
this.EvalString_Multi(data.text),
@ -645,6 +651,7 @@ MotaActionParser = function () {
this.next,
]);
break;
case "addPop":
this.next = MotaActionBlocks["addPop_s"].xmlText([
data.value,
@ -840,6 +847,7 @@ MotaActionParser = function () {
this.next,
]);
break;
case "tip":
this.next = MotaActionBlocks["tip_s"].xmlText([
data.text,

File diff suppressed because one or more lines are too long

View File

@ -188,6 +188,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.doAction();
}
});
core.registerEvent("setcgs", function (data) {
core.setcgs(data.img)
core.doAction()
})
core.registerEvent("setq", function (data) {
core.setq(data.id)
core.doAction()
})
core.registerEvent("cgtext", function (data) {
if (!main.replayChecking && !core.isReplaying()) {
core.ui.cgText.image = data.bg;
@ -9423,6 +9431,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
],
特效表现: [
MotaActionBlocks["sleep_s"].xmlText(),
MotaActionBlocks["setq_s"].xmlText(),
MotaActionBlocks["changebg_s"].xmlText(),
MotaActionFunctions.actionParser.parseList({
type: "wait",
@ -9492,10 +9501,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
],
音像处理: [
MotaActionBlocks["animationDrawable_s"].xmlText(),
MotaActionBlocks["setanimate_s"].xmlText(),
MotaActionBlocks["deleteanimate_s"].xmlText(),
MotaActionBlocks["playanimate_s"].xmlText(),
MotaActionBlocks["clearanimate_s"].xmlText(),
MotaActionBlocks["setcgs_s"].xmlText(),
MotaActionBlocks["showImage_s"].xmlText(),
MotaActionBlocks["showImage_1_s"].xmlText(),
MotaActionBlocks["hideImage_s"].xmlText(),
@ -10329,6 +10335,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let allChangeEntries = Object.entries(defaultChange);
this.setq = function (floorId) {
core.setFlag("任务地点", floorId)
}
const reset = core.events.resetGame;
this.bfs = function () {
areas = [];
@ -11822,6 +11832,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
class CG {
constructor() {
this.cgs
//cg列表
this.UIMx = [
//空位用none填充当前ui至多4列6行
@ -11882,6 +11893,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
onclick(px, py) {
//点击
if (show) {
show = !show;
core.clearMap(ctx);
@ -11935,6 +11947,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.update();
}
} else if (inRect(pos, imagebox0)) {
if (this.cgs.includes(this.UIMx[page][0][0])) {
const img = core.material.images.images[this.UIMx[page][0][0]];
if (img) {
ctx.save(); //保存设置
@ -11944,7 +11957,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.restore(); //重置画布设置
show = !show;
}
}
} else if (inRect(pos, imagebox1)) {
if (this.cgs.includes(this.UIMx[page][0][1])) {
const img = core.material.images.images[this.UIMx[page][0][1]];
if (img) {
ctx.save(); //保存设置
@ -11954,7 +11969,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.restore(); //重置画布设置
show = !show;
}
}
} else if (inRect(pos, imagebox2)) {
if (this.cgs.includes(this.UIMx[page][0][2])) {
const img = core.material.images.images[this.UIMx[page][0][2]];
if (img) {
ctx.save(); //保存设置
@ -11964,7 +11981,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.restore(); //重置画布设置
show = !show;
}
}
} else if (inRect(pos, imagebox3)) {
if (this.cgs.includes(this.UIMx[page][1][0])) {
const img = core.material.images.images[this.UIMx[page][1][0]];
if (img) {
ctx.save(); //保存设置
@ -11974,7 +11993,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.restore(); //重置画布设置
show = !show;
}
}
} else if (inRect(pos, imagebox4)) {
if (this.cgs.includes(this.UIMx[page][1][1])) {
const img = core.material.images.images[this.UIMx[page][1][1]];
if (img) {
ctx.save(); //保存设置
@ -11984,7 +12005,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.restore(); //重置画布设置
show = !show;
}
}
} else if (inRect(pos, imagebox5)) {
if (this.cgs.includes(this.UIMx[page][1][2])) {
const img = core.material.images.images[this.UIMx[page][1][2]];
if (img) {
ctx.save(); //保存设置
@ -11995,6 +12018,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
show = !show;
}
}
}
} else {
const pageupbox = makeBox([200, 1110], [200, 100]);
const pagedownbox = makeBox([1600, 1110], [200, 100]);
@ -12017,36 +12041,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.update();
}
} else if (inRect(pos, imagebox0)) {
if (this.cgs.includes(this.UIMx[page][0][0])) {
const img = core.material.images.images[this.UIMx[page][0][0]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
show = !show;
}
}
} else if (inRect(pos, imagebox1)) {
if (this.cgs.includes(this.UIMx[page][0][1])) {
const img = core.material.images.images[this.UIMx[page][0][1]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
show = !show;
}
}
} else if (inRect(pos, imagebox2)) {
if (this.cgs.includes(this.UIMx[page][0][2])) {
const img = core.material.images.images[this.UIMx[page][0][2]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
show = !show;
}
}
} else if (inRect(pos, imagebox3)) {
if (this.cgs.includes(this.UIMx[page][1][0])) {
const img = core.material.images.images[this.UIMx[page][1][0]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
show = !show;
}
}
} else if (inRect(pos, imagebox4)) {
if (this.cgs.includes(this.UIMx[page][1][1])) {
const img = core.material.images.images[this.UIMx[page][1][1]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
show = !show;
}
}
} else if (inRect(pos, imagebox5)) {
if (this.cgs.includes(this.UIMx[page][1][2])) {
const img = core.material.images.images[this.UIMx[page][1][2]];
if (img) {
ctx.drawImage(img, 0, 0, 2028, 1248);
@ -12055,11 +12090,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
}
}
}
drawUI() {
//绘制页面
core.clearMap(CGUI);
const bgVertical = core.material.images.images["bg_2010.webp"]; //竖屏背景
const bg = core.material.images.images["bg_5043.webp"]; //横屏背景
if (core.domStyle.isVertical) {
//竖屏
@ -12129,6 +12166,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"#444444",
5
);
if (this.cgs.includes(this.UIMx[page][j][i])) {
if (img)
ctx.drawImage(
img,
@ -12137,6 +12175,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
560 - 30,
420 - 30
);
} else {
ctx.fillStyle = "#000000"
ctx.fillRect(50 + j * 600 + 15,
200 + i * 550 + 15,
560 - 30,
420 - 30)
}
}
}
} else {
@ -12203,6 +12248,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"#444444",
2
);
if (this.cgs.includes(this.UIMx[page][i][j])) {
const img = core.material.images.images[this.UIMx[page][i][j]];
if (img)
ctx.drawImage(
@ -12212,16 +12258,31 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
600 - 30,
450 - 30
);
} else {
ctx.fillStyle = "#000000"
ctx.fillRect(75 + j * 650 + 15,
150 + i * 500 + 15,
600 - 30,
450 - 30)
}
}
}
}
}
}
this.setcgs = function (img) {
const a = core.getLocalStorage('cgs', [])
if (img) {
if (!a.includes(img)) a.push(img)
core.setLocalStorage('cgs', a)
} else(core.setLocalStorage('cgs'))
}
core.ui.CG = new CG();
main.dom.CGMode.onclick = function () {
//点击开始页面的CG MODE进入cg回廊
main.core.control.checkBgm();
page = 0;
main.core.ui.CG.cgs = core.getLocalStorage('cgs', [])
CGUI.style.display = "block";
main.core.ui.CG.update();
};