diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..60839c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_saves/ +_server/config.json \ No newline at end of file diff --git a/_saves/.exported b/_saves/.exported deleted file mode 100644 index 56a6051..0000000 --- a/_saves/.exported +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/_saves/Eustia_autoSave b/_saves/Eustia_autoSave deleted file mode 100644 index a0e7916..0000000 --- a/_saves/Eustia_autoSave +++ /dev/null @@ -1 +0,0 @@ -N4IgZgNg9lBOCSATEAuEBnALrApjzADAIwgA0IAFjrFKqAJYC2AhgOY6qXVQB0A7jgBGABzIhmAOybNMHFGGYR0OchOaM5IAMLMmYiADdURchWEsAHqgCct66dEoiBF+RZrLqALQmQ75qgE5DIA1sauIIg4YOFBflExKHHownjISW5QEjgAnoHkOBaOcTgAjgCu9OY4EpioANoAuuT0sozodCAAxllYkpgdKKCCMGFO5JB5TgC+5JgwSnSzIGWVwoOg6HxwiCQzy9BdnYj0uF2Y9Fmc5aLkVigArORTzsuQbBsgrTiMACL4uggqGw5RUIHKygAQvgBDUADL0VgUOooEFggD66OUOEQmOMAHYAGwEawADgATOSACxxTGwSS49EE4lkyk04K4ZiDeqgDyaAA65SpOAIgkFDy6VPJYhY6wa2l0jAoUA0IEas156gFQpFYvKEqlMuYcpQ9RAACt6OVWOVJGqNSA+ZxBcLReLJdK3MbuSAANIAFQAavbSJrVWhBfjyYTyZHyWASF6TWaA4GAGLS9Whx1a53lKMxuMJo3JkCsKAQRAhXIhsPa116g2evze+WCegUCHlWhZut513Md2GpM+y3MKCYSSsWs58MgF0iwf6j0ln3oKgSVgSAzK1W92f1xdD5uytcUejb3ccfdOiP56Ox+/Fkfyy048cz2/z++Fp+JlullguD4MQYhAXghDNjaU5dBQU5iNBm6wVOzYWPQ45oVOoF3OhUCYZuBCobh+GsAAzJ+uYoBI5QQBAL6miAOT0BUJA3pR1G0fRZpMRUmYOreHF0QBPo8eU5FseGglcYxzFChRkk0UJp7yqJDzyXIUnCSpsmEupqCacpDGifielUYp0miaSpkGa2RmydY1nmVpdksQQ9rNBgIRVKgChKGCcGwOktLogFiBaBWcB4mguDIOQmLfIwAASF6YFFTRxeiEA4MwBg4HCUBdFFwDLJiBj0Og3yMp04EgXsaLLIIMJ4BIACCmCTl0IS/DIARmZxICYswOD0GlHmYic6DMIIWVVUMGDYBBoGmvURCkQ8zRNOqbwVtAAiwNyHlYDgJq+H0FxYPQXSfPMk4QP6TByOSDxEEQUpRjwhJ2C91hPN05SwLA93hkQDxUtYPCkXYUNQ4SDj5CAggyJgWXw4wWQ1hkKxFPDiPtVl3UsOw8PCFA5VZATbByCUFjYMwFNE5jaO5b8pw4OcEBTHEiISHAOAAMqyCaySTrAKKElSDykTwVLTMsoWcKu1ULbVnSyg0QQa6Qmva1ruv1D4pAG0bJgG0ExuGyblsWxbzQa1t5A0OUsicL6UAZloVKsAAvGIBiKKCGzLLl+2XBIebWDgpGIOKggPAQkbMNY0flNYhHx/qpKg+6BBgIK1iEkQMTkDa9DpCA5LMIghKEog1iFYgYBgFS6JUqSifooIVKEmA6JgIgU0EDgNJV3gYgXMD+KkficfWKRBBSi40xAA== diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 10b3ad5..53d2fbb 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -854,6 +854,8 @@ action | waitAsync_s | stopAsync_s | op_s + | setmusics_s + | introAndLoop_s | battle_s | battle_1_s | openDoor_s @@ -2612,6 +2614,23 @@ var code = '{"type": "setq"'+IdString_0+'},\n'; return code; */; +introAndLoop_s + : '前奏音乐文件'EvalString? '前奏音乐文件播放时长(可填小数,单位为秒)'EvalString'循环音乐文件'EvalString? Newline + +/* introAndLoop_s +tooltip : introAndLoop:设置任务目标楼层(显示在小地图) +helpUrl : /_docs/#/instruction +default : ["",1,""] +allBgms : ['EvalString_0','EvalString_2'] +colour :this.imageColor +if(EvalString_1&&!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_1))throw new Error("此项仅能填写小数或整数,单位为秒"); +EvalString_0 = EvalString_0 ? (', "intro": "'+EvalString_0+'"') : ''; +EvalString_1= EvalString_1 ? (', "time": '+EvalString_1+'') : ''; +EvalString_2 = EvalString_2 ? (', "loop": "'+EvalString_2+'"') : ''; +var code = '{"type": "introAndLoop"'+EvalString_0+EvalString_1+EvalString_2+'},\n'; +return code; +*/; + setcgs_s : 'cg回廊获取cg 文件名'EvalString?'不填为清空cg获取记录' Newline @@ -2621,12 +2640,26 @@ tooltip : setcgs:cg回廊中的cg获取 helpUrl : /_docs/#/instruction default : [""] allImages : ['EvalString_0'] -colour : this.imageColor +colour : this.soundColor EvalString_0 = EvalString_0 ? (', "img": "'+EvalString_0+'"') : ''; var code = '{"type": "setcgs"'+EvalString_0+'},\n'; return code; */; +setmusics_s + : '音乐鉴赏music 文件名'EvalString?'不填为清空music获取记录' Newline + +/* setmusics_s +tooltip : setmusics:音乐鉴赏中的隐藏music获取 +helpUrl : /_docs/#/instruction +default : [""] +allBgms : ['EvalString_0'] +colour : this.soundColor +EvalString_0 = EvalString_0 ? (', "bgm": "'+EvalString_0+'"') : ''; +var code = '{"type": "setmusics"'+EvalString_0+'},\n'; +return code; +*/; + scaleImage_s : '图片放缩' '图片编号' NInt '中心点像素' 'x' PosString? 'y' PosString? '移动方式' MoveMode_List BGNL? '放缩比例' Number '动画时间' Int '不等待执行完毕' Bool Newline diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index 06c2081..99a0213 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -620,6 +620,20 @@ MotaActionParser = function () { case "setcgs": this.next = MotaActionBlocks["setcgs_s"].xmlText([data.img, this.next]); break; + case "setmusics": + this.next = MotaActionBlocks["setmusics_s"].xmlText([ + data.bgm, + this.next, + ]); + break; + case "introAndLoop": + this.next = MotaActionBlocks["introAndLoop_s"].xmlText([ + data.intro, + data.time, + data.loop, + this.next, + ]); + break; case "comment": // 注释 this.next = MotaActionBlocks["comment_s"].xmlText([ this.EvalString_Multi(data.text), diff --git a/_server/config.json b/_server/config.json deleted file mode 100644 index 79984e9..0000000 --- a/_server/config.json +++ /dev/null @@ -1 +0,0 @@ -{ "viewportLoc": [0, 0], "editorLastFloorId": "jiedao" } diff --git a/_server/table/plugins.comment.js b/_server/table/plugins.comment.js index a02e298..0ea6e33 100644 --- a/_server/table/plugins.comment.js +++ b/_server/table/plugins.comment.js @@ -122,6 +122,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_range": "typeof(thiseval)=='string' || thiseval==null", "_data": "音乐鉴赏" + }, + "intro&loop": { + "_leaf": true, + "_type": "textarea", + "_range": "typeof(thiseval)=='string' || thiseval==null", + "_data": "背景音乐拼接" } } if (obj[key]) return obj[key]; diff --git a/main.js b/main.js index a9242ca..b8b19c0 100644 --- a/main.js +++ b/main.js @@ -492,7 +492,6 @@ main.prototype.selectButton = function (index) { main.prototype.importFonts = function (fonts) { if (!(fonts instanceof Array) || fonts.length == 0) return; var style = document.createElement("style"); - style.type = "text/css"; var html = ""; fonts.forEach(function (font) { html += diff --git a/project/bgms/Ascension.opus b/project/bgms/Ascension.opus new file mode 100644 index 0000000..4ea0523 Binary files /dev/null and b/project/bgms/Ascension.opus differ diff --git a/project/bgms/Blind_Alley.opus b/project/bgms/Blind_Alley.opus index 92df164..0e37b2f 100644 Binary files a/project/bgms/Blind_Alley.opus and b/project/bgms/Blind_Alley.opus differ diff --git a/project/bgms/Blood_Stain.opus b/project/bgms/Blood_Stain.opus new file mode 100644 index 0000000..8d34051 Binary files /dev/null and b/project/bgms/Blood_Stain.opus differ diff --git a/project/bgms/Halbmond.opus b/project/bgms/Halbmond.opus new file mode 100644 index 0000000..cf8ae13 Binary files /dev/null and b/project/bgms/Halbmond.opus differ diff --git a/project/bgms/ed.opus b/project/bgms/ed.opus new file mode 100644 index 0000000..604d512 Binary files /dev/null and b/project/bgms/ed.opus differ diff --git a/project/bgms/theme.mp3 b/project/bgms/theme.mp3 new file mode 100644 index 0000000..9310d7d Binary files /dev/null and b/project/bgms/theme.mp3 differ diff --git a/project/bgms/theme.opus b/project/bgms/theme.opus deleted file mode 100644 index 5a178d6..0000000 Binary files a/project/bgms/theme.opus and /dev/null differ diff --git a/project/data.js b/project/data.js index 5b8e9ed..cd7fc5f 100644 --- a/project/data.js +++ b/project/data.js @@ -897,11 +897,15 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "zone" ], "bgms": [ + "Ascension.opus", "Asphodelus_Ceui.opus", "Blind_Alley.opus", + "Blood_Stain.opus", "Crawler.opus", + "Halbmond.opus", + "ed.opus", "op.opus", - "theme.opus" + "theme.mp3" ], "sounds": [ "aiy010000010.opus", @@ -1019,6 +1023,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = ], "fonts": [ "HATTEN", + "Verdana", "number", "pala", "simhei" @@ -1057,7 +1062,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "饰品", "饰品" ], - "startBgm": "theme.opus", + "startBgm": "theme.mp3", "styles": { "startBackground": "project/images/background.webp", "startVerticalBackground": "project/images/backgroundvertical.webp", @@ -1489,6 +1494,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "type": "setValue", "name": "item:fly", "value": "1" + }, + { + "type": "insert", + "name": "强制横屏" } ], "shops": [ diff --git a/project/events.js b/project/events.js index 1e860d2..632325c 100644 --- a/project/events.js +++ b/project/events.js @@ -435,6 +435,11 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "time": 30, "style": "场景切换" }, + { + "type": "playBgm", + "name": "Blood_Stain.opus", + "keep": true + }, { "type": "cgtext", "bg": "other_0001.webp", @@ -3397,6 +3402,11 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = } ] }, + { + "type": "playBgm", + "name": "Halbmond.opus", + "keep": true + }, { "type": "cgtext", "bg": "bg_3601.webp", diff --git a/project/floors/street01.js b/project/floors/street01.js index dceac7f..14b5b9e 100644 --- a/project/floors/street01.js +++ b/project/floors/street01.js @@ -26,58 +26,25 @@ main.floors.street01= "direction": "up" } ], - "6,11": [ + "10,11": [ { - "type": "insert", - "name": "chapter04" + "type": "setmusics", + "bgm": "op.opus" } ], - "4,11": [ + "10,10": [ { - "type": "animationDrawable", - "allFarme": 300, - "color": [ - 0, - 0, - 0 - ], - "imageList": [ - { - "image": "bg_1511.webp", - "beforefarme": 50, - "globalAlpha": 0, - "afterfarme": 250, - "aglobalAlpha": 100 - }, - { - "image": "eve_010304.webp", - "beforefarme": 70, - "globalAlpha": 0, - "afterfarme": 170, - "aglobalAlpha": 100, - "ax": 0, - "ay": 0 - }, - { - "image": "eve_010304.webp", - "beforefarme": 171, - "globalAlpha": 100, - "afterfarme": 270, - "aglobalAlpha": 100, - "ax": 800, - "ay": 0 - } - ], - "soundList": [ - { - "sound": "", - "startfarme": 0, - "stopbefore": false - } - ] + "type": "setmusics", + "bgm": "ed.opus" }, { - "type": "op" + "type": "setmusics", + "bgm": "Asphodelus_Ceui.opus" + } + ], + "10,9": [ + { + "type": "setmusics" } ] }, diff --git a/project/fonts/Verdana.ttf b/project/fonts/Verdana.ttf new file mode 100644 index 0000000..8f25a64 Binary files /dev/null and b/project/fonts/Verdana.ttf differ diff --git a/project/plugins.js b/project/plugins.js index cd0125a..d70b07a 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -3,6 +3,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { this._afterLoadResources = function () { // 本函数将在所有资源加载完毕后,游戏开启前被执行 core.ui.statusBar.init(); + core.dom.playGame.style.fontFamily = "pala"; + core.dom.loadGame.style.fontFamily = "pala"; + core.dom.CGMode.style.fontFamily = "pala"; + core.dom.musicMode.style.fontFamily = "pala"; + core.dom.replayGame.style.fontFamily = "pala"; core.registerEvent("changeMouse", function (data) { if (!main.replayChecking && !core.isReplaying()) core.changeMouse( @@ -218,6 +223,45 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.doAction(); } }); + core.registerEvent("introAndLoop", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.plugin.introAndLoop(data.intro, data.time, data.loop); + core.doAction(); + } else { + core.doAction(); + } + }); + core.registerEvent("setq", function (data) { + core.setFlag("任务地点", data.id); + + core.doAction(); + }); + core.registerEvent("setmusics", function (data) { + if ( + (core.getLocalStorage("musics") && + core.getLocalStorage("musics").length === 0) || + !core.getLocalStorage("musics") + ) + core.setLocalStorage("musics", ["theme.mp3"]); + let a = core.getLocalStorage("musics"); + if (!data.bgm) { + core.setLocalStorage("musics", ["theme.mp3"]); + } else { + if (!a.includes(data.bgm)) a.push(data.bgm); + core.setLocalStorage("musics", a); + } + core.doAction(); + }); + core.registerEvent("setcgs", function (data) { + if (!data.img) { + core.setLocalStorage("cgs", []); + } else { + let a = core.getLocalStorage("cgs") ?? []; + if (!a.includes(data.img)) a.push(data.img); + core.setLocalStorage("cgs", a); + } + core.doAction(); + }); }; }, drawLight: function () { @@ -9528,6 +9572,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { this.gain = this.ac.createGain(); this.gain.connect(this.ac.destination); this.audioRoutes = new Map(); + const func = () => { + this.ac.resume(); + document.body.removeEventListener("mousedown", func); + document.body.removeEventListener("touchstart", func); + document.body.removeEventListener("keydown", func); + }; + document.body.addEventListener("mousedown", func, { capture: true }); + document.body.addEventListener("touchstart", func, { capture: true }); + document.body.addEventListener("keydown", func, { capture: true }); } /** * 解码音频数据 @@ -11613,6 +11666,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ], 特效表现: [ MotaActionBlocks["sleep_s"].xmlText(), + MotaActionBlocks["setq_s"].xmlText(), + MotaActionBlocks["setcgs_s"].xmlText(), + MotaActionBlocks["setmusics_s"].xmlText(), MotaActionBlocks["changebg_s"].xmlText(), MotaActionFunctions.actionParser.parseList({ type: "wait", @@ -11664,10 +11720,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { MotaActionBlocks["changeMouse_s"].xmlText(), MotaActionBlocks["removeMouse_s"].xmlText(), MotaActionBlocks["vibrate_s"].xmlText(), - MotaActionBlocks["setanimate_s"].xmlText(), - MotaActionBlocks["deleteanimate_s"].xmlText(), - MotaActionBlocks["playanimate_s"].xmlText(), - MotaActionBlocks["clearanimate_s"].xmlText(), MotaActionBlocks["animate_s"].xmlText(), MotaActionBlocks["animate_1_s"].xmlText(), MotaActionBlocks["stopAnimate_s"].xmlText(), @@ -11689,6 +11741,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ], 音像处理: [ MotaActionBlocks["animationDrawable_s"].xmlText(), + MotaActionBlocks["introAndLoop_s"].xmlText(), MotaActionBlocks["setanimate_s"].xmlText(), MotaActionBlocks["deleteanimate_s"].xmlText(), MotaActionBlocks["playanimate_s"].xmlText(), @@ -16453,19 +16506,28 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { class musicclass { constructor() { + this.musics = ["theme.mp3"]; //music列表 //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 this.musicMx = [ - ["Asphodelus_Ceui.opus", "Blind_Alley.opus"], - ["Crawler.opus", "op.opus", "theme.opus"], + [ + "Crawler.opus", + "Blood_Stain.opus", + "Blind_Alley.opus", + "Halbmond.opus", + ], + ["theme.mp3", "op.opus", "Asphodelus_Ceui.opus", "ed.opus"], ]; //音乐别名(将在播放器内显示的音乐名,music列表内的都要有对应歌名) this.musicname = { - "Asphodelus_Ceui.opus": "Asphodelus", - "Blind_Alley.opus": "Blind", + "Asphodelus_Ceui.opus": "Asphodelus (Full.ver)", + "Blind_Alley.opus": "Blind Alley", "Crawler.opus": "Crawler", - "op.opus": "op", - "theme.opus": "theme", + "op.opus": "Asphodelus", + "theme.mp3": "One of Episodes", + "ed.opus": "親愛なる世界へ", + "Blood_Stain.opus": "Blood Stain", + "Halbmond.opus": "Halbmond", }; this.selection = [0, 0]; this.stop = false; @@ -16561,24 +16623,32 @@ 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] @@ -16587,20 +16657,28 @@ 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] @@ -16624,25 +16702,33 @@ 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] @@ -16651,19 +16737,28 @@ 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] @@ -16691,19 +16786,25 @@ 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; @@ -16758,64 +16859,79 @@ 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; } @@ -16825,64 +16941,79 @@ 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; } @@ -16905,18 +17036,24 @@ 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; @@ -16989,24 +17126,30 @@ 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(); @@ -17051,19 +17194,63 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ctx.strokeStyle = "#ffffff"; ctx.lineWidth = 3; - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 96px Verdana"; - ctx.fillText("|", 100, 1697); - ctx.fillText("◀", 115, 1700); + core.fillBoldText( + ctx, + "|", + 100, + 1697, + "#FFFFFF", + 6, + core.ui._buildFont(96, true) + ); + core.fillBoldText( + ctx, + "◀", + 115, + 1700, + "#FFFFFF", + 6, + core.ui._buildFont(96, true) + ); + ctx.beginPath(); ctx.arc(505, 1670, 80, 0, 3 * Math.PI); ctx.stroke(); - ctx.fillText("|", 835, 1697); - ctx.fillText("▶", 785, 1700); + core.fillText( + ctx, + "|", + 835, + 1697, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + core.fillText( + ctx, + "▶", + 785, + 1700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + if (this.stop) { - ctx.fillText("▶", 473, 1697); + core.fillText( + ctx, + "▶", + 473, + 1700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); } else { - ctx.fillText("||", 453, 1694); + core.fillText( + ctx, + "||", + 453, + 1700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); } const img = core.material.images.images[this.type + ".webp"]; @@ -17139,24 +17326,30 @@ 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( @@ -17193,21 +17386,62 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ctx.strokeStyle = "#ffffff"; ctx.lineWidth = 3; - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 96px Verdana"; - ctx.fillText("|", 60, 697); - ctx.fillText("◀", 70, 700); + core.fillText( + ctx, + "|", + 55, + 697, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + core.fillText( + ctx, + "◀", + 70, + 700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + ctx.beginPath(); ctx.arc(295, 670, 80, 0, 2 * Math.PI); ctx.stroke(); if (this.stop) { - ctx.fillText("▶", 245, 697); + core.fillText( + ctx, + "▶", + 265, + 700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); } else { - ctx.fillText("||", 245, 694); + core.fillText( + ctx, + "||", + 245, + 700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); } + core.fillText( + ctx, + "|", + 495, + 697, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + core.fillText( + ctx, + "▶", + 450, + 700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); - ctx.fillText("|", 490, 697); - ctx.fillText("▶", 450, 700); ctx.font = "bold 48px Verdana"; ctx.fillText("音量", 350, 900); ctx.beginPath(); @@ -17251,7 +17485,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.ui.music = new musicclass(); main.dom.musicMode.onclick = function () { //点击开始页面的CG MODE进入cg回廊 - + if ( + (core.getLocalStorage("musics") && + core.getLocalStorage("musics").length === 0) || + !core.getLocalStorage("musics") + ) + core.setLocalStorage("musics", ["theme.mp3"]); + core.ui.music.musics = core.getLocalStorage("musics"); core.playBgm( main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ main.core.ui.music.selection[1] @@ -17563,4 +17803,348 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }); }, + "intro&loop": function () { + // 在此增加新插件 + this.introAndLoop = function (intro, time, loop) { + core.playBgm(intro); + setTimeout(() => { + core.playBgm(loop); + }, time * 1000); + }; + }, + 开局选项悬停: function () { + // 在此增加新插件 + + main.dom.playGame.addEventListener("mouseenter", () => { + core.dom.playGame.style.backgroundColor = "#808080"; + }); + main.dom.playGame.addEventListener("mouseleave", () => { + core.dom.playGame.style.backgroundColor = "transparent"; + }); + main.dom.playGame.addEventListener("touchmove", () => { + core.dom.playGame.style.backgroundColor = "#808080"; + }); + main.dom.playGame.addEventListener("touchend", () => { + core.dom.playGame.style.backgroundColor = "transparent"; + }); + main.dom.playGame.addEventListener("touchcancel", () => { + core.dom.playGame.style.backgroundColor = "transparent"; + }); + + main.dom.loadGame.addEventListener("mouseenter", () => { + core.dom.loadGame.style.backgroundColor = "#808080"; + }); + main.dom.loadGame.addEventListener("mouseleave", () => { + core.dom.loadGame.style.backgroundColor = "transparent"; + }); + main.dom.loadGame.addEventListener("touchmove", () => { + core.dom.loadGame.style.backgroundColor = "#808080"; + }); + main.dom.loadGame.addEventListener("touchend", () => { + core.dom.loadGame.style.backgroundColor = "transparent"; + }); + main.dom.loadGame.addEventListener("touchcancel", () => { + core.dom.loadGame.style.backgroundColor = "transparent"; + }); + + main.dom.CGMode.addEventListener("mouseenter", () => { + core.dom.CGMode.style.backgroundColor = "#808080"; + }); + main.dom.CGMode.addEventListener("mouseleave", () => { + core.dom.CGMode.style.backgroundColor = "transparent"; + }); + main.dom.CGMode.addEventListener("touchmove", () => { + core.dom.CGMode.style.backgroundColor = "#808080"; + }); + main.dom.CGMode.addEventListener("touchend", () => { + core.dom.CGMode.style.backgroundColor = "transparent"; + }); + main.dom.CGMode.addEventListener("touchcancel", () => { + core.dom.CGMode.style.backgroundColor = "transparent"; + }); + + main.dom.musicMode.addEventListener("mouseenter", () => { + core.dom.musicMode.style.backgroundColor = "#808080"; + }); + main.dom.musicMode.addEventListener("mouseleave", () => { + core.dom.musicMode.style.backgroundColor = "transparent"; + }); + main.dom.musicMode.addEventListener("touchmove", () => { + core.dom.musicMode.style.backgroundColor = "#808080"; + }); + main.dom.musicMode.addEventListener("touchend", () => { + core.dom.musicMode.style.backgroundColor = "transparent"; + }); + main.dom.musicMode.addEventListener("touchcancel", () => { + core.dom.musicMode.style.backgroundColor = "transparent"; + }); + + main.dom.replayGame.addEventListener("mouseenter", () => { + core.dom.replayGame.style.backgroundColor = "#808080"; + }); + main.dom.replayGame.addEventListener("mouseleave", () => { + core.dom.replayGame.style.backgroundColor = "transparent"; + }); + main.dom.replayGame.addEventListener("touchmove", () => { + core.dom.replayGame.style.backgroundColor = "#808080"; + }); + main.dom.replayGame.addEventListener("touchend", () => { + core.dom.replayGame.style.backgroundColor = "transparent"; + }); + main.dom.replayGame.addEventListener("touchcancel", () => { + core.dom.replayGame.style.backgroundColor = "transparent"; + }); + }, + 天气叠加: function () { + //使用方法:使用core.setWeather(天气,等级)来增加天气,使用core.setWeather()来清空天气 + // 天气叠加功能 + ////// 更改天气效果 ////// + control.prototype.setWeather = function (type, level) { + // 非雨雪 + if (type == null) { + Object.keys(core.control.weathers).forEach(function (one) { + core.deleteCanvas("weather" + one); + }); + core.animateFrame.weather.type = []; + core.animateFrame.weather.nodes = {}; + core.animateFrame.weather.level = {}; + core.animateFrame.weather.time = {}; + return; + } + if (!core.animateFrame.weather.level || level == null) + core.animateFrame.weather.level = {}; + if (!core.animateFrame.weather.type) core.animateFrame.weather.type = []; + level = core.clamp(parseInt(level) || 5, 1, 10); + // 当前天气:则忽略 + if ( + core.animateFrame.weather.type.includes(type) && + level == core.animateFrame.weather.level[type] + ) + return; + if (core.animateFrame.weather.nodes[type]) return; + // 计算当前的宽高 + core.createCanvas( + "weather" + type, + 0, + 0, + core.__PIXELS__, + core.__PIXELS__, + 80 + ); + core.animateFrame.weather.type.push(type); + core.animateFrame.weather.level[type] = level; + this._setWeather_createNodes(type, level); + }; + control.prototype._setWeather_createNodes = function (type, level) { + var number = + level * + parseInt( + (20 * core.bigmap.width * core.bigmap.height) / + (core.__SIZE__ * core.__SIZE__) + ); + if (!core.animateFrame.weather.nodes[type]) + core.animateFrame.weather.nodes[type] = []; + switch (type) { + case "rain": + for (var a = 0; a < number; a++) { + core.animateFrame.weather.nodes.rain.push({ + x: Math.random() * core.bigmap.width * 32, + y: Math.random() * core.bigmap.height * 32, + l: Math.random() * 2.5, + xs: -4 + Math.random() * 4 + 2, + ys: Math.random() * 10 + 10, + }); + } + break; + case "snow": + for (var a = 0; a < number; a++) { + core.animateFrame.weather.nodes.snow.push({ + x: Math.random() * core.bigmap.width * 32, + y: Math.random() * core.bigmap.height * 32, + r: Math.random() * 5 + 1, + d: Math.random() * Math.min(level, 200), + }); + } + break; + case "fog": + if (core.animateFrame.weather.fog) { + core.animateFrame.weather.nodes[type] = [ + { + level: number, + x: 0, + y: -core.__PIXELS__ / 2, + dx: -Math.random() * 1.5, + dy: Math.random(), + delta: 0.001, + }, + ]; + } + break; + case "cloud": + if (core.animateFrame.weather.cloud) { + core.animateFrame.weather.nodes[type] = [ + { + level: number, + x: 0, + y: -core.__PIXELS__ / 2, + dx: -Math.random() * 1.5, + dy: Math.random(), + delta: 0.001, + }, + ]; + } + break; + case "sun": + if (core.animateFrame.weather.sun) { + // 直接绘制 + core.clearMap("weather" + type); + core.setAlpha("weather" + type, level / 10); + core.drawImage( + "weather" + type, + core.animateFrame.weather.sun, + 0, + 0, + core.animateFrame.weather.sun.width, + core.animateFrame.weather.sun.height, + 0, + 0, + core.__PIXELS__, + core.__PIXELS__ + ); + core.setAlpha("weather" + type, 1); + } + break; + } + }; + core.registerAnimationFrame("weather", true, function (timestamp) { + var weather = core.animateFrame.weather; + if (!weather.type) return; + weather.type.forEach(function (one) { + if ( + timestamp - weather.time[one] <= 30 || + !core.dymCanvas["weather" + one] + ) + return; + core.control["_animationFrame_weather_" + one](); + weather.time[one] = timestamp; + }); + }); + // 雨 + control.prototype._animationFrame_weather_rain = function () { + var ctx = core.dymCanvas.weatherrain, + ox = core.bigmap.offsetX, + oy = core.bigmap.offsetY; + core.clearMap("weatherrain"); + ctx.strokeStyle = "rgba(174,194,224,0.8)"; + ctx.lineWidth = 1; + ctx.lineCap = "round"; + core.animateFrame.weather.nodes.rain.forEach(function (p) { + ctx.beginPath(); + ctx.moveTo(p.x - ox, p.y - oy); + ctx.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy); + ctx.stroke(); + p.x += p.xs; + p.y += p.ys; + if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) { + p.x = Math.random() * core.bigmap.width * 32; + p.y = -10; + } + }); + ctx.fill(); + }; + // 雪 + control.prototype._animationFrame_weather_snow = function () { + var ctx = core.dymCanvas.weathersnow, + ox = core.bigmap.offsetX, + oy = core.bigmap.offsetY; + core.clearMap("weathersnow"); + ctx.fillStyle = "rgba(255, 255, 255, 0.8)"; + ctx.beginPath(); + if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {}; + core.animateFrame.weather.data.snow = + core.animateFrame.weather.data.snow || 0; + core.animateFrame.weather.data.snow += 0.01; + var angle = core.animateFrame.weather.data.snow; + core.animateFrame.weather.nodes.snow.forEach(function (p) { + ctx.moveTo(p.x - ox, p.y - oy); + ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true); + // update + p.x += Math.sin(angle) * core.animateFrame.weather.level.snow; + p.y += Math.cos(angle + p.d) + 1 + p.r / 2; + if ( + p.x > core.bigmap.width * 32 + 5 || + p.x < -5 || + p.y > core.bigmap.height * 32 + ) { + if (Math.random() > 1 / 3) { + p.x = Math.random() * core.bigmap.width * 32; + p.y = -10; + } else { + if (Math.sin(angle) > 0) p.x = -5; + else p.x = core.bigmap.width * 32 + 5; + p.y = Math.random() * core.bigmap.height * 32; + } + } + }); + ctx.fill(); + }; + // 图片天气 + control.prototype.__animateFrame_weather_image = function (image, type) { + if (!image) return; + var node = core.animateFrame.weather.nodes[type][0]; + core.setAlpha("weather" + type, node.level / 500); + var wind = 1.5; + var width = image.width, + height = image.height; + node.x += node.dx * wind; + node.y += (2 * node.dy - 1) * wind; + if (node.x + 3 * width <= core.__PIXELS__) { + node.x += 4 * width; + while (node.x > 0) node.x -= width; + } + node.dy += node.delta; + if (node.dy >= 1) { + node.delta = -0.001; + } else if (node.dy <= 0) { + node.delta = 0.001; + } + if (node.y + 3 * height <= core.__PIXELS__) { + node.y += 4 * height; + while (node.y > 0) node.y -= height; + } else if (node.y >= 0) { + node.y -= height; + } + for (var i = 0; i < 3; ++i) { + for (var j = 0; j < 3; ++j) { + if ( + node.x + (i + 1) * width <= 0 || + node.x + i * width >= core.__PIXELS__ || + node.y + (j + 1) * height <= 0 || + node.y + j * height >= core.__PIXELS__ + ) + continue; + core.drawImage( + "weather" + type, + image, + node.x + i * width, + node.y + j * height + ); + } + } + core.setAlpha("weather" + type, 1); + }; + // 雾 + control.prototype._animationFrame_weather_fog = function () { + core.clearMap("weatherfog"); + this.__animateFrame_weather_image(core.animateFrame.weather.fog, "fog"); + }; + // 云 + control.prototype._animationFrame_weather_cloud = function () { + core.clearMap("weathercloud"); + this.__animateFrame_weather_image( + core.animateFrame.weather.cloud, + "cloud" + ); + }; + }, }; diff --git a/styles.css b/styles.css index 89ddc05..e7ba189 100644 --- a/styles.css +++ b/styles.css @@ -1,534 +1,585 @@ -html, body { - margin: 0; - padding: 0; - width: 100%; - height: 100%; - background-color: #000; - overflow: hidden; +html, +body { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + background-color: #000; + overflow: hidden; } #gameGroup { - position: absolute; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - background-color: #000; + position: absolute; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + background-color: #000; } #mainTips { - color: #fff; - font-size: 0.8em; - position: fixed; - top: 10px; - left: 10px; - z-index: 370; + color: #fff; + font-size: 0.8em; + position: fixed; + top: 10px; + left: 10px; + z-index: 370; } #musicBtn { - position: fixed; - bottom: 3px; - right: 3px; - cursor: pointer; - z-index: 400; - display: none; + position: fixed; + bottom: 3px; + right: 3px; + cursor: pointer; + z-index: 400; + display: none; } #enlargeBtn { - position: fixed; - bottom: 3px; - right: 34px; - cursor: pointer; - z-index: 400; - display: none; + position: fixed; + bottom: 3px; + right: 34px; + cursor: pointer; + z-index: 400; + display: none; } #startPanel { - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; - background-color: #fff; - overflow: hidden; - z-index: 300; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: #fff; + overflow: hidden; + z-index: 300; } #startTop { - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; - background-color: #000; - z-index: 350; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: #000; + z-index: 350; } #startTopProgressBar { - width: 90%; - height: 5%; - margin: 0 5%; - position: absolute; - top: 5%; - background-color: #fff; - z-index: 15; + width: 90%; + height: 5%; + margin: 0 5%; + position: absolute; + top: 5%; + background-color: #fff; + z-index: 15; } #startTopProgress { - width: 0%; - height: 100%; - background-color: #666; + width: 0%; + height: 100%; + background-color: #666; } #startTopLoadTips { - color: #fff; - font-size: 0.6em; - position: absolute; - top: 10%; - left: 5%; - z-index: 15; + color: #fff; + font-size: 0.6em; + position: absolute; + top: 10%; + left: 5%; + z-index: 15; } #startTopHint { - color: #66CCFF; - position: absolute; - bottom: 0; - left: 5%; - z-index: 15; - font-size: 1.1em; + color: #66ccff; + position: absolute; + bottom: 0; + left: 5%; + z-index: 15; + font-size: 1.1em; } #startBackground { - position:absolute; - top:50%; - left:50%; - height: 100%; - width: 100%; - transform:translate(-50%,-50%); - z-index: 260; + position: absolute; + top: 50%; + left: 50%; + height: 100%; + width: 100%; + transform: translate(-50%, -50%); + z-index: 260; } #startLogo { - user-select: none; - position: absolute; - z-index: 290; - left: 0; - right: 0; - margin-left: auto; - margin-right: auto; - margin-top: 8%; - max-width: 100%; - text-align: center; - font: bold 0em STXingkai; - color: #000000; + user-select: none; + position: absolute; + z-index: 290; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto; + margin-top: 8%; + max-width: 100%; + text-align: center; + font: bold 0em STXingkai; + color: #000000; } #startTitle { - user-select: none; - position: absolute; - z-index: 280; + user-select: none; + position: absolute; + z-index: 280; } #startButtonGroup { - width: auto; - position: absolute; - text-align: center; - font-size: 1.4em; - display: none; - z-index: 310; - bottom: 0; - margin-bottom: 5%; - left: 50%; - transform: translateX(-50%); - padding: 15px 25px; - min-width: 100%; - /* default value */ - background-color: #000000; - opacity: 0.55; - color: #FFFFFF; - border: #FFFFFF 0px solid; - caret-color: #ffffff; - border-radius: 0px; + width: auto; + position: absolute; + text-align: center; + font-size: 1.4em; + display: none; + z-index: 310; + bottom: 0; + margin-bottom: 5%; + left: 50%; + transform: translateX(-50%); + padding: 15px 25px; + min-width: 100%; + /* default value */ + background-color: #000000; + opacity: 0.55; + color: #ffffff; + border: #ffffff 0px solid; + caret-color: #ffffff; + border-radius: 0px; } #startButtons { - display: none; + display: none; } #levelChooseButtons { - display: none; + display: none; } .startButton { - width: 100%; - margin: 0; - font:1.2rem "pala", sans-serif; - font-weight: normal; - display: block; - cursor: pointer; - padding: 0px 0; - border-color: transparent; - border-width: 0px; - border-style: solid; - border-radius: 0px; + width: 100%; + margin: 0; + font: 1.2rem pala, sans-serif; + font-weight: normal; + display: block; + cursor: pointer; + padding: 0px 0; + border-color: transparent; + border-width: 0px; + border-style: solid; + border-radius: 0px; } .onChoiceAnimate { - animation: onChoice 2s ease-in-out 0s infinite normal none running; + animation: onChoice 2s ease-in-out 0s infinite normal none running; } #floorMsgGroup { - position: absolute; - text-align: center; - display: none; - color: #fff; - background-color: #000; - z-index: 230; + position: absolute; + text-align: center; + display: none; + color: #fff; + background-color: #000; + z-index: 230; } #logoLabel { - margin-top: 8%; - font: bold 3em STXingkai; - margin-left: auto; - margin-right: auto; + margin-top: 8%; + font: bold 3em STXingkai; + margin-left: auto; + margin-right: auto; } #versionLabel { - margin-top: -3%; - font-size: 1.2em; - font-weight: bold; + margin-top: -3%; + font-size: 1.2em; + font-weight: bold; } #floorNameLabel { - margin-top: 30px; - font-size: 1.6em; - font-weight: bold; + margin-top: 30px; + font-size: 1.6em; + font-weight: bold; } #statusBar { - position: absolute; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - background: url(project/materials/ground.png) repeat; - z-index: 185; - display: none; - top: 0; - left: 0; - padding: 3px; + position: absolute; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + background: url(project/materials/ground.png) repeat; + z-index: 185; + display: none; + top: 0; + left: 0; + padding: 3px; } -#statusBar .status{ - position: relative; - display: block; - float: left; - width: 100%; +#statusBar .status { + position: relative; + display: block; + float: left; + width: 100%; } -.status img{ - vertical-align: middle; - width: auto; - height: 100%; - max-height: 1.6em; +.status img { + vertical-align: middle; + width: auto; + height: 100%; + max-height: 1.6em; } -#statusBar span{ - font: bold italic 1.1em Verdana; - display: inline; +#statusBar span { + font: bold italic 1.1em Verdana; + display: inline; } #statusBar p { - display: inline-block; - vertical-align: middle; - width: 60%; - margin: 0; - color: white; - font: bold italic 1.1em Verdana; - white-space: nowrap; + display: inline-block; + vertical-align: middle; + width: 60%; + margin: 0; + color: white; + font: bold italic 1.1em Verdana; + white-space: nowrap; } #toolBar { - position: absolute; - background: url(project/materials/ground.png) repeat; - z-index: 210; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - display: none; - padding: 3px; + position: absolute; + background: url(project/materials/ground.png) repeat; + z-index: 210; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + display: none; + padding: 3px; } -#toolBar .tools{ - position: relative; - display: block; - float: left; +#toolBar .tools { + position: relative; + display: block; + float: left; } p#hard { - width: 6em; - vertical-align: middle; - display: inline-block; - color: red; - font: bold normal 1.1em "Arial Black"; - text-align: center; - margin: 0 6px 6px 0; - word-break: keep-all; + width: 6em; + vertical-align: middle; + display: inline-block; + color: red; + font: bold normal 1.1em "Arial Black"; + text-align: center; + margin: 0 6px 6px 0; + word-break: keep-all; } -span#poison, span#weak, span#curse, span#pickaxe, span#bomb, span#fly { - font-style: normal; - font-size: 1em; +span#poison, +span#weak, +span#curse, +span#pickaxe, +span#bomb, +span#fly { + font-style: normal; + font-size: 1em; } p#name { - font-style: normal; + font-style: normal; } .gameCanvas { - position: absolute; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; + position: absolute; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } #gif { - z-index: 20; - position: absolute; - overflow: hidden; + z-index: 20; + position: absolute; + overflow: hidden; } #gif2 { - z-index: 90; - position: absolute; - overflow: hidden; + z-index: 90; + position: absolute; + overflow: hidden; } #gameDraw { - position: absolute; - background: #000000; - overflow: hidden; - z-index: 185; + position: absolute; + background: #000000; + overflow: hidden; + z-index: 185; } #bg { - z-index: 10; + z-index: 10; } #event { - z-index: 30; + z-index: 30; } #hero { - z-index: 40; + z-index: 40; } #event2 { - z-index: 50; + z-index: 50; } #fg { - z-index: 60; + z-index: 60; } #damage { - z-index: 65; + z-index: 65; } #animate { - z-index: 70; + z-index: 70; } #curtain { - z-index: 125; + z-index: 125; } #ui { - z-index: 140; + z-index: 140; } #data { - z-index: 170; + z-index: 170; } #inputDiv { - display: none; - width: 100%; - height: 100%; - position: fixed; - top: 0; - left: 0; - background: rgba(127,127,127,0.6); - z-index: 2000 + display: none; + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: rgba(127, 127, 127, 0.6); + z-index: 2000; } #inputDialog { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -55%); - background: white; - width: 250px; - min-height: 50px; + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -55%); + background: white; + width: 250px; + min-height: 50px; } #inputMessage { - word-wrap: break-word; - text-align: left; - margin-left: 8%; - margin-right: 5%; + word-wrap: break-word; + text-align: left; + margin-left: 8%; + margin-right: 5%; } #inputBox { - margin-left: 8%; - width: 80%; - margin-bottom: 10px; - padding: 5px 3px; - border: 1px solid; - background: #F0F0F0; + margin-left: 8%; + width: 80%; + margin-bottom: 10px; + padding: 5px 3px; + border: 1px solid; + background: #f0f0f0; } #inputYes { - margin-bottom: 15px; - margin-left: 8%; + margin-bottom: 15px; + margin-left: 8%; } #inputNo { - float:right; - margin-right: 10%; + float: right; + margin-right: 10%; } -#_selector, ._uievent_selector { - animation: selector 2s ease-in-out 0s infinite normal none running; +#_selector, +._uievent_selector { + animation: selector 2s ease-in-out 0s infinite normal none running; } @-webkit-keyframes selector { - 0% { opacity: 0.95; } - 50% { opacity: 0.55; } - 100% { opacity: 0.95; } + 0% { + opacity: 0.95; + } + 50% { + opacity: 0.55; + } + 100% { + opacity: 0.95; + } } @keyframes selector { - 0% { opacity: 0.95; } - 50% { opacity: 0.55; } - 100% { opacity: 0.95; } + 0% { + opacity: 0.95; + } + 50% { + opacity: 0.55; + } + 100% { + opacity: 0.95; + } } #next { - width: 5px; - height: 5px; - display: none; - position: absolute; - transform: rotate(45deg); - border-bottom-width: 4px; - border-bottom-style: solid; - border-right-width: 4px; - border-right-style: solid; - -webkit-animation: next .5s ease-in-out alternate infinite; - animation: next .5s ease-in-out alternate infinite; - left: 0; - top: 0; - opacity: 0.7; - z-index: 169; + width: 5px; + height: 5px; + display: none; + position: absolute; + transform: rotate(45deg); + border-bottom-width: 4px; + border-bottom-style: solid; + border-right-width: 4px; + border-right-style: solid; + -webkit-animation: next 0.5s ease-in-out alternate infinite; + animation: next 0.5s ease-in-out alternate infinite; + left: 0; + top: 0; + opacity: 0.7; + z-index: 169; } @-webkit-keyframes next { - 100% { - transform: rotate(45deg) translate(-3px, -3px); - } + 100% { + transform: rotate(45deg) translate(-3px, -3px); + } } @keyframes next { - 100% { - transform: rotate(45deg) translate(-3px, -3px); - } + 100% { + transform: rotate(45deg) translate(-3px, -3px); + } } #startImageBackgroundDiv { - display: none; - width: 100%; - height: 100%; - position: fixed; - z-index: 10000; + display: none; + width: 100%; + height: 100%; + position: fixed; + z-index: 10000; } #startImageDiv { - width: 100%; - height: 100%; - position: fixed; - background: black; - opacity: 1; + width: 100%; + height: 100%; + position: fixed; + background: black; + opacity: 1; } #startImageLogo { - opacity: 0; - max-width: 60%; - max-height: 60%; - position: fixed; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); + opacity: 0; + max-width: 60%; + max-height: 60%; + position: fixed; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); } .startImageAnimation { - -webkit-animation: startImage 4s ease-in-out 1s alternate 1; - animation: startImage 4s ease-in-out 1s alternate 1; + -webkit-animation: startImage 4s ease-in-out 1s alternate 1; + animation: startImage 4s ease-in-out 1s alternate 1; } @-webkit-keyframes startImage { - 0% { opacity: 0; } - 60% { opacity: 1; } - 100% { opacity: 0; } + 0% { + opacity: 0; + } + 60% { + opacity: 1; + } + 100% { + opacity: 0; + } } @keyframes startImage { - 0% { opacity: 0; } - 60% { opacity: 1; } - 100% { opacity: 0; } + 0% { + opacity: 0; + } + 60% { + opacity: 1; + } + 100% { + opacity: 0; + } } .startImageDivAnimation { - -webkit-animation: startImageDivDisappear 2s ease-in-out 5s alternate 1; - animation: startImageDivDisappear 2s ease-in-out 5s alternate 1; + -webkit-animation: startImageDivDisappear 2s ease-in-out 5s alternate 1; + animation: startImageDivDisappear 2s ease-in-out 5s alternate 1; } @-webkit-keyframes startImageDivDisappear { - 0% { opacity: 1 } - 100% { opacity: 0 } + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } } @keyframes startImageDivDisappear { - 0% { opacity: 1 } - 100% { opacity: 0 } + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } } #ui-editor { - z-index: 9999; - position: absolute; - overflow: visible; - height: 100%; + z-index: 9999; + position: absolute; + overflow: visible; + height: 100%; } @font-face { - font-family: Fira Code; - src: url(../src/fonts/FiraCode-Regular.ttf); + font-family: Fira Code; + src: url(../src/fonts/FiraCode-Regular.ttf); } /* 注释下面这三行以开启抗锯齿 */ .anti-aliasing { - image-rendering: pixelated; + image-rendering: pixelated; } .warning { - transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s; - -webkit-transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s; - animation: warning 1s linear 0s alternate infinite; - -webkit-animation: warning 1s linear 0s alternate infinite; + transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s; + -webkit-transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s; + animation: warning 1s linear 0s alternate infinite; + -webkit-animation: warning 1s linear 0s alternate infinite; } @keyframes warning { - 0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} - 50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);} - 100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} + 0 % { + text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); + } + 50 % { + text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0); + } + 100 % { + text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); + } } @-webkit - keyframes warning { - 0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} - 50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);} - 100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} + 0 % { + text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); + } + 50 % { + text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0); + } + 100 % { + text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); + } } .gameCanvas { - transition: transform 1.5s ease-out; - -webkit-transition: transform 1.5s ease-out; -} \ No newline at end of file + transition: transform 1.5s ease-out; + -webkit-transition: transform 1.5s ease-out; +}