CG回廊 #3

Merged
strawberry42271 merged 9 commits from CG回廊 into main 2024-12-06 09:34:59 +08:00
3 changed files with 33 additions and 22 deletions
Showing only changes of commit a74d7a9e02 - Show all commits

View File

@ -26,6 +26,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bear.png",
"bg.jpg",
"bg2.jpg",
"bg_5043.png",
"brave.png",
"d.png",
"dl.png",
@ -43,7 +44,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"now.png",
"null.png",
"r.png",
"shengnvxizao.png",
"status.png",
"statusBackground.jpg",
"statusBackground.png",

BIN
project/images/bg_5043.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -8639,7 +8639,8 @@ core.plugin.animate = {
// 在此增加新插件
const CGUI = document.createElement('canvas'); //CGui画布设置
CGUI.style.position = 'absolute';
CGUI.style.zIndex = 0;
CGUI.style.zIndex = 300;
CGUI.style.display = "none"
CGUI.id = 'CGUI';
main.dom.gameGroup.insertAdjacentElement('afterend', CGUI)
CGUI.style.top = "50%"
@ -8778,7 +8779,7 @@ core.plugin.animate = {
onclick(px, py) { //点击
console.log([px, py])
if (px >= 33 && px <= 177 && py >= 33 && py <= 177) { //离开按钮是一致的,其余的记区分横竖屏
CGUI.style.zIndex = 0
CGUI.style.display = "none"
core.clearMap(ctx)
core.restart();
}
@ -8796,12 +8797,17 @@ core.plugin.animate = {
core.clearMap(CGUI)
if (!core?.material?.images?.images?.['winskin1.png']) return
if (core.domStyle.isVertical) { //竖屏
core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028);
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028);
core.fillRect(ctx, 0, 0, 1248, 2028, "#000000") //黑色背景
ctx.globalAlpha = 0.5 //透明度
drawImage(ctx, "backgroundvertical.png", 0, 0, 1280, 1500, 0, 0, 1248, 2028) //绘制半透明背景图片
ctx.globalAlpha = 1 //恢复为不透明
core.setTextAlign(ctx, 'center');
core.fillRoundRect(ctx, 45 - 6, 45 - 6, 120 + 12, 80 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 45 - 12, 45 - 12, 120 + 24, 80 + 24, 12, "#444444", 3);
core.fillText(ctx, '离开', 100, 110, '#FFFFFF', core.ui._buildFont(33, true));
/*
// 添加向上翻页和向下翻页的按钮
core.fillRoundRect(ctx, 100 - 6, 100 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 100 - 12, 100 - 12, 120 + 24, 120 + 120, 12, "#444444", 3);
@ -8819,10 +8825,13 @@ core.plugin.animate = {
// 添加浏览模式和CG模式的字样
core.fillText(ctx, '浏览模式', 400, 180, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, 'CG模式', 1200, 180, '#FFFFFF', core.ui._buildFont(24, true));
*/
} else { //横屏
ctx.canvas.width = 2028;
ctx.canvas.height = 1248;
core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000") //黑色背景
ctx.globalAlpha = 0.5 //透明度
drawImage(ctx, "bg_5043.png", 0, 0, 1280, 720, 0, 0, 2028, 1248) //绘制半透明背景图片
ctx.globalAlpha = 1 //恢复为不透明
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
core.setTextAlign(ctx, 'center');
core.fillRoundRect(ctx, 45 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 45 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
@ -8861,28 +8870,30 @@ core.plugin.animate = {
main.dom.CGMode.onclick = function () {
main.core.control.checkBgm();
CGUI.style.zIndex = 10000
CGUI.style.display = "block"
main.core.ui.CG.update()
}
},
"光标设置": function () {
// 在此增加新插件
this.mouse = function (image) {
this.changeMouse = function (icon, div = 'gameGroup', translateX = 0, translateY = 0, scaleX = 1, scaleY = 1, degree = 0) {
const canvas = document.createElement('canvas'); //CGui画布设置
canvas.width = 32
canvas.height = 32
const ctx = canvas.getContext("2d")
let info = core.getBlockInfo(image);
if (!info) {
// 检查状态栏图标
if (core.statusBar.icons[image] instanceof Image)
info = { image: core.statusBar.icons[image], posX: 0, posY: 0, height: 32 };
else return;
}
canvas.width = 64
canvas.height = 64
core.drawIcon(ctx, image, 0, 0, 32, 32)
const ctx = canvas.getContext("2d")
ctx.translate(translateX, translateY) //偏移画布x,y
ctx.scale(scaleX, scaleY) //(x,y轴缩放倍率-1为沿XY轴翻转)
const angle = degree * Math.PI / 180 //根据角度计算参数
ctx.rotate(angle) //顺时针旋转(以画布原点为中心,可通过偏移画布影响中心点)
let info = { image: core.statusBar.icons[icon], posX: 0, posY: 0, height: 32 };
core.drawIcon(ctx, icon, 0, 0, 32, 32)
const data = canvas.toDataURL("image/png")
core.dom.gameGroup.style.cursor = `url(${data}),auto`
core.dom[div].style.cursor = `url(${data}),auto` //div为你要改变光标的元素默认为包含状态栏的整个游戏画面
}
this.removeMouse = function (div = 'gameGroup') {
core.dom[div].style.cursor = ''
}
}
}