Compare commits

...

3 Commits

Author SHA1 Message Date
f0214b2361 Merge remote-tracking branch 'origin/status' into status
# Conflicts:
#	project/plugins.js
2025-01-11 16:16:55 +08:00
e6a9f61bb7 竖屏music 2025-01-11 16:16:10 +08:00
152282cdea 新增竖屏CG 2025-01-11 16:14:02 +08:00
2 changed files with 314 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -14417,6 +14417,159 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return;
}
if (core.domStyle.isVertical) { //竖屏
const pageupbox = makeBox([1050, 1100], [200, 100]);
const pagedownbox = makeBox([1050, 1700], [200, 100]);
const musicbox = makeBox([100, 1000], [900, 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([890, 200], [20, 500])
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 - 1000) / 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 = (700 - py) / 500
audio.volume = time
isvolume = true
}
} else { //横屏
const pageupbox = makeBox([1050, 1100], [200, 100]);
@ -14575,9 +14728,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
}
mousemove(px, py) {
if (core.domStyle.isVertical) {
} else {
if (ischange) {
const time = Math.min(Math.max(Math.floor((px - 100) / 600 * audio.duration), 0), audio.duration)
@ -14585,6 +14736,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
if (isvolume) {
if (core.domStyle.isVertical) {
const time = Math.min(Math.max((700 - py) / 500, 0), 1)
audio.volume = time
} else {
const time = Math.min(Math.max((px - 100) / 600, 0), 1)
audio.volume = time
@ -14617,6 +14772,157 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
6,
core.ui._buildFont(66, true)
);
//core.fillRect(ctx, 440, 760, 50, 50)
ctx.strokeStyle = "#FFFFFF"
ctx.lineWidth = 3
ctx.beginPath()
ctx.moveTo(50, 1000)
ctx.lineTo(50, 1900)
ctx.moveTo(1000, 1000)
ctx.lineTo(1000, 1900)
ctx.stroke()
let posy = 1100
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,
100,
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(100, posy)
ctx.lineTo(900, 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,
1050,
1500 - 30,
"#FFFFFF",
"#000000",
6,
core.ui._buildFont(66, true)
);
core.fillBoldText1(
ctx,
'下一页',
1050,
1800 - 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('音', 810, 425)
ctx.fillText('量', 810, 510)
ctx.beginPath()
ctx.moveTo(900, 200)
ctx.lineTo(900, 700)
ctx.stroke()
ctx.strokeStyle = "#ffffff"
ctx.lineWidth = 9
ctx.fillStyle = 'rgba(255,255,255,0.5)'
ctx.beginPath()
ctx.moveTo(900, 700)
ctx.lineTo(900, -500 * audio.volume + 700)
ctx.stroke()
ctx.beginPath()
ctx.arc(900, -500 * audio.volume + 700, 10, 0, 2 * Math.PI)
ctx.fill()
core.fillBoldText1(
ctx,
Math.floor(100 * audio.volume),
915,
200,
"#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()
}
} else {
//横屏