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LIxMFLw4S+NUjF1KUl8BQ445dM0mSDNUxwDXKDB/DyVAFCUN4gNgZAUF8SEnMQLQszgOE0FwZAcXBa5GAACS3TBfLKQKIBwZgDBwP4oDqXzZkCgx6HQa4CVqL933g0FYFecZBB+PAJAAQUwbs6n8W4ZG8DSaJASFmBwehIqsoC3xcrlyHQGzCOSaz6EIgA5XC7x9fYWTESFlnQZhBBi7K2gwN8fxINViiILkuXKMoJTOLNoAEWBqSsrAcFVGIZC6Xx0GEPAXMcPrsCCNh6CCcKggaCRwg+xZ5EUZRXpkDL1jqS5hm7CB7SYOQuURH0poxHhjicGwiAxQ56myWBYDh90EX2FFjh4IhjkpqnqYxOwhsEGRMBi4wXDiPNXJSNJ6cZmK6pYdghuEKAMriPm2DkDILGwZgxYFjmyygeLbhWHA1ggPpequGc4BwABlWRVU1ppYBBLkEWOYmeAROZTApFyQHHHL1o/Wo+RKZwPdIT3va90higAWhMQPSGD0OTGcMOQ6D6Oo6j8pvcO8gaGyWROD+eBHVYAANcqNXK25ysyTIAE0AFEUXK7IAFk+E+fxHXocqxAMRRXhmcZ4rOjY/oPY4cARRB2UEfYCC9ZhjkH7J0a5UeFWxlELQIMBGWOH0iDCchdXoe2fUEZlBEQT0MXBIhmBRZhwRRMBPWOcEMUQBFBHBfZia5UIUUQRAwFRMR1ndIhPQIh9CiT0N99iehRH6foQA===
|
@ -54,6 +54,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"bg_6004.webp",
|
"bg_6004.webp",
|
||||||
"cao.webp",
|
"cao.webp",
|
||||||
"d.webp",
|
"d.webp",
|
||||||
|
"danqu.webp",
|
||||||
"dl.webp",
|
"dl.webp",
|
||||||
"dlr.webp",
|
"dlr.webp",
|
||||||
"dr.webp",
|
"dr.webp",
|
||||||
@ -172,6 +173,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"other_0004.webp",
|
"other_0004.webp",
|
||||||
"r.webp",
|
"r.webp",
|
||||||
"status.webp",
|
"status.webp",
|
||||||
|
"suiji.webp",
|
||||||
"tati_020101.webp",
|
"tati_020101.webp",
|
||||||
"tati_020101a.webp",
|
"tati_020101a.webp",
|
||||||
"tati_020101y.webp",
|
"tati_020101y.webp",
|
||||||
@ -265,7 +267,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"winbackground.webp",
|
"winbackground.webp",
|
||||||
"winbackgroundVertical.webp",
|
"winbackgroundVertical.webp",
|
||||||
"winskin.webp",
|
"winskin.webp",
|
||||||
"winskin1.webp"
|
"winskin1.webp",
|
||||||
|
"xunhuan.webp"
|
||||||
],
|
],
|
||||||
"tilesets": [
|
"tilesets": [
|
||||||
"magictower.webp",
|
"magictower.webp",
|
||||||
|
BIN
project/images/danqu.webp
Normal file
BIN
project/images/danqu.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 986 B |
BIN
project/images/suiji.webp
Normal file
BIN
project/images/suiji.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 834 B |
BIN
project/images/xunhuan.webp
Normal file
BIN
project/images/xunhuan.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 956 B |
@ -11894,11 +11894,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
[x + w, y + h],
|
[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;
|
return sx <= x && x <= dx && sy <= y && y <= dy;
|
||||||
};
|
};
|
||||||
const pos = [px, py];
|
const pos = [px, py];
|
||||||
const backbox = makeBox([45, 45], [120, 80]);
|
const backbox = makeBox([15, 35], [210, 90]);
|
||||||
if (inRect(pos, backbox)) {
|
if (inRect(pos, backbox)) {
|
||||||
//离开按钮是一致的,其余的记区分横竖屏
|
//离开按钮是一致的,其余的记区分横竖屏
|
||||||
CGUI.style.display = "none";
|
CGUI.style.display = "none";
|
||||||
@ -12067,34 +12070,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
ctx.globalAlpha = 1; //恢复为不透明
|
ctx.globalAlpha = 1; //恢复为不透明
|
||||||
|
|
||||||
core.setTextAlign(ctx, "center");
|
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.fillBoldText1(
|
core.fillBoldText1(
|
||||||
ctx,
|
ctx,
|
||||||
"<离开",
|
'◀离开',
|
||||||
110,
|
110,
|
||||||
100,
|
100,
|
||||||
"#FFFFFF",
|
"#FFFFFF",
|
||||||
"#000000",
|
"#000000",
|
||||||
6,
|
6,
|
||||||
core.ui._buildFont(33, true)
|
core.ui._buildFont(66, true)
|
||||||
);
|
);
|
||||||
// 添加向上翻页和向下翻页的按钮
|
// 添加向上翻页和向下翻页的按钮
|
||||||
core.fillRoundRect(
|
core.fillRoundRect(
|
||||||
@ -12187,34 +12171,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
ctx.globalAlpha = 1; //恢复为不透明
|
ctx.globalAlpha = 1; //恢复为不透明
|
||||||
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
|
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248);
|
||||||
core.setTextAlign(ctx, "center");
|
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.fillBoldText1(
|
core.fillBoldText1(
|
||||||
ctx,
|
ctx,
|
||||||
"<离开",
|
'◀离开',
|
||||||
110,
|
110,
|
||||||
100,
|
100,
|
||||||
"#FFFFFF",
|
"#FFFFFF",
|
||||||
"#000000",
|
"#000000",
|
||||||
6,
|
6,
|
||||||
core.ui._buildFont(33, true)
|
core.ui._buildFont(66, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 添加向上翻页和向下翻页的按钮
|
// 添加向上翻页和向下翻页的按钮
|
||||||
@ -14249,7 +14214,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
},
|
},
|
||||||
"musicMode": function () {
|
"musicMode": function () {
|
||||||
// 在此增加新插件
|
// 在此增加新插件
|
||||||
const music = document.createElement("canvas"); //CGui画布设置
|
const music = document.createElement("canvas");
|
||||||
music.style.position = "absolute";
|
music.style.position = "absolute";
|
||||||
music.style.zIndex = 300;
|
music.style.zIndex = 300;
|
||||||
music.style.display = "none";
|
music.style.display = "none";
|
||||||
@ -14260,21 +14225,134 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
music.style.transform = "translate(-50%,-50%)";
|
music.style.transform = "translate(-50%,-50%)";
|
||||||
const ctx = music.getContext("2d");
|
const ctx = music.getContext("2d");
|
||||||
main.dom.music = music;
|
main.dom.music = music;
|
||||||
|
|
||||||
|
const audio = document.createElement("audio")
|
||||||
|
audio.autoplay = true
|
||||||
|
audio.preload = 'auto'
|
||||||
|
|
||||||
|
function getRandomInt(min, max) {
|
||||||
|
const minCeiled = Math.ceil(min);
|
||||||
|
const maxFloored = Math.floor(max);
|
||||||
|
return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled);
|
||||||
|
}
|
||||||
let page = 0; //初始页面
|
let page = 0; //初始页面
|
||||||
let show = false; //展示状态
|
let ischange = false;
|
||||||
music.onclick = function (e) {
|
let isvolume = false;
|
||||||
try {
|
music.addEventListener('mousedown', function (e) {
|
||||||
e.preventDefault();
|
e.stopPropagation();
|
||||||
if (core.isPlaying()) return false;
|
|
||||||
const left = core.dom.gameGroup.offsetLeft;
|
const left = core.dom.gameGroup.offsetLeft;
|
||||||
const top = core.dom.gameGroup.offsetTop;
|
const top = core.dom.gameGroup.offsetTop;
|
||||||
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
|
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
|
||||||
py = Math.floor((e.clientY - top) / core.domStyle.scale);
|
py = Math.floor((e.clientY - top) / core.domStyle.scale);
|
||||||
core.ui.music.onclick(px * 3, py * 3);
|
core.ui.music.mousedown(px * 3, py * 3);
|
||||||
} catch (ee) {
|
|
||||||
main.log(ee);
|
})
|
||||||
|
music.addEventListener('mousemove', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
const left = core.dom.gameGroup.offsetLeft;
|
||||||
|
const top = core.dom.gameGroup.offsetTop;
|
||||||
|
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
|
||||||
|
py = Math.floor((e.clientY - top) / core.domStyle.scale);
|
||||||
|
core.ui.music.mousemove(px * 3, py * 3);
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener('mouseup', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
ischange = false;
|
||||||
|
isvolume = false;
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener('mouseleave', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
ischange = false;
|
||||||
|
isvolume = false;
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener("touchstart", function (e) {
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
const left = core.dom.gameGroup.offsetLeft;
|
||||||
|
const top = core.dom.gameGroup.offsetTop;
|
||||||
|
const px = Math.floor(
|
||||||
|
(e.touches[0].clientX - left) / core.domStyle.scale
|
||||||
|
),
|
||||||
|
py = Math.floor(
|
||||||
|
(e.touches[0].clientY - top) / core.domStyle.scale
|
||||||
|
);
|
||||||
|
core.ui.music.mousedown(px * 3, py * 3);
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener('touchmove', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
const left = core.dom.gameGroup.offsetLeft;
|
||||||
|
const top = core.dom.gameGroup.offsetTop;
|
||||||
|
const px = Math.floor((e.touches[0].clientX - left) / core.domStyle.scale),
|
||||||
|
py = Math.floor((e.touches[0].clientY - top) / core.domStyle.scale);
|
||||||
|
core.ui.music.mousemove(px * 3, py * 3);
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener('touchend', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
ischange = false;
|
||||||
|
isvolume = false;
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
|
||||||
|
})
|
||||||
|
music.addEventListener('touchcancel', function (e) {
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
ischange = false;
|
||||||
|
isvolume = false;
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
audio.addEventListener('ended', function () {
|
||||||
|
console.log(1)
|
||||||
|
switch (main.core.ui.music.type) {
|
||||||
|
case 'danqu':
|
||||||
|
audio.currentTime = 0
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
main.core.ui.music.stop = false
|
||||||
|
page = main.core.ui.music.selection[0]
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'xunhuan':
|
||||||
|
if (main.core.ui.music.selection[1] === main.core.ui.music.musicMx[main.core.ui.music.selection[0]].length - 1) {
|
||||||
|
if (main.core.ui.music.selection[0] === main.core.ui.music.musicMx.length - 1) {
|
||||||
|
main.core.ui.music.selection[0] = 0
|
||||||
|
main.core.ui.music.selection[1] = 0
|
||||||
|
} else {
|
||||||
|
main.core.ui.music.selection[0] += 1
|
||||||
|
main.core.ui.music.selection[1] = 0
|
||||||
}
|
}
|
||||||
};
|
} else {
|
||||||
|
main.core.ui.music.selection[1] += 1
|
||||||
|
}
|
||||||
|
page = main.core.ui.music.selection[0]
|
||||||
|
audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]
|
||||||
|
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
main.core.ui.music.stop = false
|
||||||
|
break;
|
||||||
|
case 'suiji':
|
||||||
|
main.core.ui.music.selection[0] = getRandomInt(0, main.core.ui.music.musicMx.length)
|
||||||
|
main.core.ui.music.selection[1] = getRandomInt(0, main.core.ui.music.musicMx[main.core.ui.music.selection[0]].length)
|
||||||
|
audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]
|
||||||
|
page = main.core.ui.music.selection[0]
|
||||||
|
|
||||||
|
if (!main.core.ui.music.stop) audio.play()
|
||||||
|
main.core.ui.music.stop = false
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
core.audio = audio
|
||||||
|
|
||||||
class musicclass {
|
class musicclass {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -14292,6 +14370,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
"op.mp3": "op",
|
"op.mp3": "op",
|
||||||
"theme.mp3": "theme",
|
"theme.mp3": "theme",
|
||||||
};
|
};
|
||||||
|
this.selection = [0, 0]
|
||||||
|
this.stop = false
|
||||||
|
this.type = "xunhuan"
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新
|
//更新
|
||||||
@ -14309,33 +14390,205 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
music.height = 1248;
|
music.height = 1248;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onclick(px, py) {
|
mousedown(px, py) {
|
||||||
//点击
|
//鼠标按下时
|
||||||
if (show) {
|
|
||||||
show = !show;
|
|
||||||
core.clearMap(ctx);
|
|
||||||
this.update();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const makeBox = ([x, y], [w, h]) => {
|
const makeBox = ([x, y], [w, h]) => {
|
||||||
return [
|
return [
|
||||||
[x, y],
|
[x, y],
|
||||||
[x + w, y + h],
|
[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;
|
return sx <= x && x <= dx && sy <= y && y <= dy;
|
||||||
};
|
};
|
||||||
const pos = [px, py];
|
const pos = [px, py];
|
||||||
const backbox = makeBox([45, 45], [120, 80]);
|
const backbox = makeBox([15, 35], [210, 90]);
|
||||||
if (inRect(pos, backbox)) {
|
if (inRect(pos, backbox)) {
|
||||||
//离开按钮是一致的,其余的记区分横竖屏
|
//离开按钮是一致的,其余的记区分横竖屏
|
||||||
music.style.display = "none";
|
music.style.display = "none";
|
||||||
core.clearMap(ctx);
|
core.clearMap(ctx);
|
||||||
|
core.unregisterAnimationFrame('music')
|
||||||
|
audio.src = ""
|
||||||
core.restart();
|
core.restart();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (core.domStyle.isVertical) { //竖屏
|
||||||
|
|
||||||
|
} else { //横屏
|
||||||
|
const pageupbox = makeBox([1050, 1100], [200, 100]);
|
||||||
|
const pagedownbox = makeBox([1550, 1100], [200, 100]);
|
||||||
|
const musicbox = makeBox([900, 100], [1000, this.musicMx[page].length * 100])
|
||||||
|
const beforebox = makeBox([135, 760], [50, 50])
|
||||||
|
const afterbox = makeBox([440, 760], [50, 50])
|
||||||
|
const playbox = makeBox([260, 730], [100, 100])
|
||||||
|
const typebox = makeBox([580, 730], [100, 100])
|
||||||
|
const changebox = makeBox([100, 590], [600, 20])
|
||||||
|
const volumebox = makeBox([100, 990], [600, 20])
|
||||||
|
if (inRect(pos, pageupbox)) {
|
||||||
|
if (page !== 0) page -= 1
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (inRect(pos, pagedownbox)) {
|
||||||
|
if (page !== this.musicMx.length - 1) page += 1
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, playbox)) {
|
||||||
|
if (this.stop) {
|
||||||
|
this.stop = !this.stop
|
||||||
|
audio.play()
|
||||||
|
} else {
|
||||||
|
this.stop = !this.stop
|
||||||
|
audio.pause()
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, beforebox)) {
|
||||||
|
switch (this.type) {
|
||||||
|
case 'danqu':
|
||||||
|
audio.currentTime = 0
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
page = this.selection[0]
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'xunhuan':
|
||||||
|
if (this.selection[1] === 0) {
|
||||||
|
if (this.selection[0] === 0) {
|
||||||
|
this.selection[0] = this.musicMx.length - 1
|
||||||
|
this.selection[1] = this.musicMx[this.selection[0]].length - 1
|
||||||
|
} else {
|
||||||
|
this.selection[0] -= 1
|
||||||
|
this.selection[1] = this.musicMx[this.selection[0]].length - 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.selection[1] -= 1
|
||||||
|
}
|
||||||
|
page = this.selection[0]
|
||||||
|
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
|
||||||
|
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
break;
|
||||||
|
case 'suiji':
|
||||||
|
this.selection[0] = getRandomInt(0, this.musicMx.length)
|
||||||
|
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length)
|
||||||
|
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
|
||||||
|
page = this.selection[0]
|
||||||
|
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, afterbox)) {
|
||||||
|
switch (this.type) {
|
||||||
|
case 'danqu':
|
||||||
|
audio.currentTime = 0
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
page = this.selection[0]
|
||||||
|
break;
|
||||||
|
case 'xunhuan':
|
||||||
|
if (this.selection[1] === this.musicMx[this.selection[0]].length - 1) {
|
||||||
|
if (this.selection[0] === this.musicMx.length - 1) {
|
||||||
|
this.selection[0] = 0
|
||||||
|
this.selection[1] = 0
|
||||||
|
} else {
|
||||||
|
this.selection[0] += 1
|
||||||
|
this.selection[1] = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.selection[1] += 1
|
||||||
|
}
|
||||||
|
page = this.selection[0]
|
||||||
|
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
|
||||||
|
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
break;
|
||||||
|
case 'suiji':
|
||||||
|
this.selection[0] = getRandomInt(0, this.musicMx.length)
|
||||||
|
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length)
|
||||||
|
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
|
||||||
|
|
||||||
|
page = this.selection[0]
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, typebox)) {
|
||||||
|
switch (this.type) {
|
||||||
|
case 'danqu':
|
||||||
|
this.type = 'xunhuan'
|
||||||
|
break;
|
||||||
|
case 'xunhuan':
|
||||||
|
this.type = 'suiji'
|
||||||
|
break;
|
||||||
|
case 'suiji':
|
||||||
|
this.type = 'danqu'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, musicbox)) {
|
||||||
|
const index = Math.floor((py - 100) / 100)
|
||||||
|
if (page !== this.selection[0] || index !== this.selection[1]) {
|
||||||
|
this.selection[0] = page
|
||||||
|
this.selection[1] = index
|
||||||
|
audio.src = "project/bgms/" + this.musicMx[page][index]
|
||||||
|
|
||||||
|
if (!this.stop) audio.play()
|
||||||
|
this.stop = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (this.stop) {
|
||||||
|
this.stop = !this.stop
|
||||||
|
audio.play()
|
||||||
|
} else {
|
||||||
|
this.stop = !this.stop
|
||||||
|
audio.pause()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (inRect(pos, changebox)) {
|
||||||
|
|
||||||
|
const time = Math.floor((px - 100) / 600 * audio.duration)
|
||||||
|
|
||||||
|
audio.pause()
|
||||||
|
audio.currentTime = time;
|
||||||
|
|
||||||
|
ischange = true
|
||||||
|
}
|
||||||
|
if (inRect(pos, volumebox)) {
|
||||||
|
const time = (px - 100) / 600
|
||||||
|
audio.volume = time
|
||||||
|
isvolume = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mousemove(px, py) {
|
||||||
|
if (ischange) {
|
||||||
|
const time = Math.min(Math.max(Math.floor((px - 100) / 600 * audio.duration), 0), audio.duration)
|
||||||
|
|
||||||
|
audio.currentTime = time
|
||||||
|
|
||||||
|
}
|
||||||
|
if (isvolume) {
|
||||||
|
const time = Math.min(Math.max((px - 100) / 600, 0), 1)
|
||||||
|
audio.volume = time
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawUI() {
|
drawUI() {
|
||||||
//绘制页面
|
//绘制页面
|
||||||
core.clearMap(music);
|
core.clearMap(music);
|
||||||
@ -14351,35 +14604,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
ctx.globalAlpha = 1; //恢复为不透明
|
ctx.globalAlpha = 1; //恢复为不透明
|
||||||
|
|
||||||
core.setTextAlign(ctx, "center");
|
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.fillBoldText1(
|
core.fillBoldText1(
|
||||||
ctx,
|
ctx,
|
||||||
"<离开",
|
'◀离开',
|
||||||
110,
|
110,
|
||||||
100,
|
100,
|
||||||
"#FFFFFF",
|
"#FFFFFF",
|
||||||
"#000000",
|
"#000000",
|
||||||
6,
|
6,
|
||||||
core.ui._buildFont(33, true)
|
core.ui._buildFont(66, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//横屏
|
//横屏
|
||||||
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景
|
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景
|
||||||
@ -14387,35 +14622,168 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
if (bg) ctx.drawImage(bg, 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片
|
if (bg) ctx.drawImage(bg, 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片
|
||||||
ctx.globalAlpha = 1; //恢复为不透明
|
ctx.globalAlpha = 1; //恢复为不透明
|
||||||
core.setTextAlign(ctx, "center");
|
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.fillBoldText1(
|
core.fillBoldText1(
|
||||||
ctx,
|
ctx,
|
||||||
"<离开",
|
'◀离开',
|
||||||
110,
|
110,
|
||||||
100,
|
100,
|
||||||
"#FFFFFF",
|
"#FFFFFF",
|
||||||
"#000000",
|
"#000000",
|
||||||
6,
|
6,
|
||||||
core.ui._buildFont(33, true)
|
core.ui._buildFont(66, true)
|
||||||
);
|
);
|
||||||
|
//core.fillRect(ctx, 440, 760, 50, 50)
|
||||||
|
ctx.strokeStyle = "#FFFFFF"
|
||||||
|
ctx.lineWidth = 3
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(800, 100)
|
||||||
|
ctx.lineTo(800, 1148)
|
||||||
|
ctx.moveTo(900, 100)
|
||||||
|
ctx.lineTo(1900, 100)
|
||||||
|
ctx.stroke()
|
||||||
|
let posy = 200
|
||||||
|
const indexList = this.musicMx[page]
|
||||||
|
core.setTextAlign(ctx, "left");
|
||||||
|
for (let i = 0; i < indexList.length; i++) {
|
||||||
|
const text = this.musicname[indexList[i]]
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
text,
|
||||||
|
950,
|
||||||
|
posy - 30,
|
||||||
|
page === this.selection[0] && i === this.selection[1] ? "#FFFFFF" : "#444444",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(66, true)
|
||||||
|
);
|
||||||
|
ctx.strokeStyle = "#FFFFFF"
|
||||||
|
ctx.lineWidth = 3
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(900, posy)
|
||||||
|
ctx.lineTo(1900, posy)
|
||||||
|
ctx.stroke()
|
||||||
|
posy += 100
|
||||||
|
}
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
'上一页',
|
||||||
|
1050,
|
||||||
|
1200 - 30,
|
||||||
|
page === 0 ? "#444444" : "#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(66, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
(page + 1) + "/" + this.musicMx.length,
|
||||||
|
1350,
|
||||||
|
1200 - 30,
|
||||||
|
"#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(66, true)
|
||||||
|
);
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
'下一页',
|
||||||
|
1550,
|
||||||
|
1200 - 30,
|
||||||
|
page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(66, true)
|
||||||
|
);
|
||||||
|
ctx.strokeStyle = "#ffffff"
|
||||||
|
ctx.lineWidth = 3
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(100, 600)
|
||||||
|
ctx.lineTo(700, 600)
|
||||||
|
ctx.stroke()
|
||||||
|
ctx.fillStyle = "#ffffff"
|
||||||
|
ctx.font = "bold 48px Verdana"
|
||||||
|
ctx.fillText('|', 130, 797)
|
||||||
|
ctx.fillText('◀', 140, 800)
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(310, 780, 50, 0, 2 * Math.PI)
|
||||||
|
ctx.stroke()
|
||||||
|
if (this.stop) { ctx.fillText('▶', 295, 797) } else { ctx.fillText('||', 285, 794) }
|
||||||
|
|
||||||
|
ctx.fillText('|', 470, 797)
|
||||||
|
ctx.fillText('▶', 450, 800)
|
||||||
|
ctx.fillText('音量', 350, 900)
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(100, 1000)
|
||||||
|
ctx.lineTo(700, 1000)
|
||||||
|
ctx.stroke()
|
||||||
|
ctx.strokeStyle = "#ffffff"
|
||||||
|
ctx.lineWidth = 9
|
||||||
|
ctx.fillStyle = 'rgba(255,255,255,0.5)'
|
||||||
|
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(100, 1000)
|
||||||
|
ctx.lineTo(600 * audio.volume + 100, 1000)
|
||||||
|
ctx.stroke()
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(600 * audio.volume + 100, 1000, 10, 0, 2 * Math.PI)
|
||||||
|
ctx.fill()
|
||||||
|
core.fillBoldText1(
|
||||||
|
ctx,
|
||||||
|
Math.floor(100 * audio.volume),
|
||||||
|
720,
|
||||||
|
1010,
|
||||||
|
"#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
6,
|
||||||
|
core.ui._buildFont(32, true)
|
||||||
|
);
|
||||||
|
const img = core.material.images.images[this.type + '.webp']
|
||||||
|
if (img) ctx.drawImage(img, 580, 730, 100, 100)
|
||||||
|
core.setTextAlign(ctx, "center");
|
||||||
|
ctx.font = "bold 48px Verdana"
|
||||||
|
ctx.fillText('当前歌曲', 400, 297)
|
||||||
|
ctx.fillText(this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], 400, 397)
|
||||||
|
|
||||||
|
ctx.font = "bold 36px Verdana"
|
||||||
|
const thistime = audio.currentTime
|
||||||
|
|
||||||
|
if (thistime) {
|
||||||
|
const timetext = (Math.floor(thistime / 60).toString()).padStart(2, '0') + ':' + Math.floor(thistime % 60).toString().padStart(2, '0')
|
||||||
|
ctx.fillText(timetext, 510, 650)
|
||||||
|
} else {
|
||||||
|
const timetext = "00:00"
|
||||||
|
ctx.fillText(timetext, 510, 650)
|
||||||
|
}
|
||||||
|
ctx.fillText("/", 580, 650)
|
||||||
|
const fulltime = audio.duration
|
||||||
|
|
||||||
|
if (fulltime) {
|
||||||
|
const timetext = Math.floor(fulltime / 60).toString().padStart(2, '0') + ':' + Math.floor(fulltime % 60).toString().padStart(2, '0')
|
||||||
|
ctx.fillText(timetext, 650, 650)
|
||||||
|
} else {
|
||||||
|
const timetext = "00:00"
|
||||||
|
ctx.fillText(timetext, 650, 650)
|
||||||
|
}
|
||||||
|
ctx.strokeStyle = "#ffffff"
|
||||||
|
ctx.lineWidth = 9
|
||||||
|
ctx.fillStyle = 'rgba(255,255,255,0.5)'
|
||||||
|
const pointx = 600 * thistime / fulltime + 100
|
||||||
|
if (fulltime && thistime) {
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.moveTo(100, 600)
|
||||||
|
ctx.lineTo(pointx, 600)
|
||||||
|
ctx.stroke()
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(pointx, 600, 10, 0, 2 * Math.PI)
|
||||||
|
ctx.fill()
|
||||||
|
} else {
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(100, 600, 10, 0, 2 * Math.PI)
|
||||||
|
ctx.fill()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14423,9 +14791,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
main.dom.musicMode.onclick = function () {
|
main.dom.musicMode.onclick = function () {
|
||||||
//点击开始页面的CG MODE进入cg回廊
|
//点击开始页面的CG MODE进入cg回廊
|
||||||
main.core.control.checkBgm();
|
main.core.control.checkBgm();
|
||||||
|
main.core.control.pauseBgm();
|
||||||
|
audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]
|
||||||
|
|
||||||
page = 0;
|
page = 0;
|
||||||
music.style.display = "block";
|
music.style.display = "block";
|
||||||
main.core.ui.music.update();
|
core.registerAnimationFrame("music", null, () => { main.core.ui.music.update() })
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
"横屏切换": function () {
|
"横屏切换": function () {
|
||||||
@ -14499,7 +14870,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
},
|
},
|
||||||
"帧动画特效(游戏界面)": function () {
|
"帧动画特效(游戏界面)": function () {
|
||||||
// 在此增加新插件
|
// 在此增加新插件
|
||||||
const animate2 = document.createElement("canvas"); //画布设置
|
const animate2 = document.createElement("canvas");
|
||||||
animate2.style.zIndex = 71;
|
animate2.style.zIndex = 71;
|
||||||
animate2.id = "animate2";
|
animate2.id = "animate2";
|
||||||
animate2.classList.add('gameCanvas', 'anti-aliasing')
|
animate2.classList.add('gameCanvas', 'anti-aliasing')
|
||||||
@ -14613,8 +14984,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
angle = (Math.PI * (image.angel ?? 0) / 180) + ((Math.PI * (image.aangel ?? 0) / 180) - ((Math.PI * (image.angel ?? 0) / 180)) * (one.farme - beforefarme)) / (afterfarme - beforefarme || 1);
|
angle = (Math.PI * (image.angel ?? 0) / 180) + ((Math.PI * (image.aangel ?? 0) / 180) - ((Math.PI * (image.angel ?? 0) / 180)) * (one.farme - beforefarme)) / (afterfarme - beforefarme || 1);
|
||||||
if (one.hero) {
|
if (one.hero) {
|
||||||
let sx, sy;
|
let sx, sy;
|
||||||
if (core.status.heroMoving < 0) { sx = 0;
|
if (core.status.heroMoving < 0) {
|
||||||
sy = 0 } else {
|
sx = 0;
|
||||||
|
sy = 0
|
||||||
|
} else {
|
||||||
sx = core.utils.scan[core.status.hero.loc.direction].x * 4 * core.status.heroMoving
|
sx = core.utils.scan[core.status.hero.loc.direction].x * 4 * core.status.heroMoving
|
||||||
sy = core.utils.scan[core.status.hero.loc.direction].y * 4 * core.status.heroMoving
|
sy = core.utils.scan[core.status.hero.loc.direction].y * 4 * core.status.heroMoving
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user