cg、music ui优化

This commit is contained in:
草莓 2025-01-12 23:34:15 +08:00
parent 657bfefae9
commit 2bb9cefc58

View File

@ -11911,16 +11911,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
//竖屏 //竖屏
const pageupbox = makeBox([30, 380], [144, 144]); const pageupbox = makeBox([200, 1830], [200, 100]);
const pagedownbox = makeBox([30, 1080], [144, 144]); const pagedownbox = makeBox([900, 1830], [200, 100]);
const imagebox0 = makeBox([200, 300], [480, 320]); const imagebox0 = makeBox([50, 200], [560, 420]);
const imagebox1 = makeBox([200, 750], [480, 320]); const imagebox1 = makeBox([50, 750], [560, 420]);
const imagebox2 = makeBox([200, 1200], [480, 320]); const imagebox2 = makeBox([50, 1300], [560, 420]);
const imagebox3 = makeBox([700, 300], [480, 320]); const imagebox3 = makeBox([650, 200], [560, 420]);
const imagebox4 = makeBox([700, 750], [480, 320]); const imagebox4 = makeBox([650, 750], [560, 420]);
const imagebox5 = makeBox([700, 1200], [480, 320]); const imagebox5 = makeBox([650, 1300], [560, 420]);
if (inRect(pos, pagedownbox)) { if (inRect(pos, pagedownbox)) {
//2代表当前最大页数-1 //2代表当前最大页数-1
if (page < this.UIMx.length - 1) { if (page < this.UIMx.length - 1) {
@ -11996,14 +11996,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
} }
} else { } else {
const pageupbox = makeBox([30, 340], [144, 144]); const pageupbox = makeBox([200, 1110], [200, 100]);
const pagedownbox = makeBox([30, 840], [144, 144]); const pagedownbox = makeBox([1600, 1110], [200, 100]);
const imagebox0 = makeBox([300, 300], [480, 320]); const imagebox0 = makeBox([75, 150], [600, 450]);
const imagebox1 = makeBox([800, 300], [480, 320]); const imagebox1 = makeBox([725, 150], [600, 450]);
const imagebox2 = makeBox([1300, 300], [480, 320]); const imagebox2 = makeBox([1300, 150], [600, 450]);
const imagebox3 = makeBox([300, 750], [480, 320]); const imagebox3 = makeBox([75, 650], [600, 450]);
const imagebox4 = makeBox([800, 750], [480, 320]); const imagebox4 = makeBox([725, 650], [600, 450]);
const imagebox5 = makeBox([1300, 750], [480, 320]); const imagebox5 = makeBox([1375, 650], [600, 450]);
if (inRect(pos, pagedownbox)) { if (inRect(pos, pagedownbox)) {
if (page < this.UIMx.length - 1) { if (page < this.UIMx.length - 1) {
page++; page++;
@ -12080,11 +12080,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
6, 6,
core.ui._buildFont(66, true) core.ui._buildFont(66, true)
); );
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'上一页', '上一页',
100, 300,
450, 1900,
page === 0 ? "#444444" : "#FFFFFF", page === 0 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12094,8 +12095,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
(page + 1) + "/" + this.UIMx.length, (page + 1) + "/" + this.UIMx.length,
100, 650,
800, 1900,
"#FFFFFF", "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12104,8 +12105,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'下一页', '下一页',
100, 1000,
1150, 1900,
page === this.UIMx.length - 1 ? "#444444" : "#FFFFFF", page === this.UIMx.length - 1 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12121,20 +12122,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const img = core.material.images.images[this.UIMx[page][j][i]]; const img = core.material.images.images[this.UIMx[page][j][i]];
core.strokeRect( core.strokeRect(
ctx, ctx,
200 + j * 500, 50 + j * 600,
300 + i * 450, 200 + i * 550,
480, 560,
320, 420,
"#444444", "#444444",
5 5
); );
if (img) if (img)
ctx.drawImage( ctx.drawImage(
img, img,
200 + j * 500 + 15, 50 + j * 600 + 15,
300 + i * 450 + 15, 200 + i * 550 + 15,
480 - 30, 560 - 30,
320 - 30 420 - 30
); );
} }
} }
@ -12161,8 +12162,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'上一页', '上一页',
100, 300,
400, 1180,
page === 0 ? "#444444" : "#FFFFFF", page === 0 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12172,8 +12173,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
(page + 1) + "/" + this.UIMx.length, (page + 1) + "/" + this.UIMx.length,
100, 1000,
650, 1180,
"#FFFFFF", "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12182,8 +12183,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'下一页', '下一页',
100, 1700,
900, 1180,
page === this.UIMx.length - 1 ? "#444444" : "#FFFFFF", page === this.UIMx.length - 1 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -12195,10 +12196,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
for (let j = 0; j < 3; j++) { for (let j = 0; j < 3; j++) {
core.strokeRect( core.strokeRect(
ctx, ctx,
300 + j * 500, 75 + j * 650,
300 + i * 450, 150 + i * 500,
480, 600,
320, 450,
"#444444", "#444444",
2 2
); );
@ -12206,10 +12207,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (img) if (img)
ctx.drawImage( ctx.drawImage(
img, img,
300 + j * 500 + 15, 75 + j * 650 + 15,
300 + i * 450 + 15, 150 + i * 500 + 15,
480 - 30, 600 - 30,
320 - 30 450 - 30
); );
} }
} }
@ -13741,71 +13742,71 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}; };
}, },
"属性映射": function () { "属性映射": function () {
// 在此增加新插件 // 在此增加新插件
this.statusEquip = function () { this.statusEquip = function () {
const hero = core.status.hero; const hero = core.status.hero;
//装备具体效果在这里写道具填写道具类型为equip并选择装备类型道具的装备属性中装备类型遵循以下填写方式 //装备具体效果在这里写道具填写道具类型为equip并选择装备类型道具的装备属性中装备类型遵循以下填写方式
//固定装备孔的填写0/1/2/3分别对应主手、副手、防具、饰品 //固定装备孔的填写0/1/2/3分别对应主手、副手、防具、饰品
//主副手同时可使用的,填写 武器 //主副手同时可使用的,填写 武器
//具体的换装时装备切换操作写在新道具栏/物品栏插件 //具体的换装时装备切换操作写在新道具栏/物品栏插件
//当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作 //当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作
//主武器效果 //主武器效果
if (core.getEquip[0]) { if (core.getEquip[0]) {
switch (core.getEquip[0]) { switch (core.getEquip[0]) {
case "sword1": case "sword1":
hero.atk = hero.str + hero.agi; hero.atk = hero.str + hero.agi;
hero.magic = false; hero.magic = false;
break; break;
} }
} }
//副手效果 //副手效果
if (core.getEquip[1]) { if (core.getEquip[1]) {
switch (core.getEquip[1]) { switch (core.getEquip[1]) {
case "sword1": case "sword1":
hero.atk += hero.agi; hero.atk += hero.agi;
break; break;
} }
} }
//防具效果 //防具效果
if (core.getEquip[2]) { if (core.getEquip[2]) {
switch (core.getEquip[2]) { switch (core.getEquip[2]) {
case "sword1": case "sword1":
hero.def = hero.con + hero.agi; hero.def = hero.con + hero.agi;
hero.hpmax = 2.5 * hero.con; hero.hpmax = 2.5 * hero.con;
break; break;
} }
} }
//饰品效果 //饰品效果
if (core.getEquip[3]) { if (core.getEquip[3]) {
switch (core.getEquip[3]) { switch (core.getEquip[3]) {
case "sword1": case "sword1":
hero.speed += 0.4 * hero.int + 0.6 * hero.agi; hero.speed += 0.4 * hero.int + 0.6 * hero.agi;
break; break;
} }
} }
}; };
this.updateStatus = function () { this.updateStatus = function () {
const hero = core.status.hero; const hero = core.status.hero;
//默认映射关系 //默认映射关系
hero.hpmax = hero.str * 50 + hero.con * 50; hero.hpmax = hero.str * 50 + hero.con * 50;
hero.atk = hero.str * 0.5 + hero.int * 0.5; hero.atk = hero.str * 0.5 + hero.int * 0.5;
hero.manamax = hero.agi * 0.5 + hero.int * 0.5; hero.manamax = hero.agi * 0.5 + hero.int * 0.5;
hero.def = hero.con * 0.5 + hero.agi * 0.5; hero.def = hero.con * 0.5 + hero.agi * 0.5;
hero.mdef = hero.con * 0.5 + hero.int * 0.5; hero.mdef = hero.con * 0.5 + hero.int * 0.5;
hero.speed = hero.str * 0.5 + hero.agi * 0.5; hero.speed = hero.str * 0.5 + hero.agi * 0.5;
hero.magic = false; hero.magic = false;
this.statusEquip(); //处理装备效果 this.statusEquip(); //处理装备效果
for (let v in hero) { for (let v in hero) {
//归整 //归整
if (typeof hero[v] === "number") { if (typeof hero[v] === "number") {
hero[v] = Math.floor(hero[v]); hero[v] = Math.floor(hero[v]);
} }
} }
hero.hp = Math.min(hero.hp, hero.hpmax); hero.hp = Math.min(hero.hp, hero.hpmax);
hero.mana = Math.min(hero.mana, hero.manamax); hero.mana = Math.min(hero.mana, hero.manamax);
core.status.hero = hero; core.status.hero = hero;
}; };
}, },
"回合制boss战": function () { "回合制boss战": function () {
// 在此增加新插件 // 在此增加新插件
const boss = document.createElement("canvas"); //boss战画布设置 const boss = document.createElement("canvas"); //boss战画布设置
@ -14186,8 +14187,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let page = 0; //初始页面 let page = 0; //初始页面
let ischange = false; let ischange = false;
let isvolume = false; let isvolume = false;
let pcx = 0;
let pcy = 0; function shuffle(arr) {
let n = arr.length,
random;
while (n) {
random = (Math.random() * n--) >>> 0;
[arr[n], arr[random]] = [arr[random], arr[n]];
}
return arr;
}
music.addEventListener('mousedown', function (e) { music.addEventListener('mousedown', function (e) {
e.stopPropagation(); e.stopPropagation();
const left = core.dom.gameGroup.offsetLeft; const left = core.dom.gameGroup.offsetLeft;
@ -14284,6 +14293,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else { } else {
main.core.ui.music.selection[1] += 1 main.core.ui.music.selection[1] += 1
} }
main.core.ui.music.randomList.indexOf(v => v === main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]])
page = main.core.ui.music.selection[0] 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]] audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]
@ -14291,8 +14301,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
main.core.ui.music.stop = false main.core.ui.music.stop = false
break; break;
case 'suiji': case 'suiji':
main.core.ui.music.selection[0] = getRandomInt(0, main.core.ui.music.musicMx.length) if (main.core.ui.music.random < main.core.ui.music.randomList.length - 1) {
main.core.ui.music.selection[1] = getRandomInt(0, main.core.ui.music.musicMx[main.core.ui.music.selection[0]].length) main.core.ui.music.random += 1
} else {
main.core.ui.music.random = 0
}
main.core.ui.music.selection[0] = main.core.ui.music.musicMx.findIndex(v => v.includes(main.core.ui.music.randomList[main.core.ui.music.random]))
main.core.ui.music.selection[1] = main.core.ui.music.musicMx[main.core.ui.music.selection[0]].indexOf(main.core.ui.music.randomList[main.core.ui.music.random])
audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]] 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] page = main.core.ui.music.selection[0]
@ -14301,7 +14316,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
break; break;
} }
}) })
core.audio = audio
class musicclass { class musicclass {
constructor() { constructor() {
@ -14322,6 +14337,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.selection = [0, 0] this.selection = [0, 0]
this.stop = false this.stop = false
this.type = "xunhuan" this.type = "xunhuan"
this.randomList = []
this.random = 0
} }
//更新 //更新
@ -14368,15 +14385,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
if (core.domStyle.isVertical) { //竖屏 if (core.domStyle.isVertical) { //竖屏
const pageupbox = makeBox([100, 900], [200, 100]); const pageupbox = makeBox([100, 1230], [200, 100]);
const pagedownbox = makeBox([700, 900], [200, 100]); const pagedownbox = makeBox([950, 1230], [200, 100]);
const musicbox = makeBox([100, 200], [800, this.musicMx[page].length * 100]) const musicbox = makeBox([100, 200], [1048, this.musicMx[page].length * 100])
const beforebox = makeBox([310, 1720], [100, 100]) const beforebox = makeBox([120, 1720], [100, 100])
const afterbox = makeBox([700, 1720], [100, 100]) const afterbox = makeBox([780, 1720], [100, 100])
const playbox = makeBox([480, 1680], [160, 160]) const playbox = makeBox([420, 1680], [200, 200])
const typebox = makeBox([830, 1710], [150, 150]) const typebox = makeBox([1040, 1700], [120, 120])
const changebox = makeBox([-100 + pcx, pcy + 590], [1000, 20]) const changebox = makeBox([100, 1590], [1048, 20])
const volumebox = makeBox([890 + 250, 200], [20, 500]) const volumebox = makeBox([250, 1940], [1050, 20])
if (inRect(pos, pageupbox)) { if (inRect(pos, pageupbox)) {
if (page !== 0) page -= 1 if (page !== 0) page -= 1
return; return;
@ -14416,6 +14433,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else { } else {
this.selection[1] -= 1 this.selection[1] -= 1
} }
this.randomList.indexOf(this.musicMx[this.selection[0]][this.selection[1]])
page = this.selection[0] page = this.selection[0]
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
@ -14423,8 +14441,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.stop = false this.stop = false
break; break;
case 'suiji': case 'suiji':
this.selection[0] = getRandomInt(0, this.musicMx.length) if (this.random > 0) {
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) this.random -= 1
} else {
this.random = this.randomList.length - 1
}
this.selection[0] = this.musicMx.findIndex(v => v.includes(this.randomList[this.random]))
this.selection[1] = this.musicMx[this.selection[0]].indexOf(this.randomList[this.random])
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
page = this.selection[0] page = this.selection[0]
@ -14454,6 +14477,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else { } else {
this.selection[1] += 1 this.selection[1] += 1
} }
this.random = this.randomList.indexOf(this.musicMx[this.selection[0]][this.selection[1]])
page = this.selection[0] page = this.selection[0]
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
@ -14461,8 +14485,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.stop = false this.stop = false
break; break;
case 'suiji': case 'suiji':
this.selection[0] = getRandomInt(0, this.musicMx.length) if (this.random < this.randomList.length - 1) {
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) this.random += 1
} else {
this.random = 0
}
this.selection[0] = this.musicMx.findIndex(v => v.includes(this.randomList[this.random]))
this.selection[1] = this.musicMx[this.selection[0]].indexOf(this.randomList[this.random])
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
page = this.selection[0] page = this.selection[0]
@ -14487,11 +14516,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return; return;
} }
if (inRect(pos, musicbox)) { if (inRect(pos, musicbox)) {
pcy = -800
const index = Math.floor((py - 1000 - pcy) / 100) const index = Math.floor((py - 200) / 100)
if (page !== this.selection[0] || index !== this.selection[1]) { if (page !== this.selection[0] || index !== this.selection[1]) {
this.selection[0] = page this.selection[0] = page
this.selection[1] = index this.selection[1] = index
this.randomList.indexOf(this.musicMx[this.selection[0]][this.selection[1]])
audio.src = "project/bgms/" + this.musicMx[page][index] audio.src = "project/bgms/" + this.musicMx[page][index]
if (!this.stop) audio.play() if (!this.stop) audio.play()
@ -14518,7 +14548,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ischange = true ischange = true
} }
if (inRect(pos, volumebox)) { if (inRect(pos, volumebox)) {
const time = (700 - py) / 500 const time = Math.min(Math.max((px - 250) / 800, 0), 1)
audio.volume = time audio.volume = time
isvolume = true isvolume = true
} }
@ -14572,6 +14602,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else { } else {
this.selection[1] -= 1 this.selection[1] -= 1
} }
this.indexOf(this.musicMx[this.selection[0]][this.selection[1]])
page = this.selection[0] page = this.selection[0]
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
@ -14579,8 +14610,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.stop = false this.stop = false
break; break;
case 'suiji': case 'suiji':
this.selection[0] = getRandomInt(0, this.musicMx.length) if (this.random > 0) {
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) this.random -= 1
} else {
this.random = this.randomList.length - 1
}
this.selection[0] = this.musicMx.findIndex(v => v.includes(this.randomList[this.random]))
this.selection[1] = this.musicMx[this.selection[0]].indexOf(this.randomList[this.random])
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
page = this.selection[0] page = this.selection[0]
@ -14610,6 +14646,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} else { } else {
this.selection[1] += 1 this.selection[1] += 1
} }
this.randomList.findIndex(v => v === this.musicMx[this.selection[0]][this.selection[1]])
page = this.selection[0] page = this.selection[0]
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
@ -14617,8 +14654,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.stop = false this.stop = false
break; break;
case 'suiji': case 'suiji':
this.selection[0] = getRandomInt(0, this.musicMx.length) if (this.random < this.randomList.length - 1) {
this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) this.random += 1
} else {
this.random = 0
}
this.selection[0] = this.musicMx.findIndex(v => v.includes(this.randomList[this.random]))
this.selection[1] = this.musicMx[this.selection[0]].indexOf(main.core.ui.music.randomList[main.core.ui.music.random])
audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]]
page = this.selection[0] page = this.selection[0]
@ -14643,10 +14685,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return; return;
} }
if (inRect(pos, musicbox)) { if (inRect(pos, musicbox)) {
const index = Math.floor((py - 100) / 100) const index = Math.floor((py - 100) / 100)
if (page !== this.selection[0] || index !== this.selection[1]) { if (page !== this.selection[0] || index !== this.selection[1]) {
this.selection[0] = page this.selection[0] = page
this.selection[1] = index this.selection[1] = index
this.randomList.indexOf(v => v === this.musicMx[this.selection[0]][this.selection[1]])
audio.src = "project/bgms/" + this.musicMx[page][index] audio.src = "project/bgms/" + this.musicMx[page][index]
if (!this.stop) audio.play() if (!this.stop) audio.play()
@ -14673,7 +14717,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ischange = true ischange = true
} }
if (inRect(pos, volumebox)) { if (inRect(pos, volumebox)) {
const time = (px - 100) / 600 const time = Math.min(Math.max((px - 100) / 600, 0), 1)
audio.volume = time audio.volume = time
isvolume = true isvolume = true
} }
@ -14683,7 +14727,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (ischange) { if (ischange) {
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
const time = Math.min(Math.max(Math.floor((px - 100) / 1000 * audio.duration), 0), audio.duration) const time = Math.min(Math.max(Math.floor((px - 100) / 600 * audio.duration), 0), audio.duration)
audio.currentTime = time audio.currentTime = time
} else { } else {
@ -14695,7 +14739,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
if (isvolume) { if (isvolume) {
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
const time = Math.min(Math.max((700 - py) / 500, 0), 1) const time = Math.min(Math.max((px - 250) / 800, 0), 1)
audio.volume = time audio.volume = time
} else { } else {
const time = Math.min(Math.max((px - 100) / 600, 0), 1) const time = Math.min(Math.max((px - 100) / 600, 0), 1)
@ -14714,7 +14758,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
//竖屏 //竖屏
core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景
ctx.globalAlpha = 0.5; //透明度 ctx.globalAlpha = 0.3; //透明度
if (bgVertical) if (bgVertical)
ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片
ctx.globalAlpha = 1; //恢复为不透明 ctx.globalAlpha = 1; //恢复为不透明
@ -14730,18 +14774,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
6, 6,
core.ui._buildFont(66, true) core.ui._buildFont(66, true)
); );
//core.fillRect(ctx, 440, 760, 50, 50)
pcx = 0
pcy = -800
ctx.strokeStyle = "#FFFFFF" ctx.strokeStyle = "#FFFFFF"
ctx.lineWidth = 3 ctx.lineWidth = 3
ctx.beginPath() ctx.beginPath()
ctx.moveTo(50 + pcx, pcy + 1000) ctx.moveTo(100, 200)
ctx.lineTo(50 + pcx, pcy + 1900) ctx.lineTo(1148, 200)
ctx.moveTo(1000 + pcx, pcy + 1000)
ctx.lineTo(1000 + pcx, pcy + 1900)
ctx.stroke() ctx.stroke()
let posy = 1100 let posy = 300
const indexList = this.musicMx[page] const indexList = this.musicMx[page]
core.setTextAlign(ctx, "left"); core.setTextAlign(ctx, "left");
for (let i = 0; i < indexList.length; i++) { for (let i = 0; i < indexList.length; i++) {
@ -14749,7 +14791,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
text, text,
100 + pcx, pcy + 150,
posy - 30, posy - 30,
page === this.selection[0] && i === this.selection[1] ? "#FFFFFF" : "#444444", page === this.selection[0] && i === this.selection[1] ? "#FFFFFF" : "#444444",
"#000000", "#000000",
@ -14759,18 +14801,23 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.strokeStyle = "#FFFFFF" ctx.strokeStyle = "#FFFFFF"
ctx.lineWidth = 3 ctx.lineWidth = 3
ctx.beginPath() ctx.beginPath()
ctx.moveTo(100 + pcx, pcy + posy) ctx.moveTo(100, posy)
ctx.lineTo(900 + pcx, pcy + posy) ctx.lineTo(1148, posy)
ctx.stroke() ctx.stroke()
posy += 100 posy += 100
} }
ctx.beginPath()
ctx.moveTo(100, 1210)
ctx.lineTo(1148, 1210)
ctx.moveTo(100, 1200)
ctx.lineTo(1148, 1200)
ctx.stroke()
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'上一页', '上一页',
100, 100,
1000, 1300,
page === 0 ? "#444444" : "#FFFFFF", page === 0 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -14780,8 +14827,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
(page + 1) + "/" + this.musicMx.length, (page + 1) + "/" + this.musicMx.length,
450, 580,
1000, 1300,
"#FFFFFF", "#FFFFFF",
"#000000", "#000000",
6, 6,
@ -14790,106 +14837,105 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
'下一页', '下一页',
700, 950,
1000, 1300,
page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF", page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF",
"#000000", "#000000",
6, 6,
core.ui._buildFont(66, true) core.ui._buildFont(66, true)
); );
pcx = 200
pcy = 1000
ctx.strokeStyle = "#ffffff" ctx.strokeStyle = "#ffffff"
ctx.lineWidth = 3 ctx.lineWidth = 3
ctx.beginPath() ctx.beginPath()
ctx.moveTo(-100 + pcx, pcy + 600) ctx.moveTo(100, 1600)
ctx.lineTo(900 + pcx, pcy + 600) ctx.lineTo(1148, 1600)
ctx.stroke() ctx.stroke()
ctx.fillStyle = "#ffffff" ctx.fillStyle = "#ffffff"
ctx.font = "bold 96px Verdana" ctx.font = "bold 96px Verdana"
ctx.fillText('|', 100 + pcx, pcy + 797) ctx.fillText('|', 100, 1797)
ctx.fillText('◀', 115 + pcx, pcy + 800) ctx.fillText('◀', 115, 1800)
ctx.beginPath() ctx.beginPath()
ctx.arc(355 + pcx, pcy + 770, 80, 0, 3 * Math.PI) ctx.arc(505, 1770, 80, 0, 3 * Math.PI)
ctx.stroke() ctx.stroke()
ctx.fillText('|', 555 + pcx, pcy + 797) ctx.fillText('|', 835, 1797)
ctx.fillText('▶', 505 + pcx, pcy + 800) ctx.fillText('▶', 785, 1800)
if (this.stop) { ctx.fillText('▶', 323 + pcx, pcy + 797) } else { ctx.fillText('||', 303 + pcx, pcy + 794) } if (this.stop) { ctx.fillText('▶', 473, 1797) } else { ctx.fillText('||', 453, 1794) }
const img = core.material.images.images[this.type + '.webp'] const img = core.material.images.images[this.type + '.webp']
if (img) ctx.drawImage(img, 600 + pcx, pcy + 655, 200, 200) if (img) ctx.drawImage(img, 1000, 1655, 200, 200)
core.setTextAlign(ctx, "center"); core.setTextAlign(ctx, "center");
ctx.font = "bold 52px Verdana" ctx.font = "bold 52px Verdana"
ctx.fillText('当前歌曲', 400 + pcx, pcy + 297) ctx.fillText('当前歌曲', 625, 1397)
ctx.fillText(this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], 400 + pcx, pcy + 457) ctx.fillText(this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], 625, 1507)
ctx.font = "bold 36px Verdana" ctx.font = "bold 36px Verdana"
const thistime = audio.currentTime const thistime = audio.currentTime
if (thistime) { if (thistime) {
const timetext = (Math.floor(thistime / 60).toString()).padStart(2, '0') + ':' + Math.floor(thistime % 60).toString().padStart(2, '0') const timetext = (Math.floor(thistime / 60).toString()).padStart(2, '0') + ':' + Math.floor(thistime % 60).toString().padStart(2, '0')
ctx.fillText(timetext, 810 + pcx, pcy + 650) ctx.fillText(timetext, 960, 1650)
} else { } else {
const timetext = "00:00" const timetext = "00:00"
ctx.fillText(timetext, 810 + pcx, pcy + 650) ctx.fillText(timetext, 960, 1650)
} }
ctx.fillText("/", 880 + pcx, pcy + 650) ctx.fillText("/", 1030, 1650)
const fulltime = audio.duration const fulltime = audio.duration
if (fulltime) { if (fulltime) {
const timetext = Math.floor(fulltime / 60).toString().padStart(2, '0') + ':' + Math.floor(fulltime % 60).toString().padStart(2, '0') const timetext = Math.floor(fulltime / 60).toString().padStart(2, '0') + ':' + Math.floor(fulltime % 60).toString().padStart(2, '0')
ctx.fillText(timetext, 950 + pcx, pcy + 650) ctx.fillText(timetext, 1100, 1650)
} else { } else {
const timetext = "00:00" const timetext = "00:00"
ctx.fillText(timetext, 950 + pcx, pcy + 650) ctx.fillText(timetext, 1100, 1650)
} }
ctx.strokeStyle = "#ffffff" ctx.strokeStyle = "#ffffff"
ctx.lineWidth = 9 ctx.lineWidth = 9
ctx.fillStyle = 'rgba(255,255,255,0.5)' ctx.fillStyle = 'rgba(255,255,255,0.5)'
const pointx = 1000 * thistime / fulltime - 100 const pointx = 1048 * thistime / fulltime + 100
if (fulltime && thistime) { if (fulltime && thistime) {
ctx.beginPath() ctx.beginPath()
ctx.moveTo(-100 + pcx, pcy + 600) ctx.moveTo(100, 1600)
ctx.lineTo(pointx + pcx, pcy + 600) ctx.lineTo(pointx, 1600)
ctx.stroke() ctx.stroke()
ctx.beginPath() ctx.beginPath()
ctx.arc(pointx + pcx, pcy + 600, 10, 0, 2 * Math.PI) ctx.arc(pointx, 1600, 10, 0, 2 * Math.PI)
ctx.fill() ctx.fill()
} else { } else {
ctx.beginPath() ctx.beginPath()
ctx.arc(-100 + pcx, pcy + 600, 10, 0, 2 * Math.PI) ctx.arc(100, 1600, 10, 0, 2 * Math.PI)
ctx.fill() ctx.fill()
} }
pcx = 250 ctx.fillStyle = "#ffffff"
pcy = 0 ctx.font = "bold 48px Verdana"
ctx.fillText('音', 850 + pcx, pcy + 425) ctx.fillText('音量', 150, 1970)
ctx.fillText('量', 850 + pcx, pcy + 510) ctx.lineWidth = 3
ctx.beginPath() ctx.beginPath()
ctx.moveTo(900 + pcx, pcy + 200) ctx.moveTo(250, 1950)
ctx.lineTo(900 + pcx, pcy + 700) ctx.lineTo(1050, 1950)
ctx.stroke() ctx.stroke()
ctx.strokeStyle = "#ffffff" ctx.strokeStyle = "#ffffff"
ctx.lineWidth = 9 ctx.lineWidth = 9
ctx.fillStyle = 'rgba(255,255,255,0.5)' ctx.fillStyle = 'rgba(255,255,255,0.5)'
ctx.beginPath() ctx.beginPath()
ctx.moveTo(900 + pcx, pcy + 700) ctx.moveTo(250, 1950)
ctx.lineTo(900 + pcx, pcy - 500 * audio.volume + 700) ctx.lineTo(800 * audio.volume + 250, 1950)
ctx.stroke() ctx.stroke()
ctx.beginPath() ctx.beginPath()
ctx.arc(900 + pcx, pcy - 500 * audio.volume + 700, 10, 0, 2 * Math.PI) ctx.arc(800 * audio.volume + 250, 1950, 10, 0, 2 * Math.PI)
ctx.fill() ctx.fill()
core.fillBoldText1( core.fillBoldText1(
ctx, ctx,
Math.floor(100 * audio.volume), Math.floor(100 * audio.volume),
915 + pcx, 1120,
pcy + 200, 1970,
"#FFFFFF", "#FFFFFF",
"#000000", "#000000",
6, 6,
core.ui._buildFont(32, true) core.ui._buildFont(48, true)
); );
} else { } else {
@ -15070,7 +15116,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
main.core.control.checkBgm(); main.core.control.checkBgm();
main.core.control.pauseBgm(); 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]] audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]
const arr = main.core.ui.music.musicMx.flat(Infinity)
main.core.ui.music.randomList = shuffle(arr)
main.core.ui.music.random = main.core.ui.music.randomList.indexOf(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";
core.registerAnimationFrame("music", null, () => { main.core.ui.music.update() }) core.registerAnimationFrame("music", null, () => { main.core.ui.music.update() })