diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index c6fa757..e99129e 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -2647,7 +2647,7 @@ return code; */; setmusics_s - : '音乐鉴赏music 文件名'EvalString?'不填为清空cg获取记录' Newline + : '音乐鉴赏music 文件名'EvalString?'不填为清空music获取记录' Newline /* setmusics_s tooltip : setmusics:音乐鉴赏中的隐藏music获取 diff --git a/project/plugins.js b/project/plugins.js index 5ca7dd6..63c7a55 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -16444,6 +16444,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = class musicclass { constructor() { + this.musics = ["theme.opus"] //music列表 //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 this.musicMx = [ @@ -16558,24 +16559,26 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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; + for (;;) { + 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[0] -= 1; - this.selection[1] = - this.musicMx[this.selection[0]].length - 1; + this.selection[1] -= 1; } - } else { - this.selection[1] -= 1; + this.random = this.randomList.indexOf( + this.musicMx[this.selection[0]][this.selection[1]] + ); + page = this.selection[0]; + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break } - this.randomList.indexOf( - this.musicMx[this.selection[0]][this.selection[1]] - ); - page = this.selection[0]; - core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1] @@ -16584,20 +16587,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = break; case "suiji": - if (this.random > 0) { - this.random -= 1; - } else { - this.random = this.randomList.length - 1; + for (;;) { + if (this.random > 0) { + 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] + ); + + page = this.selection[0]; + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break } - 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] - ); - - page = this.selection[0]; - core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1] @@ -16621,25 +16626,27 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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; + for (;;) { + 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[0] += 1; - this.selection[1] = 0; + this.selection[1] += 1; } - } else { - this.selection[1] += 1; + this.random = this.randomList.indexOf( + this.musicMx[this.selection[0]][this.selection[1]] + ); + page = this.selection[0]; + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break } - this.random = this.randomList.indexOf( - this.musicMx[this.selection[0]][this.selection[1]] - ); - page = this.selection[0]; - core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1] @@ -16648,19 +16655,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = break; case "suiji": - if (this.random < this.randomList.length - 1) { - 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] - ); + for (;;) { + if (this.random < this.randomList.length - 1) { + 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] + ); - page = this.selection[0]; + page = this.selection[0]; + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break + } core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1] @@ -16688,19 +16698,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (inRect(pos, musicbox)) { const index = Math.floor((py - 200) / 100); if (page !== this.selection[0] || index !== this.selection[1]) { - this.selection[0] = page; - this.selection[1] = index; - this.randomList.indexOf( - this.musicMx[this.selection[0]][this.selection[1]] - ); + if (this.musics.includes(this.musicMx[page][index]) || page !== this.musicMx.length - 1) { + this.selection[0] = page; - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); + this.selection[1] = index; + this.randomList.indexOf( + this.musicMx[this.selection[0]][this.selection[1]] + ); - this.stop = false; + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + + this.stop = false; + } } else { if (this.stop) { this.stop = !this.stop; @@ -16755,64 +16768,68 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.stop = false; switch (this.type) { case "danqu": - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); + + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); 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; + for (;;) { + 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[0] -= 1; - this.selection[1] = - this.musicMx[this.selection[0]].length - 1; + this.selection[1] -= 1; } - } else { - this.selection[1] -= 1; - } - this.random = this.randomList.indexOf( - this.musicMx[this.selection[0]][this.selection[1]] - ); - page = this.selection[0]; - - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] + this.random = this.randomList.indexOf( + this.musicMx[this.selection[0]][this.selection[1]] ); + page = this.selection[0]; + + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); break; case "suiji": - if (this.random > 0) { - 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] - ); - - page = this.selection[0]; - - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] + for (;;) { + if (this.random > 0) { + 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] + ); + + page = this.selection[0]; + + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); break; } @@ -16822,64 +16839,68 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.stop = false; switch (this.type) { case "danqu": - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); + + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); 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; + for (;;) { + 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[0] += 1; - this.selection[1] = 0; + this.selection[1] += 1; } - } else { - this.selection[1] += 1; - } - this.randomList.findIndex( - (v) => - v === this.musicMx[this.selection[0]][this.selection[1]] - ); - page = this.selection[0]; - - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] + this.randomList.findIndex( + (v) => + v === this.musicMx[this.selection[0]][this.selection[1]] ); + page = this.selection[0]; + + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); break; case "suiji": - if (this.random < this.randomList.length - 1) { - 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] - ); - - page = this.selection[0]; - if (!this.stop) - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] + for (;;) { + if (this.random < this.randomList.length - 1) { + 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] + ); + + page = this.selection[0]; + if (this.musics.includes(this.musicMx[this.selection[0]][this.selection[1]]) || page !== this.musicMx.length - 1) break + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); break; } @@ -16902,18 +16923,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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; - this.randomList.indexOf( - (v) => v === this.musicMx[this.selection[0]][this.selection[1]] - ); + if (this.musics.includes(this.musicMx[page][index]) || page !== this.musicMx.length - 1) { + this.selection[0] = page; + this.selection[1] = index; + this.randomList.indexOf( + (v) => v === this.musicMx[this.selection[0]][this.selection[1]] + ); - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); - this.stop = false; + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + this.stop = false; + } } else { if (this.stop) { this.stop = !this.stop; @@ -16986,24 +17009,27 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.setTextAlign(ctx, "left"); for (let i = 0; i < indexList.length; i++) { const text = this.musicname[indexList[i]]; - core.fillBoldText1( - ctx, - text, - 150, - 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(1148, posy); - ctx.stroke(); + if (this.musics.includes(this.musicMx[page][i]) || page !== this.musicMx.length - 1) { + core.fillBoldText1( + ctx, + text, + 150, + 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(1148, posy); + ctx.stroke(); + } posy += 100; } ctx.beginPath(); @@ -17136,24 +17162,27 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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(); + if (this.musics.includes(this.musicMx[page][i]) || page !== this.musicMx.length - 1) { + 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( @@ -17248,7 +17277,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.music = new musicclass(); main.dom.musicMode.onclick = function () { //点击开始页面的CG MODE进入cg回廊 - + main.core.ui.music.musics = core.getLocalStorage("musics", ["theme.opus"]) core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1]