修改cg中page的修改项与绘图功能

This commit is contained in:
sakuya 2024-12-06 18:03:43 +08:00
parent e59bdda35a
commit 581f9ae75d
2 changed files with 90 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@ -8807,7 +8807,7 @@ core.plugin.animate = {
this.drawUI();
return
}
console.log([px, py]);
console.log([px, py], page);
const makeBox = ([x, y], [w, h]) => {
return [
[x, y],
@ -8832,7 +8832,13 @@ core.plugin.animate = {
//竖屏
const pageupbox = makeBox([33, 384], [144, 136])
const pagedownbox = makeBox([33, 1080], [144, 190])
const imagebox0 = makeBox([200, 300], [480, 320])
const imagebox0 = makeBox([200, 300], [680, 320])
const imagebox1 = makeBox([200, 750], [680, 1070])
const imagebox2 = makeBox([200, 1200], [680, 1520])
const imagebox3 = makeBox([700, 300], [1200, 600])
const imagebox4 = makeBox([700, 850], [1200, 1050])
const imagebox5 = makeBox([700, 1300], [1200, 1500])
if (inRect(pos, pageupbox)) {
//2代表当前最大页数-1
if (page < 2) {
@ -8848,12 +8854,65 @@ core.plugin.animate = {
}
} else if (inRect(pos, imagebox0)) {
const img = core.material.images.images[this.UIMx[page][0][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox1)) {
const img = core.material.images.images[this.UIMx[page][0][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox2)) {
const img = core.material.images.images[this.UIMx[page][0][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox3)) {
const img = core.material.images.images[this.UIMx[page][1][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox4)) {
const img = core.material.images.images[this.UIMx[page][1][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox5)) {
const img = core.material.images.images[this.UIMx[page][1][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
}
} else {
const pageupbox = makeBox([33, 342], [144, 129])
const pagedownbox = makeBox([33, 837], [144, 138])
@ -8865,7 +8924,7 @@ core.plugin.animate = {
}
} else if (inRect(pos, pagedownbox)) {
if (page > 0) {
page++;
page--;
core.clearMap(ctx);
this.drawUI();
}
@ -8873,7 +8932,6 @@ core.plugin.animate = {
}
}
}
drawUI() {
core.clearMap(CGUI)
if (!core?.material?.images?.images?.['winskin1.png']) return
@ -8906,12 +8964,14 @@ core.plugin.animate = {
}
// 添加浏览模式和CG模式的字样
/*
core.fillRoundRect(ctx, 350 - 6, 120 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 350 - 12, 120 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillRoundRect(ctx, 950 - 6, 120 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 950 - 12, 120 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillText(ctx, '浏览模式', 400, 180, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, 'CG模式', 1000, 180, '#FFFFFF', core.ui._buildFont(24, true));
*/
} else { //横屏
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000") //黑色背景
ctx.globalAlpha = 0.5 //透明度
@ -8934,17 +8994,21 @@ core.plugin.animate = {
// 添加3*2个4:3的画框
for (let i = 0; i < 2; i++) {
for (let j = 0; j < 3; j++) {
core.fillRect(ctx, 300 + j * 500, 300 + i * 450, 480, 320, '#FFFFFF');
core.strokeRect(ctx, 300 + j * 500, 300 + i * 450, 480, 320, "#444444", 2);
const img = core.material.images.images[this.UIMx[page][i][j]]
if (img) ctx.drawImage(img, 300 + j * 500 + 15, 300 + i * 450 + 15, 480 - 30, 320 - 30)
}
}
// 添加浏览模式和CG模式的字样
/*
core.fillRoundRect(ctx, 550 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 550 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
core.fillText(ctx, '浏览模式', 600, 100, '#FFFFFF', core.ui._buildFont(24, true));
core.fillRoundRect(ctx, 1150 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 1150 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
core.fillText(ctx, 'CG模式', 1200, 100, '#FFFFFF', core.ui._buildFont(24, true))
*/
}