From f0ed049815e0adeacde5003e149c747e2fc347dc Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Wed, 22 Jan 2025 16:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=8F=92=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _saves/Eustia_autoSave | 2 +- _server/MotaAction.g4 | 14 +- _server/MotaActionParser.js | 14 +- _server/config.json | 2 +- project/plugins.js | 1330 ++++++++++++++++------------------- 5 files changed, 617 insertions(+), 745 deletions(-) diff --git a/_saves/Eustia_autoSave b/_saves/Eustia_autoSave index 2b31cdd..2a3d507 100644 --- a/_saves/Eustia_autoSave +++ b/_saves/Eustia_autoSave @@ -1 +1 @@ -N4IgZgNg9lBOCSATEAuEBnALrApjzADAIwgA0IAFjrFKqAJYC2AhgOY6qXVQB0A7jgBGABzIhmAOybNMHFGGYR0OchOaM5IAMLMmYiADdURchWEsAHqgBMBO6dEoidguRZrLN1yHfNU3mQBrL3JEHDAQnzCIlFs3KAkcAE9/chwLR28cAEcAV3pzHAlMVABtAF1yellGdDoQAGMErElMOpRQQRhgp3JIFKcAX3JMGCU6YZAc/OF20HQ+OEQSIcnoBvrEelwGzHoEzlzRcisUAFZyAedJyDY5kGqcRgARfF0IVGxclRBc5QAhfACIoAGXorAoJRQXx+AH1YcocIh4cYACxEVEADgIAGYAGyYkwgeGwSTI2FojHY/GE8jMXDMdqlUAeTQAHVyqJwBEEHLODVR1jELFmZW0ukYFCgGhA5WGLPU7M53N5uX5guFzFFKFKIAAVvRcqxcpJZfKQKzOByuTy+QKhW4tUyQABpAAqADUzaQFTK0ByAOzWPHWQPWMAkR3a3Xuj0AMSFcp9FsVVtyQZDYYjmujIFYUAgiECyW9vqVNtV6odPidYsE9Aof1ytCTZbTNuYdo1UedBuYUEwklYpZTfpA1u5nbV9pzzvQVAkrAkBilMtbo/Lk671ZFc4o9GXq4468t/vTwdD5+zPbFBqR/ZHp/H58zV8jNdzWFw+GIYi/eEIatjSHBoKCHMRgMXUCh2rCx6H7OCh1/E54KgRDFwIWDUPQ1gcUfVMUAkXIIAgG8dRAJJ6DyEgTwIoiSLI3VKLyRNzVPejSI/Z1mNyPDaL9DjGIoqjOXwgTiM43cxR4s4xLkQSuOkkS8Tk1AFKk8ieIDVTCIkoSeMxHT1NrTSRIATiMvTFNM6iCDNSoMECApUAUJQfjA2BkBQbx4Q8xAtALOAUTQXBkHIeFHkYAAJA9MGCipwthCAcGYAwcBBKAGmC4BJnhAx6HQR5yXqf8fxWGFJkEIE8AkABBTBBwaQJnhkPxdIY4lYWYHB6Hihz4S2dBmEEZLio6DBsAA38dVKIgcTOSoKjlG4C2gARYCZBysBwbUiRYTAem8dBhDwLy4gm2BjACVh6CuqpijuxoDicbwWBujZ5EUZRyBaPYsHoBp7lGQcIDdJg5Dm6wzOsM5MQDMyeDMsy8TxIgzKIC5GlyWBYDBv0MdRBGzJcEmScxsxUhAQQZEwZLKcYBIS28tIMkp6mGuSlq3rkbxhCgAqEi5tgeZZ7BmCF9h6agNLnm2HBdggAZvHBCQ4BwABlWRtSOwdYChaG8TOHg8UGSY/M4WcSsmsr6hFMpZucIhrBMIhHesaxSFsOxUVcL33YuL25sxT27HdgMQ8w6xg79mGI5h33Q+scOY+jlxUTxUg5rsYnFtd4hrFRUgE+91PMJxHEI4xDO/fmuP8Triu/bOYvrFrlOI4IM5C6zggzMxXO3cL4vO+ruwMcbseu8rs4A9D1FC79oNp4X0OA1HyPS877ucTsPECAH/Oh7jpfA9RyuQ3PifMLX8/S6IAMTEDpfXADXEk8zneCAJA+naP0+77xGZSur9gGPzHifFw2IO60i9gQTEGcX64lrnnV2qIf4FyLsA9e99k7gLvvDUgD8AzwNIMTL+hcyF4gobvI+lDu5uwWqQB2h9MGwMxJvTEQDYEEBXi4WeLgM5ELMhcVwojMEoJhj/IgwcUHSI7sjTOjsiAZzzphMRsCMSYLEWIiRjDSjQy0YolhCcTA6IYUYp2HsJFWLdjY/O1hFraIsXI2Rqc7GuxkUozx9jDGuDMmgphWd75OJfqY3x4T96BJ3vfYOISImGKCQSD+xBAG5x3v7ZJyigGJOydEwBmT8lBJAdYix7sCkyLybklJVT3bb2IAGAM5RlrkBoLkWQnAXRQATFoVErAAC8YgDCKG+HMSYaUNr7AkGmMyOAcSID5IIZugZmBmXmbkYmtg+SYi7naAgYAOTIyIBEcgxp6BeRAHiQQXJBCIGIbCIgzBUTMFhKiMA8NYSYkQDiQQsIzjzWsOEVEiBEBgH8WIPY+MAw0kFEjchmJBhAA=== \ No newline at end of file +N4IgZgNg9lBOCSATEAuEBnALrApjzADAIwgA0IAFjrFKqAJYC2AhgOY6qXVQB0A7jgBGABzIhmAOybNMHFGGYR0OchOaM5IAMLMmYiADdURchWEsAHqgCct66dEoiBF+RZrLqALQmQ75qgE5DIA1sauIIg4YOFBflExKHHownjISW5QEjgAnoHkOBaOcTgAjgCu9OY4EpioANoAuuT0sozodCAAxllYkpgdKKCCMGFO5JB5TgC+5JgwSnSzIGWVwoOg6HxwiCQzy9BdnYj0uF2Y9Fmc5aLkVigArORTzsuQbBsgrTiMACL4uggqGw5RUIHKygAQvgBDUADL0VgUOooEFggD66OUOEQmOMAHYAGwEawADgATOSACxxTGwSS49EE4lkyk04K4ZiDeqgDyaAA65SpOAIgkFDy6VPJYhY6wa2l0jAoUA0IEas156gFQpFYvKEqlMuYcpQ9RAACt6OVWOVJGqNSA+ZxBcLReLJdK3MbuSAANIAFQAavbSJrVWhBfjyYTyZHyWASF6TWaA4GAGLS9Whx1a53lKMxuMJo3JkCsKAQRAhXIhsPa116g2evze+WCegUCHlWhZut513Md2GpM+y3MKCYSSsWs58MgF0iwf6j0ln3oKgSVgSAzK1W92f1xdD5uytcUejb3ccfdOiP56Ox+/Fkfyy048cz2/z++Fp+JlullguD4MQYhAXghDNjaU5dBQU5iNBm6wVOzYWPQ45oVOoF3OhUCYZuBCobh+GsAAzJ+uYoBI5QQBAL6miAOT0BUJA3pR1G0fRZpMRUmYOreHF0QBPo8eU5FseGglcYxzFChRkk0UJp7yqJDzyXIUnCSpsmEupqCacpDGifielUYp0miaSpkGa2RmydY1nmVpdksQQ9rNBgIRVKgChKGCcGwOktLogFiBaBWcB4mguDIOQmLfIwAASF6YFFTRxeiEA4MwBg4HCUBdFFwDLJiBj0Og3yMp04EgXsaLLIIMJ4BIACCmCTl0IS/DIARmZxICYswOD0GlHmYic6DMIIWVVUMGDYBBoGmvURCkQ8zRNOqbwVtAAiwNyHlYDgJq+H0FxYPQXSfPMk4QP6TByOSDxEEQUpRjwhJ2C91hPN05SwLA93hkQDxUtYPCkXYUNQ4SDj5CAggyJgWXw4wWQ1hkKxFPDiPtVl3UsOw8PCFA5VZATbByCUFjYMwFNE5jaO5b8pw4OcEBTHEiISHAOAAMqyCaySTrAKKElSDykTwVLTMsoWcKu1ULbVnSyg0QQa6Qmva1ruv1D4pAG0bJgG0ExuGyblsWxbzQa1t5A0OUsicL6UAZloVKsAAvGIBiKKCGzLLl+2XBIebWDgpGIOKggPAQkbMNY0flNYhHx/qpKg+6BBgIK1iEkQMTkDa9DpCA5LMIghKEog1iFYgYBgFS6JUqSifooIVKEmA6JgIgU0EDgNJV3gYgXMD+KkficfWKRBBSi40xAA== \ No newline at end of file diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index b313060..10b3ad5 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -2243,12 +2243,12 @@ setanimate_s tooltip : setanimate:设置帧动画/特效(此项仅储存,不播放) helpUrl : /_docs/#/instruction default : ["sword","","",192,192,60] -colour : this.soundColor +colour : this.imageColor IntString_0 = IntString_0 ? (', "px": '+IntString_0+'') : ''; IntString_1 = IntString_1 ? (', "py": '+IntString_1+'') : ''; var imageList=animateDrawableimage_0?',"imageList": [\n'+animateDrawableimage_0.slice(0,-1)+'\n]':'' var soundList=animateDrawablesound_0?',"soundList": [\n'+animateDrawablesound_0.slice(0,-1)+'\n]':'' -var code = '{"type": "setanimate", "name": "'+EvalString_0+'",'+IntString_0+IntString_1+' "width": '+IntString_2+', "height": '+IntString_3+', "allFarme": '+IntString_4+imageList+soundList+'},\n'; +var code = '{"type": "setanimate", "name": "'+EvalString_0+'"'+IntString_0+IntString_1+' ,"width": '+IntString_2+', "height": '+IntString_3+', "allFarme": '+IntString_4+imageList+soundList+'},\n'; return code; */; @@ -2322,9 +2322,9 @@ deleteanimate_s /* deleteanimate_s tooltip : deleteanimate:删除储存的帧动画 helpUrl : /_docs/#/instruction -default : [""] +default : ["zone"] -colour : this.soundColor +colour : this.imageColor var code = '{"type": "deleteanimate", "name": "'+EvalString_0+'"},\n'; return code; @@ -2338,7 +2338,7 @@ tooltip : playanimate:播放帧动画,选择跟随勇士后x、y将失效改 helpUrl : /_docs/#/instruction default : ["zone","","",false,"",""] -colour : this.soundColor +colour : this.imageColor IntString_0 = IntString_0 ? (', "x": '+IntString_0+'') : ''; IntString_1 = IntString_1 ? (', "y": '+IntString_1+'') : ''; if(EvalString_1&&!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_1))throw new Error("此项仅能填写小数、整数或不填"); @@ -2356,7 +2356,7 @@ clearanimate_s tooltip : clearanimate:清空正在播放的帧动画 helpUrl : /_docs/#/instruction -colour : this.soundColor +colour : this.imageColor var code = '{"type": "clearanimate"},\n'; return code; @@ -2404,7 +2404,7 @@ stopAnimate_s tooltip : stopAnimate:停止所有动画 helpUrl : /_docs/#/instruction default : [false] -colour : this.soundColor +colour : this.imageColor Bool_0 = Bool_0?', "doCallback": true':''; var code = '{"type": "stopAnimate"'+Bool_0+'},\n'; return code; diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index 829580d..06c2081 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -777,18 +777,18 @@ MotaActionParser = function () { break; case "deleteanimate": this.next = MotaActionBlocks["deleteanimate_s"].xmlText([ - this.name, + data.name, this.next, ]); break; case "playanimate": this.next = MotaActionBlocks["playanimate_s"].xmlText([ - this.name, - this.x, - this.y, - this.hero, - this.scalex, - this.scaley, + data.name, + data.x, + data.y, + data.hero, + data.scalex, + data.scaley, this.next, ]); break; diff --git a/_server/config.json b/_server/config.json index e97cbbe..bdcb574 100644 --- a/_server/config.json +++ b/_server/config.json @@ -1 +1 @@ -{"viewportLoc":[0,0],"editorLastFloorId":"KTV"} \ No newline at end of file +{"viewportLoc":[0,0],"editorLastFloorId":"jiedao"} \ No newline at end of file diff --git a/project/plugins.js b/project/plugins.js index 71dde29..009ae14 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -8467,7 +8467,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const { Transition, linear } = core.plugin.animate; const audio = new Audio(); - + const AudioStatus = { + Playing: 0, + Pausing: 1, + Paused: 2, + Stoping: 3, + Stoped: 4, + }; const supportMap = new Map(); const AudioType = { Mp3: "audio/mpeg", @@ -8698,6 +8704,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = class EchoEffect extends AudioEffect { constructor(ac) { super(ac); + /** 当前增益 */ + this.gain = 0.5; + /** 是否正在播放 */ + this.playing = false; const delay = ac.createDelay(); const gain = ac.createGain(); gain.gain.value = 0.5; @@ -8708,10 +8718,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.delay = delay; /** 反馈增益节点 */ this.gainNode = gain; - /** 当前增益 */ - this.gain = 0.5; - /** 是否正在播放 */ - this.playing = false; + this.input = gain; this.output = gain; } @@ -8840,7 +8847,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const fileSignatures = [ [AudioType.Mp3, [0x49, 0x44, 0x33]], [AudioType.Ogg, [0x4f, 0x67, 0x67, 0x53]], - [AudioType.Wav, [52, 0x49, 0x46, 0x46]], + [AudioType.Wav, [0x52, 0x49, 0x46, 0x46]], [AudioType.Flac, [0x66, 0x4c, 0x61, 0x43]], [AudioType.Aac, [0xff, 0xf1]], [AudioType.Aac, [0xff, 0xf9]], @@ -8874,7 +8881,147 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return audioType; } + class AudioDecoder { + /** + * 注册一个解码器 + * @param type 要注册的解码器允许解码的类型 + * @param decoder 解码器对象 + */ + static registerDecoder(type, decoder) { + if (!this.decoderMap) this.decoderMap = new Map(); + if (this.decoderMap.has(type)) { + console.warn( + "Audio stream decoder for audio type '" + + type + + "' has already existed." + ); + return; + } + this.decoderMap.set(type, decoder); + } + + /** + * 解码音频数据 + * @param data 音频文件数据 + * @param player AudioPlayer实例 + */ + static async decodeAudioData(data, player) { + // 检查头文件获取音频类型,仅检查前256个字节 + const toCheck = data.slice(0, 256); + const type = checkAudioType(data); + if (type === "") { + console.error( + "Unknown audio type. Header: '" + [...toCheck] + .map((v) => v.toString().padStart(2, "0")) + .join(" ") + .toUpperCase() + + "'" + ); + return null; + } + if (isAudioSupport(type)) { + if (data.buffer instanceof ArrayBuffer) { + return player.ac.decodeAudioData(data.buffer); + } else { + return null; + } + } else { + const Decoder = this.decoderMap.get(type); + if (!Decoder) { + return null; + } else { + const decoder = new Decoder(); + await decoder.create(); + const decodedData = await decoder.decode(data); + if (!decodedData) return null; + const buffer = player.ac.createBuffer( + decodedData.channelData.length, + decodedData.channelData[0].length, + decodedData.sampleRate + ); + decodedData.channelData.forEach((v, i) => { + buffer.copyToChannel(v, i); + }); + decoder.destroy(); + return buffer; + } + } + } + } + + class VorbisDecoder { + /** + * 创建音频解码器 + */ + async create() { + this.decoder = new OggVorbisDecoderWebWorker(); + await this.decoder.ready; + } + /** + * 摧毁这个解码器 + */ + destroy() { + this.decoder?.free(); + } + /** + * 解码流数据 + * @param data 流数据 + */ + + async decode(data) { + return this.decoder?.decode(data); + } + /** + * 解码整个文件 + * @param data 文件数据 + */ + async decodeAll(data) { + return this.decoder?.decodeFile(data); + } + /** + * 当音频解码完成后,会调用此函数,需要返回之前还未解析或未返回的音频数据。调用后,该解码器将不会被再次使用 + */ + async flush() { + return this.decoder?.flush(); + } + } + + class OpusDecoder { + /** + * 创建音频解码器 + */ + async create() { + this.decoder = new OggOpusDecoderWebWorker(); + await this.decoder.ready; + } + /** + * 摧毁这个解码器 + */ + destroy() { + this.decoder?.free(); + } + /** + * 解码流数据 + * @param data 流数据 + */ + async decode(data) { + return this.decoder?.decode(data); + } + /** + * 解码整个文件 + * @param data 文件数据 + */ + async decodeAll(data) { + return this.decoder?.decodeFile(data); + } + /** + * 当音频解码完成后,会调用此函数,需要返回之前还未解析或未返回的音频数据。调用后,该解码器将不会被再次使用 + */ + async flush() { + return await this.decoder?.flush(); + } + } const mimeTypeMap = { [AudioType.Aac]: "audio/aac", [AudioType.Flac]: "audio/flac", @@ -8892,7 +9039,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.output = context.createBufferSource(); /** 是否已经完全加载完毕 */ this.loaded = false; - + /** 是否正在播放 */ + this.playing = false; /** 已经缓冲了多长时间,如果缓冲完那么跟歌曲时长一致 */ this.buffered = 0; /** 已经缓冲的采样点数量 */ @@ -8936,7 +9084,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (this.controller?.loading || this.loaded) return; this.bufferChunkSize = size; } - + on(event, fn, context) {} piped(controller) { this.controller = controller; } @@ -8950,7 +9098,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (!this.audioType) { console.error( "Unknown audio type. Header: '" + [...toCheck] - .map((v) => v.toString().padStart(2, "0")) + .map((v) => v.toString(16).padStart(2, "0")) .join(" ") .toUpperCase() + "'" @@ -9183,14 +9331,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (!this.buffer) return; this.lastStartTime = this.ac.currentTime; if (this.playing) this.output.stop(); - + if (this.player.status !== AudioStatus.Playing) { + this.player.status = AudioStatus.Playing; + } this.createSourceNode(this.buffer); this.output.start(0, when); this.playing = true; this.output.addEventListener("ended", () => { this.playing = false; - + if (this.player.status === AudioStatus.Playing) { + this.player.status = AudioStatus.Stoped; + } if (this.loop && !this.output.loop) this.play(0); }); } @@ -9247,13 +9399,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = audio.preload = "none"; this.output = context.createMediaElementSource(audio); this.audio = audio; + this.ac = context; audio.addEventListener("play", () => { this.playing = true; - + if (this.player.status !== AudioStatus.Playing) { + this.player.status = AudioStatus.Playing; + } }); audio.addEventListener("ended", () => { this.playing = false; - this.ac = context; + if (this.player.status === AudioStatus.Playing) { + this.player.status = AudioStatus.Stoped; + } }); } get duration() { @@ -9279,7 +9436,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = stop() { this.audio.pause(); this.playing = false; - + if (this.player.status === AudioStatus.Playing) { + this.player.status = AudioStatus.Stoped; + } return this.audio.currentTime; } @@ -9324,11 +9483,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (this.playing || !this.buffer) return; this.playing = true; this.lastStartTime = this.ac.currentTime; - + if (this.player.status !== AudioStatus.Playing) { + this.player.status = AudioStatus.Playing; + } this.createSourceNode(this.buffer); this.output.start(0, when); this.output.addEventListener("ended", () => { this.playing = false; + if (this.player.status === AudioStatus.Playing) { + this.player.status = AudioStatus.Stoped; + } if (this.loop && !this.output.loop) this.play(0); }); } @@ -9550,6 +9714,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); return; } + route.play(when); } @@ -9645,23 +9810,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = listener.upZ.value = z; } } - const AudioStatus = { - Playing: 0, - Pausing: 1, - Paused: 2, - Stoping: 3, - Stoped: 4, - }; - const AudioRouteEvent = { - updateEffect: [], - play: [], - stop: [], - pause: [], - resume: [], - }; class AudioRoute { constructor(source, player) { this.output = source.output; + /** 效果器路由图 */ this.effectRoute = []; @@ -9670,7 +9822,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = /** 暂停时播放了多长时间 */ this.pauseCurrentTime = 0; /** 当前播放状态 */ - this.status = AudioStatus.Stoped; + this.player = player; + this.player.status = AudioStatus.Stoped; this.shouldStop = false; /** * 每次暂停或停止时自增,用于判断当前正在处理的情况。 @@ -9680,7 +9833,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = /** 暂停时刻 */ this.pauseTime = 0; this.source = source; - this.player = player; + this.source.player = player; } /** 音频时长,单位秒 */ get duration() { @@ -9688,7 +9841,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } /** 当前播放了多长时间,单位秒 */ get currentTime() { - if (this.status === AudioStatus.Paused) { + if (this.player.status === AudioStatus.Paused) { return this.pauseCurrentTime; } else { return this.source.currentTime; @@ -9728,7 +9881,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = * @param when 从音频的什么时候开始播放,单位秒 */ play(when = 0) { - if (this.status === AudioStatus.Playing) return; + if (this.player.status === AudioStatus.Playing) return; this.link(); if (this.effectRoute.length > 0) { const first = this.effectRoute[0]; @@ -9739,18 +9892,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.source.connect({ input: this.player.getDestination() }); } this.source.play(when); - this.status = AudioStatus.Playing; + this.player.status = AudioStatus.Playing; this.pauseTime = 0; this.audioStartHook?.(this); this.startAllEffect(); + if (this.source.player.status !== AudioStatus.Playing) { + this.source.player.status = AudioStatus.Playing; + } } /** * 暂停音频播放 */ async pause() { - if (this.status !== AudioStatus.Playing) return; - this.status = AudioStatus.Pausing; + if (this.player.status !== AudioStatus.Playing) return; + this.player.status = AudioStatus.Pausing; this.stopIdentifier++; const identifier = this.stopIdentifier; if (this.audioEndHook) { @@ -9758,7 +9914,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = await sleep(this.endTime); } if ( - this.status !== AudioStatus.Pausing || + this.player.status !== AudioStatus.Pausing || this.stopIdentifier !== identifier ) { return; @@ -9767,12 +9923,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const time = this.source.stop(); this.pauseTime = time; if (this.shouldStop) { - this.status = AudioStatus.Stoped; + this.player.status = AudioStatus.Stoped; this.endAllEffect(); this.shouldStop = false; } else { - this.status = AudioStatus.Paused; + this.player.status = AudioStatus.Paused; this.endAllEffect(); } this.endAllEffect(); @@ -9782,21 +9938,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = * 继续音频播放 */ resume() { - if (this.status === AudioStatus.Playing) return; + if (this.player.status === AudioStatus.Playing) return; if ( - this.status === AudioStatus.Pausing || - this.status === AudioStatus.Stoping + this.player.status === AudioStatus.Pausing || + this.player.status === AudioStatus.Stoping ) { this.audioStartHook?.(this); return; } - if (this.status === AudioStatus.Paused) { + if (this.player.status === AudioStatus.Paused) { this.play(this.pauseTime); } else { this.play(0); } - this.status = AudioStatus.Playing; + this.player.status = AudioStatus.Playing; this.pauseTime = 0; this.audioStartHook?.(this); this.startAllEffect(); @@ -9897,138 +10053,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const audioPlayer = new AudioPlayer(); - class AudioDecoder { - /** - * 注册一个解码器 - * @param type 要注册的解码器允许解码的类型 - * @param decoder 解码器对象 - */ - static registerDecoder(type, decoder) { - if (!this.decoderMap) this.decoderMap = new Map(); - if (this.decoderMap.has(type)) { - console.warn( - "Audio stream decoder for audio type '" + - type + - "' has already existed." - ); - return; - } - - this.decoderMap.set(type, decoder); - } - - /** - * 解码音频数据 - * @param data 音频文件数据 - * @param player AudioPlayer实例 - */ - static async decodeAudioData(data, player) { - // 检查头文件获取音频类型,仅检查前256个字节 - const toCheck = data.slice(0, 256); - const type = checkAudioType(data); - if (type === "") { - console.error( - "Unknown audio type. Header: '" + [...toCheck] - .map((v) => v.toString().padStart(2, "0")) - .join(" ") - .toUpperCase() + - "'" - ); - return null; - } - if (isAudioSupport(type)) { - if (data.buffer instanceof ArrayBuffer) { - return player.ac.decodeAudioData(data.buffer); - } else { - return null; - } - } else { - const Decoder = this.decoderMap.get(type); - if (!Decoder) { - return null; - } else { - const decoder = new Decoder(); - await decoder.create(); - const decodedData = await decoder.decode(data); - if (!decodedData) return null; - const buffer = player.ac.createBuffer( - decodedData.channelData.length, - decodedData.channelData[0].length, - decodedData.sampleRate - ); - decodedData.channelData.forEach((v, i) => { - buffer.copyToChannel(v, i); - }); - return buffer; - } - } - } - } - - class VorbisDecoder { - /** - * 创建音频解码器 - */ - async create() { - this.decoder = new OggVorbisDecoderWebWorker(); - await this.decoder.ready; - } - /** - * 摧毁这个解码器 - */ - destroy() { - this.decoder?.free(); - } - /** - * 解码流数据 - * @param data 流数据 - */ - - async decode(data) { - return this.decoder?.decode(data); - } - async decodeAll(data) { - return this.decoder?.decodeFile(data); - } - /** - * 当音频解码完成后,会调用此函数,需要返回之前还未解析或未返回的音频数据。调用后,该解码器将不会被再次使用 - */ - async flush() { - return this.decoder?.flush(); - } - } - class OpusDecoder { - /** - * 创建音频解码器 - */ - async create() { - this.decoder = new OggOpusDecoderWebWorker(); - await this.decoder.ready; - } - /** - * 摧毁这个解码器 - */ - destroy() { - this.decoder?.free(); - } - /** - * 解码流数据 - * @param data 流数据 - */ - async decode(data) { - return this.decoder?.decode(data); - } - - async decodeAll(data) { - return this.decoder?.decodeFile(data); - } - /** - * 当音频解码完成后,会调用此函数,需要返回之前还未解析或未返回的音频数据。调用后,该解码器将不会被再次使用 - */ - async flush() { - return await this.decoder?.flush(); - } - } class BgmController { constructor(player) { this.mainGain = player.createVolumeEffect(); @@ -10049,7 +10073,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.blocking = false; /** 渐变时长 */ this.transitionTime = 2000; - this._volume = 1 } /** @@ -10083,12 +10106,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = */ setVolume(volume) { this.mainGain.setVolume(volume); - this._volume = volume + this._volume = volume; } - getVolume(volume) { - return this._volume; + /** + * 获取总音量大小 + */ + getVolume() { + return this.mainGain.getVolume(); } - /** * 设置是否启用 * @param enabled 是否启用 @@ -10220,6 +10245,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (!this.enabled) return; this.player.play(this.getId(id), when); this.playing = true; + if (this.player.status !== AudioStatus.Playing) { + this.player.status = AudioStatus.Playing; + } } /** @@ -10285,6 +10313,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = setVolume(volume) { this.gain.setVolume(volume); } + /** + * 获取音量大小 + */ + getVolume() { + return this.gain.getVolume(); + } /** * 添加一个音效 * @param id 音效名称 @@ -10515,13 +10549,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "怪物碎裂特效": function () { - // 在此增加新插件 - // -------------------- 安装说明 -------------------- // - // 先安装两个在插件简介中说明的前置插件 - // 然后再将本插件复制到插件编写中即可 - // 插件自带一个打怪后显示碎裂特效的功能 - // -------------------- 使用说明 -------------------- // - /* + // 在此增加新插件 + // -------------------- 安装说明 -------------------- // + // 先安装两个在插件简介中说明的前置插件 + // 然后再将本插件复制到插件编写中即可 + // 插件自带一个打怪后显示碎裂特效的功能 + // -------------------- 使用说明 -------------------- // + /* 本插件的核心是一个名为 applyFragWith 的函数,打怪后的碎裂特效也是由它执行的。 我们来说明一下这个函数的使用方式。 @@ -10547,218 +10581,218 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = */ - if (main.replayChecking) return (core.plugin.frag = {}); + if (main.replayChecking) return (core.plugin.frag = {}); - const { Animation, linear, sleep } = core.plugin.animate; - const { has } = core.plugin.utils; + const { Animation, linear, sleep } = core.plugin.animate; + const { has } = core.plugin.utils; - /** 最大移动距离,最终位置距离中心的距离变成原来的几倍 */ - const MAX_MOVE_LENGTH = 1.15; - /** 移动距离波动,在最大移动距离的基础上加上多少倍距离的波动距离 */ - const MOVE_FLUSH = 0.7; - /** 最大旋转角,单位是弧度,每个碎片都会有自己的旋转程度,是随机的 */ - const MAX_ROTATE = 0.5; - /** 碎裂动画的速率曲线函数 */ - const FRAG_TIMING = linear(); + /** 最大移动距离,最终位置距离中心的距离变成原来的几倍 */ + const MAX_MOVE_LENGTH = 1.15; + /** 移动距离波动,在最大移动距离的基础上加上多少倍距离的波动距离 */ + const MOVE_FLUSH = 0.7; + /** 最大旋转角,单位是弧度,每个碎片都会有自己的旋转程度,是随机的 */ + const MAX_ROTATE = 0.5; + /** 碎裂动画的速率曲线函数 */ + const FRAG_TIMING = linear(); - /** - * @param {HTMLCanvasElement} canvas 要执行特效的画布 - * @param {number} length 切分成的碎片的边长,碎片为正方形 - * @param {number} time 特效持续时长 - * @returns 返回一个碎裂特效控制器,是一个对象,详见开头的使用注释 - */ - function applyFragWith(canvas, length = 4, time = 2000, config = {}) { - // 先切分图片 - const imgs = splitCanvas(canvas, length); - const cx = canvas.width / 2; - const cy = canvas.height / 2; + /** + * @param {HTMLCanvasElement} canvas 要执行特效的画布 + * @param {number} length 切分成的碎片的边长,碎片为正方形 + * @param {number} time 特效持续时长 + * @returns 返回一个碎裂特效控制器,是一个对象,详见开头的使用注释 + */ + function applyFragWith(canvas, length = 4, time = 2000, config = {}) { + // 先切分图片 + const imgs = splitCanvas(canvas, length); + const cx = canvas.width / 2; + const cy = canvas.height / 2; - let maxX = 0; - let maxY = 0; - const toMove = imgs.map((v) => { - const centerX = v.x + v.canvas.width / 2; - const centerY = v.y + v.canvas.height / 2; - const onX = centerX === cx; - const onY = centerY === cy; - const mml = config.maxMoveLength ?? MAX_MOVE_LENGTH; - const mf = config.moveFlush ?? MOVE_FLUSH; - const rate = mml - 1 + Math.random() ** 3 * mf; - let endX = onY ? 0 : (centerX - cx) * rate; - let endY = onX ? 0 : (centerY - cy) * rate; - const mx = Math.abs(endX + centerX) + Math.abs(v.canvas.width); - const my = Math.abs(endY + centerY) + Math.abs(v.canvas.height); - if (mx > maxX) maxX = mx; - if (my > maxY) maxY = my; - const r = config.maxRotate ?? MAX_ROTATE; - const endRad = Math.random() * r * 2 - r; + let maxX = 0; + let maxY = 0; + const toMove = imgs.map((v) => { + const centerX = v.x + v.canvas.width / 2; + const centerY = v.y + v.canvas.height / 2; + const onX = centerX === cx; + const onY = centerY === cy; + const mml = config.maxMoveLength ?? MAX_MOVE_LENGTH; + const mf = config.moveFlush ?? MOVE_FLUSH; + const rate = mml - 1 + Math.random() ** 3 * mf; + let endX = onY ? 0 : (centerX - cx) * rate; + let endY = onX ? 0 : (centerY - cy) * rate; + const mx = Math.abs(endX + centerX) + Math.abs(v.canvas.width); + const my = Math.abs(endY + centerY) + Math.abs(v.canvas.height); + if (mx > maxX) maxX = mx; + if (my > maxY) maxY = my; + const r = config.maxRotate ?? MAX_ROTATE; + const endRad = Math.random() * r * 2 - r; - return { - deltaX: endX, - deltaY: endY, - endRad, - x: centerX, - y: centerY, - canvas: v.canvas, - }; - }); + return { + deltaX: endX, + deltaY: endY, + endRad, + x: centerX, + y: centerY, + canvas: v.canvas, + }; + }); - // 再执行动画 - const frag = document.createElement("canvas"); - const ctx = frag.getContext("2d"); - const ani = new Animation(); - ani.register("rate", 0); - const ft = config.fragTiming ?? FRAG_TIMING; - ani.absolute().time(time).mode(ft).apply("rate", 1); - frag.width = maxX * 2; - frag.height = maxY * 2; - ctx.save(); - const dw = maxX - canvas.width / 2; - const dh = maxY - canvas.height / 2; + // 再执行动画 + const frag = document.createElement("canvas"); + const ctx = frag.getContext("2d"); + const ani = new Animation(); + ani.register("rate", 0); + const ft = config.fragTiming ?? FRAG_TIMING; + ani.absolute().time(time).mode(ft).apply("rate", 1); + frag.width = maxX * 2; + frag.height = maxY * 2; + ctx.save(); + const dw = maxX - canvas.width / 2; + const dh = maxY - canvas.height / 2; - const fragFn = () => { - const rate = ani.value.rate; - const opacity = 1 - rate; - ctx.globalAlpha = opacity; - ctx.clearRect(0, 0, frag.width, frag.height); - toMove.forEach((v) => { - ctx.save(); - const nx = v.deltaX * rate; - const ny = v.deltaY * rate; - const rotate = v.endRad * rate; + const fragFn = () => { + const rate = ani.value.rate; + const opacity = 1 - rate; + ctx.globalAlpha = opacity; + ctx.clearRect(0, 0, frag.width, frag.height); + toMove.forEach((v) => { + ctx.save(); + const nx = v.deltaX * rate; + const ny = v.deltaY * rate; + const rotate = v.endRad * rate; - ctx.translate(nx + v.x + dw, ny + v.y + dh); - ctx.rotate(rotate); - ctx.drawImage( - v.canvas, - nx - v.canvas.width / 2, - ny - v.canvas.height / 2 - ); - ctx.restore(); - }); - }; - const onEnd = () => {}; - ani.ticker.add(fragFn); + ctx.translate(nx + v.x + dw, ny + v.y + dh); + ctx.rotate(rotate); + ctx.drawImage( + v.canvas, + nx - v.canvas.width / 2, + ny - v.canvas.height / 2 + ); + ctx.restore(); + }); + }; + const onEnd = () => {}; + ani.ticker.add(fragFn); - return makeFragManager(frag, ani, time, onEnd); - } + return makeFragManager(frag, ani, time, onEnd); + } - function makeFragManager(canvas, ani, time, onEnd) { - const promise = sleep(time + 50); + function makeFragManager(canvas, ani, time, onEnd) { + const promise = sleep(time + 50); - return { - animation: ani, + return { + animation: ani, - onEnd: promise.then(() => { - ani.ticker.destroy(); - onEnd(); - }), - canvas, - }; - } + onEnd: promise.then(() => { + ani.ticker.destroy(); + onEnd(); + }), + canvas, + }; + } - function withImage(image, sx, sy, sw, sh) { - const canvas = document.createElement("canvas"); - const ctx = canvas.getContext("2d"); - canvas.width = sw; - canvas.height = sh; - ctx.drawImage(image, sx, sy, sw, sh, 0, 0, sw, sh); - return { canvas, x: sx, y: sy }; - } + function withImage(image, sx, sy, sw, sh) { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + canvas.width = sw; + canvas.height = sh; + ctx.drawImage(image, sx, sy, sw, sh, 0, 0, sw, sh); + return { canvas, x: sx, y: sy }; + } - /** - * 切分画布 - * @param canvas 要被切分的画布 - * @param l 切分小块的边长 - */ - function splitCanvas(canvas, l) { - if (canvas.width / l < 2 || canvas.height / l < 2) { - console.warn("切分画布要求切分边长大于等于画布长宽的一半!"); - return []; - } - const w = canvas.width; - const h = canvas.height; - const numX = Math.floor(w / l); - const numY = Math.floor(h / l); - const rw = (w - numX * l) / 2; - const rh = (h - numY * l) / 2; + /** + * 切分画布 + * @param canvas 要被切分的画布 + * @param l 切分小块的边长 + */ + function splitCanvas(canvas, l) { + if (canvas.width / l < 2 || canvas.height / l < 2) { + console.warn("切分画布要求切分边长大于等于画布长宽的一半!"); + return []; + } + const w = canvas.width; + const h = canvas.height; + const numX = Math.floor(w / l); + const numY = Math.floor(h / l); + const rw = (w - numX * l) / 2; + const rh = (h - numY * l) / 2; - const res = []; + const res = []; - if (rw > 0) { - if (rh > 0) { - res.push( - withImage(canvas, 0, 0, rw, rh), - withImage(canvas, 0, canvas.height - rh, rw, rh), - withImage(canvas, canvas.width - rw, 0, rw, rh), - withImage(canvas, canvas.width - rw, canvas.height - rh, rw, rh) - ); - } - for (const x of [0, canvas.width - rw]) { - for (let ny = 0; ny < numY; ny++) { - res.push(withImage(canvas, x, rh + l * ny, rw, l)); - } - } - } - if (rh > 0) { - for (const y of [0, canvas.height - rh]) { - for (let nx = 0; nx < numX; nx++) { - res.push(withImage(canvas, rw + l * nx, y, l, rh)); - } - } - } - for (let nx = 0; nx < numX; nx++) { - for (let ny = 0; ny < numY; ny++) { - res.push(withImage(canvas, rw + l * nx, rh + l * ny, l, l)); - } - } + if (rw > 0) { + if (rh > 0) { + res.push( + withImage(canvas, 0, 0, rw, rh), + withImage(canvas, 0, canvas.height - rh, rw, rh), + withImage(canvas, canvas.width - rw, 0, rw, rh), + withImage(canvas, canvas.width - rw, canvas.height - rh, rw, rh) + ); + } + for (const x of [0, canvas.width - rw]) { + for (let ny = 0; ny < numY; ny++) { + res.push(withImage(canvas, x, rh + l * ny, rw, l)); + } + } + } + if (rh > 0) { + for (const y of [0, canvas.height - rh]) { + for (let nx = 0; nx < numX; nx++) { + res.push(withImage(canvas, rw + l * nx, y, l, rh)); + } + } + } + for (let nx = 0; nx < numX; nx++) { + for (let ny = 0; ny < numY; ny++) { + res.push(withImage(canvas, rw + l * nx, rh + l * ny, l, l)); + } + } - return res; - } + return res; + } - const origin = core.events.afterBattle; - core.events.afterBattle = function (enemyId, x, y) { - // 打怪特效 - if (has(x) && has(y)) { - const frame = core.status.globalAnimateStatus % 2; - // 生成怪物图像 - const canvas = document.createElement("canvas"); - canvas.width = 32; - canvas.height = 32; - core.drawIcon(canvas, enemyId, 0, 0, 32, 32, frame); - // 执行动画 - const manager = applyFragWith(canvas); - const frag = manager.canvas; - // 设置特效画布的css属性 - frag.style.imageRendering = "pixelated"; - frag.style.width = `${frag.width * core.domStyle.scale}px`; - frag.style.height = `${frag.height * core.domStyle.scale}px`; - const left = - (x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) * - core.domStyle.scale; - const top = - (y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) * - core.domStyle.scale; - frag.style.left = `${left}px`; - frag.style.top = `${top}px`; - frag.style.zIndex = "45"; - frag.style.position = "absolute"; - // 将特效画布部署到样板上 - core.dom.gameDraw.appendChild(frag); - // 当特效执行完毕后移除这个特效画布 - manager.onEnd.then(() => { - frag.remove(); - }); - } - return origin.apply(this, arguments); - }; + const origin = core.events.afterBattle; + core.events.afterBattle = function (enemyId, x, y) { + // 打怪特效 + if (has(x) && has(y)) { + const frame = core.status.globalAnimateStatus % 2; + // 生成怪物图像 + const canvas = document.createElement("canvas"); + canvas.width = 32; + canvas.height = 32; + core.drawIcon(canvas, enemyId, 0, 0, 32, 32, frame); + // 执行动画 + const manager = applyFragWith(canvas); + const frag = manager.canvas; + // 设置特效画布的css属性 + frag.style.imageRendering = "pixelated"; + frag.style.width = `${frag.width * core.domStyle.scale}px`; + frag.style.height = `${frag.height * core.domStyle.scale}px`; + const left = + (x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) * + core.domStyle.scale; + const top = + (y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) * + core.domStyle.scale; + frag.style.left = `${left}px`; + frag.style.top = `${top}px`; + frag.style.zIndex = "45"; + frag.style.position = "absolute"; + // 将特效画布部署到样板上 + core.dom.gameDraw.appendChild(frag); + // 当特效执行完毕后移除这个特效画布 + manager.onEnd.then(() => { + frag.remove(); + }); + } + return origin.apply(this, arguments); + }; - if ("frag" in core.plugin) { - throw new ReferenceError(`core.plugin上已存在名为frag的属性!`); - } - core.plugin.frag = { - applyFragWith, - }; -}, + if ("frag" in core.plugin) { + throw new ReferenceError(`core.plugin上已存在名为frag的属性!`); + } + core.plugin.frag = { + applyFragWith, + }; + }, "自定义常用事件": function () { // editorBlocklyconfigPlus.js // 自訂常見事件模板插件 @@ -14559,7 +14593,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }); if (count > 0) list.splice(0, count); } - if (!main.replayChecking) core.registerAnimationFrame("pop", true, pop); + let now = 0; + if (!main.replayChecking) + core.registerAnimationFrame("pop", true, (temptime) => { + if (temptime - now > 1000 / 60) { + now = temptime; + pop(); + } + }); /** 添加弹出内容 */ this.addPop = function ( @@ -16338,10 +16379,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = main.dom.music = music; const audio = core.plugin.audioSystem.bgmController; - let playtime = 0; let page = 0; //初始页面 - let ischange = false; + let isvolume = false; function shuffle(arr) { @@ -16371,33 +16411,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }); music.addEventListener("mouseup", function (e) { e.stopPropagation(); - ischange = false; + isvolume = false; - if (!main.core.ui.music.stop) { - core.resumeBgm() - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], - playtime - ); - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - } }); music.addEventListener("mouseleave", function (e) { e.stopPropagation(); - ischange = false; + isvolume = false; - if (!main.core.ui.music.stop) { - core.resumeBgm() - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], - playtime - ); - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - } }); music.addEventListener("touchstart", function (e) { e.preventDefault(); @@ -16421,33 +16441,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }); music.addEventListener("touchend", function (e) { e.stopPropagation(); - ischange = false; + isvolume = false; - if (!main.core.ui.music.stop) { - core.resumeBgm() - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], - playtime - ); - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - } }); music.addEventListener("touchcancel", function (e) { e.stopPropagation(); - ischange = false; + isvolume = false; - if (!main.core.ui.music.stop) { - core.resumeBgm() - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], - playtime - ); - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - } }); class musicclass { @@ -16509,7 +16509,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = //离开按钮是一致的,其余的记区分横竖屏 music.style.display = "none"; core.clearMap(ctx); - playtime = 0 + core.unregisterAnimationFrame("music"); core.restart(); @@ -16524,11 +16524,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = [100, 200], [1048, this.musicMx[page].length * 100] ); - const beforebox = makeBox([120, 1720], [100, 100]); - const afterbox = makeBox([780, 1720], [100, 100]); - const playbox = makeBox([420, 1680], [200, 200]); - const typebox = makeBox([1040, 1700], [120, 120]); - const changebox = makeBox([100, 1590], [1048, 20]); + const beforebox = makeBox([120, 1620], [100, 100]); + const afterbox = makeBox([780, 1620], [100, 100]); + const playbox = makeBox([420, 1580], [200, 200]); + const typebox = makeBox([1040, 1600], [120, 120]); + const volumebox = makeBox([250, 1940], [1050, 20]); if (inRect(pos, pageupbox)) { if (page !== 0) page -= 1; @@ -16541,11 +16541,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (inRect(pos, playbox)) { if (this.stop) { this.stop = !this.stop; - core.resumeBgm() - core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + + core.resumeBgm(); } else { this.stop = !this.stop; core.pauseBgm(); @@ -16553,15 +16550,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return; } if (inRect(pos, beforebox)) { + this.stop = false; switch (this.type) { case "danqu": - playtime = 0; - 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] + ] + ); - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; page = this.selection[0]; break; @@ -16583,12 +16580,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.musicMx[this.selection[0]][this.selection[1]] ); page = this.selection[0]; - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + + 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) { @@ -16602,27 +16600,29 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.selection[1] = this.musicMx[this.selection[0]].indexOf( this.randomList[this.random] ); - playtime = 0 + 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] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + break; } return; } if (inRect(pos, afterbox)) { + this.stop = false; switch (this.type) { case "danqu": - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + 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": @@ -16644,13 +16644,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.musicMx[this.selection[0]][this.selection[1]] ); page = this.selection[0]; - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + 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) { @@ -16664,14 +16664,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.selection[1] = this.musicMx[this.selection[0]].indexOf( this.randomList[this.random] ); - playtime = 0 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] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + break; } return; @@ -16698,21 +16698,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.randomList.indexOf( this.musicMx[this.selection[0]][this.selection[1]] ); - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime); - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + 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; - core.resumeBgm() - core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + core.resumeBgm(); } else { this.stop = !this.stop; core.pauseBgm(); @@ -16720,19 +16717,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } return; } - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - if (inRect(pos, changebox)) { - const time = Math.floor(((px - 100) / 1000) * duration); - core.pauseBgm(); - playtime = time; - - ischange = true; - } if (inRect(pos, volumebox)) { const time = Math.min(Math.max((px - 250) / 800, 0), 1); audio.setVolume(time); + core.plugin.audioSystem.soundPlayer.setVolume(time); isvolume = true; } } else { @@ -16743,11 +16732,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = [900, 100], [1000, this.musicMx[page].length * 100] ); - const beforebox = makeBox([135, 740], [50, 50]); - const afterbox = makeBox([450, 740], [50, 50]); - const playbox = makeBox([250, 700], [200, 200]); - const typebox = makeBox([600, 700], [100, 100]); - const changebox = makeBox([100, 590], [600, 20]); + const beforebox = makeBox([60, 620], [100, 100]); + const afterbox = makeBox([450, 620], [100, 100]); + const playbox = makeBox([200, 570], [200, 200]); + const typebox = makeBox([620, 600], [120, 120]); + const volumebox = makeBox([100, 990], [600, 20]); if (inRect(pos, pageupbox)) { if (page !== 0) page -= 1; @@ -16760,11 +16749,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (inRect(pos, playbox)) { if (this.stop) { this.stop = !this.stop; - core.resumeBgm() - core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + core.resumeBgm(); } else { this.stop = !this.stop; core.pauseBgm(); @@ -16772,14 +16757,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return; } if (inRect(pos, beforebox)) { + this.stop = false; switch (this.type) { case "danqu": - playtime = 0; - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + if (!this.stop) + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + page = this.selection[0]; break; @@ -16801,12 +16788,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.musicMx[this.selection[0]][this.selection[1]] ); page = this.selection[0]; - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + + if (!this.stop) + 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) { @@ -16820,27 +16809,31 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.selection[1] = this.musicMx[this.selection[0]].indexOf( this.randomList[this.random] ); - playtime = 0 + 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] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + if (!this.stop) + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + break; } return; } if (inRect(pos, afterbox)) { + this.stop = false; switch (this.type) { case "danqu": - playtime = 0; - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + if (!this.stop) + 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": @@ -16863,13 +16856,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = v === this.musicMx[this.selection[0]][this.selection[1]] ); page = this.selection[0]; - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + if (!this.stop) + 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) { @@ -16883,14 +16877,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.selection[1] = this.musicMx[this.selection[0]].indexOf( main.core.ui.music.randomList[main.core.ui.music.random] ); - playtime = 0 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] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() - this.stop = false; + if (!this.stop) + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + break; } return; @@ -16917,20 +16912,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.randomList.indexOf( (v) => v === this.musicMx[this.selection[0]][this.selection[1]] ); - playtime = 0 - if (!this.stop) core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) + 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; - core.resumeBgm() - core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ], playtime) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + core.resumeBgm(); } else { this.stop = !this.stop; core.pauseBgm(); @@ -16938,50 +16930,25 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } return; } - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - if (inRect(pos, changebox)) { - const time = Math.floor(((px - 100) / 600) * duration); - core.pauseBgm(); - playtime = time; - - ischange = true; - } if (inRect(pos, volumebox)) { const time = Math.min(Math.max((px - 100) / 600, 0), 1); audio.setVolume(time); + core.plugin.audioSystem.soundPlayer.setVolume(time); isvolume = true; } } } mousemove(px, py) { - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - if (ischange) { - if (core.domStyle.isVertical) { - const time = Math.min( - Math.max(Math.floor(((px - 100) / 600) * duration), 0), - duration - ); - - playtime = time; - } else { - const time = Math.min( - Math.max(Math.floor(((px - 100) / 600) * duration), 0), - duration - ); - - playtime = time; - } - } if (isvolume) { if (core.domStyle.isVertical) { const time = Math.min(Math.max((px - 250) / 800, 0), 1); audio.setVolume(time); + core.plugin.audioSystem.soundPlayer.setVolume(time); } else { const time = Math.min(Math.max((px - 100) / 600, 0), 1); audio.setVolume(time); + core.plugin.audioSystem.soundPlayer.setVolume(time); } } } @@ -17085,27 +17052,24 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx.strokeStyle = "#ffffff"; ctx.lineWidth = 3; - ctx.beginPath(); - ctx.moveTo(100, 1600); - ctx.lineTo(1148, 1600); - ctx.stroke(); + ctx.fillStyle = "#ffffff"; ctx.font = "bold 96px Verdana"; - ctx.fillText("|", 100, 1797); - ctx.fillText("◀", 115, 1800); + ctx.fillText("|", 100, 1697); + ctx.fillText("◀", 115, 1700); ctx.beginPath(); - ctx.arc(505, 1770, 80, 0, 3 * Math.PI); + ctx.arc(505, 1670, 80, 0, 3 * Math.PI); ctx.stroke(); - ctx.fillText("|", 835, 1797); - ctx.fillText("▶", 785, 1800); + ctx.fillText("|", 835, 1697); + ctx.fillText("▶", 785, 1700); if (this.stop) { - ctx.fillText("▶", 473, 1797); + ctx.fillText("▶", 473, 1697); } else { - ctx.fillText("||", 453, 1794); + ctx.fillText("||", 453, 1694); } const img = core.material.images.images[this.type + ".webp"]; - if (img) ctx.drawImage(img, 1000, 1655, 200, 200); + if (img) ctx.drawImage(img, 1000, 1555, 200, 200); core.setTextAlign(ctx, "center"); ctx.font = "bold 52px Verdana"; ctx.fillText("当前歌曲", 625, 1397); @@ -17115,60 +17079,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 1507 ); - ctx.font = "bold 36px Verdana"; - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - const thistime = currentTime; - - if (thistime) { - const timetext = - Math.floor(thistime / 60) - .toString() - .padStart(2, "0") + - ":" + - Math.floor(thistime % 60) - .toString() - .padStart(2, "0"); - ctx.fillText(timetext, 960, 1650); - } else { - const timetext = "00:00"; - ctx.fillText(timetext, 960, 1650); - } - ctx.fillText("/", 1030, 1650); - const fulltime = duration; - - if (fulltime) { - const timetext = - Math.floor(fulltime / 60) - .toString() - .padStart(2, "0") + - ":" + - Math.floor(fulltime % 60) - .toString() - .padStart(2, "0"); - ctx.fillText(timetext, 1100, 1650); - } else { - const timetext = "00:00"; - ctx.fillText(timetext, 1100, 1650); - } - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 9; - ctx.fillStyle = "rgba(255,255,255,0.5)"; - const pointx = (1048 * thistime) / fulltime + 100; - if (fulltime && thistime) { - ctx.beginPath(); - ctx.moveTo(100, 1600); - ctx.lineTo(pointx, 1600); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(pointx, 1600, 10, 0, 2 * Math.PI); - ctx.fill(); - } else { - ctx.beginPath(); - ctx.arc(100, 1600, 10, 0, 2 * Math.PI); - ctx.fill(); - } - ctx.fillStyle = "#ffffff"; ctx.font = "bold 48px Verdana"; ctx.fillText("音量", 150, 1970); @@ -17196,10 +17106,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "#FFFFFF", "#000000", 6, - core.ui._buildFont(48, true) + core.ui._buildFont(56, true) ); } else { //横屏 + core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景 ctx.globalAlpha = 0.5; //透明度 if (bg) ctx.drawImage(bg, 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片 @@ -17216,7 +17127,7 @@ 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(); @@ -17283,25 +17194,23 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); 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.font = "bold 96px Verdana"; + ctx.fillText("|", 60, 697); + ctx.fillText("◀", 70, 700); ctx.beginPath(); - ctx.arc(310, 780, 50, 0, 2 * Math.PI); + ctx.arc(295, 670, 80, 0, 2 * Math.PI); ctx.stroke(); if (this.stop) { - ctx.fillText("▶", 295, 797); + ctx.fillText("▶", 245, 697); } else { - ctx.fillText("||", 285, 794); + ctx.fillText("||", 245, 694); } - ctx.fillText("|", 470, 797); - ctx.fillText("▶", 450, 800); + ctx.fillText("|", 490, 697); + ctx.fillText("▶", 450, 700); + ctx.font = "bold 48px Verdana"; ctx.fillText("音量", 350, 900); ctx.beginPath(); ctx.moveTo(100, 1000); @@ -17326,10 +17235,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "#FFFFFF", "#000000", 6, - core.ui._buildFont(32, true) + core.ui._buildFont(56, true) ); const img = core.material.images.images[this.type + ".webp"]; - if (img) ctx.drawImage(img, 580, 730, 100, 100); + if (img) ctx.drawImage(img, 580, 560, 200, 200); core.setTextAlign(ctx, "center"); ctx.font = "bold 48px Verdana"; ctx.fillText("当前歌曲", 400, 297); @@ -17338,72 +17247,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 400, 397 ); - - ctx.font = "bold 36px Verdana"; - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - const thistime = 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 = 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(); - } } } } core.ui.music = new musicclass(); main.dom.musicMode.onclick = function () { //点击开始页面的CG MODE进入cg回廊 - playtime = 0 - core.playBgm(main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ]) - audio.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).source?.audio?.load() + + core.playBgm( + 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( @@ -17418,13 +17274,27 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (temptime > time + 1000 / 60) { time = temptime; main.core.ui.music.update(); - const duration = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).duration + const duration = + core.plugin.audioSystem.bgmController.player.getRoute( + "bgms." + + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ).duration; - const currentTime = core.plugin.audioSystem.bgmController.player.getRoute("bgms." + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]]).currentTime - if (currentTime) playtime = currentTime + const currentTime = + core.plugin.audioSystem.bgmController.player.getRoute( + "bgms." + + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ).currentTime; if (currentTime && duration && duration - currentTime < 0.05) { - playtime = 0 - if (core.domStyle.isVertical) { core.ui.music.mousedown(830, 1770) } else { core.ui.music.mousedown(475, 765) } + if (core.domStyle.isVertical) { + core.ui.music.mousedown(830, 1770); + } else { + core.ui.music.mousedown(475, 765); + } } } }); @@ -17623,11 +17493,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = (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); + (Math.PI * + ((image.image.angle ?? 0) + + (((image.aangle ?? 0) - (image.image.angle ?? 0)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1))) / + 180; + if (one.hero) { let sx, sy; if (core.status.heroMoving < 0) {