diff --git a/_server/config.json b/_server/config.json index 5d318ea..fe97c11 100644 --- a/_server/config.json +++ b/_server/config.json @@ -1 +1 @@ -{"viewportLoc":[0,0],"editorLastFloorId":"street01"} \ No newline at end of file +{"viewportLoc":[0,0],"editorLastFloorId":"guangchang2"} \ No newline at end of file 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/data.js b/project/data.js index a934ab8..cd7fc5f 100644 --- a/project/data.js +++ b/project/data.js @@ -1023,6 +1023,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = ], "fonts": [ "HATTEN", + "Verdana", "number", "pala", "simhei" @@ -1493,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/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 1f9e092..4f00f15 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1,265 +1,269 @@ -var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { - init: function () { - this._afterLoadResources = function () { - // 本函数将在所有资源加载完毕后,游戏开启前被执行 - core.ui.statusBar.init(); - core.registerEvent("changeMouse", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.changeMouse( - data.icon, - data.div, - data.translate[0], - data.translate[1], - data.scale[0], - data.scale[1], - data.angel, - data.px, - data.py - ); - core.doAction(); - }); - core.registerEvent("removeMouse", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.removeMouse(data.div); - core.doAction(); - }); - core.registerEvent("addPop", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.value = core.replaceText(data.value); - core.addPop( - data.value, - data.px, - data.py, - data.color, - data.boldColor, - data.left, - data.jump, - data.time, - data.show, - data.font, - data.speed - ); - } - core.doAction(); - }); - core.registerEvent("drawWarning", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.text = core.replaceText(data.text); - data.text2 = core.replaceText(data.text2); - core.drawWarning( - data.x, - data.y, - data.size, - data?.text, - data?.text2, - data?.warning - ); - setTimeout(() => core.doAction(), 3100); - } else { - core.doAction(); - } - }); - core.registerEvent("playStereo", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.playStereo(data.name, data.left, data.right, data.split); - core.doAction(); - }); - core.registerEvent("moveStereo", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - const id = core.playStereo( - data.name, - data.left, - data.right, - data.split - ); - core.moveStereo(id, data.leftTo, data.rightTo, data.time); - } - core.doAction(); - }); - core.registerEvent("over", function (data) { - let image = data.image ?? ""; - let time = data.time ?? 3000; - let sound = data.sound ?? ""; - let textColor = data.textColor ?? "#FFFFFF"; - let boldColor = data.boldColor ?? "#000000"; - let font = data.font ?? "bold 48px Verdana"; - let text = data.text ?? ""; - let hidetime = data.hidetime ?? 100; - if (!main.replayChecking && !core.isReplaying()) { - core.over( - image, - data.memory, - time, - hidetime, - sound, - textColor, - boldColor, - font, - text - ); - } else { - core.doAction(); - } - }); - core.registerEvent("changebg", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.changebg( - data.img1, - data.memory1, - data.img2, - data.memory2, - data.time, - data.style - ); - } else { - core.doAction(); - } - }); - core.registerEvent("overlist", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.overlist( - data.image, - data.memory, - data.hidetime || 30, - data.list || [ - { - text: "", - sound: "", - time: 50, - textColor: "#FFFFFF", - boldColor: "#000000", - font: "bold 48px Verdana", - frame: 0, - }, - ] - ); - } else { - core.doAction(); - } - }); - core.registerEvent("op", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.openvideo(); - } else { - core.doAction(); - } - }); - core.registerEvent("animationDrawable", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.animationDrawable( - data.allFarme, - data.color, - data.globalAlpha, - data.imageList, - data.soundList - ); - } else { - core.doAction(); - } - }); - core.registerEvent("setanimate", function (data) { - data.px = data.px ?? 0; - data.py = data.py ?? 0; - core.setanimate( - data.name, - data.px, - data.py, - data.width, - data.height, - data.allFarme, - data.imageList, - data.soundList - ); - core.doAction(); - }); - core.registerEvent("clearanimate", function (data) { - core.plugin.playing.clear(); +var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = +{ + "init": function () { + 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( + data.icon, + data.div, + data.translate[0], + data.translate[1], + data.scale[0], + data.scale[1], + data.angel, + data.px, + data.py + ); + core.doAction(); + }); + core.registerEvent("removeMouse", function (data) { + if (!main.replayChecking && !core.isReplaying()) + core.removeMouse(data.div); + core.doAction(); + }); + core.registerEvent("addPop", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.value = core.replaceText(data.value); + core.addPop( + data.value, + data.px, + data.py, + data.color, + data.boldColor, + data.left, + data.jump, + data.time, + data.show, + data.font, + data.speed + ); + } + core.doAction(); + }); + core.registerEvent("drawWarning", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.text = core.replaceText(data.text); + data.text2 = core.replaceText(data.text2); + core.drawWarning( + data.x, + data.y, + data.size, + data?.text, + data?.text2, + data?.warning + ); + setTimeout(() => core.doAction(), 3100); + } else { + core.doAction(); + } + }); + core.registerEvent("playStereo", function (data) { + if (!main.replayChecking && !core.isReplaying()) + core.playStereo(data.name, data.left, data.right, data.split); + core.doAction(); + }); + core.registerEvent("moveStereo", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + const id = core.playStereo( + data.name, + data.left, + data.right, + data.split + ); + core.moveStereo(id, data.leftTo, data.rightTo, data.time); + } + core.doAction(); + }); + core.registerEvent("over", function (data) { + let image = data.image ?? ""; + let time = data.time ?? 3000; + let sound = data.sound ?? ""; + let textColor = data.textColor ?? "#FFFFFF"; + let boldColor = data.boldColor ?? "#000000"; + let font = data.font ?? "bold 48px Verdana"; + let text = data.text ?? ""; + let hidetime = data.hidetime ?? 100; + if (!main.replayChecking && !core.isReplaying()) { + core.over( + image, + data.memory, + time, + hidetime, + sound, + textColor, + boldColor, + font, + text + ); + } else { + core.doAction(); + } + }); + core.registerEvent("changebg", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.changebg( + data.img1, + data.memory1, + data.img2, + data.memory2, + data.time, + data.style + ); + } else { + core.doAction(); + } + }); + core.registerEvent("overlist", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.overlist( + data.image, + data.memory, + data.hidetime || 30, + data.list || [{ + text: "", + sound: "", + time: 50, + textColor: "#FFFFFF", + boldColor: "#000000", + font: "bold 48px Verdana", + frame: 0, + }, ] + ); + } else { + core.doAction(); + } + }); + core.registerEvent("op", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.openvideo(); + } else { + core.doAction(); + } + }); + core.registerEvent("animationDrawable", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.animationDrawable( + data.allFarme, + data.color, + data.globalAlpha, + data.imageList, + data.soundList + ); + } else { + core.doAction(); + } + }); + core.registerEvent("setanimate", function (data) { + data.px = data.px ?? 0; + data.py = data.py ?? 0; + core.setanimate( + data.name, + data.px, + data.py, + data.width, + data.height, + data.allFarme, + data.imageList, + data.soundList + ); + core.doAction(); + }); + core.registerEvent("clearanimate", function (data) { + core.plugin.playing.clear(); - core.doAction(); - }); - core.registerEvent("deleteanimate", function (data) { - core.deleteanimate(data.name); - core.doAction(); - }); - core.registerEvent("playanimate", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.x = data.x ?? 0; - data.y = data.y ?? 0; - data.scalex = data.scalex ?? 1; - data.scaley = data.scaley ?? 1; - core.playanimate( - data.name, - data.x, - data.y, - data.hero, - data.scalex, - data.scaley - ); - core.doAction(); - } else { - core.doAction(); - } - }); - core.registerEvent("cgtext", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.ui.cgText.image = data.bg; - core.ui.cgText.memory = data.memory; - core.ui.cgText.head = core.clone(data.head); - core.ui.cgText.name = data.name; - core.ui.cgText.text = data.text; - core.ui.cgText.time = data.time; - core.ui.cgText.wait = data.wait; - core.ui.cgText.WindowSkin = data.WindowSkin; - core.ui.cgText.sound = data.sound || ""; - core.ui.cgText.bodyList = core.clone(data.bodyList); - main.dom.cgText.style.display = "block"; - core.ui.cgText.update(); - } else { - 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("deleteanimate", function (data) { + core.deleteanimate(data.name); + core.doAction(); + }); + core.registerEvent("playanimate", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.x = data.x ?? 0; + data.y = data.y ?? 0; + data.scalex = data.scalex ?? 1; + data.scaley = data.scaley ?? 1; + core.playanimate( + data.name, + data.x, + data.y, + data.hero, + data.scalex, + data.scaley + ); + core.doAction(); + } else { + core.doAction(); + } + }); + core.registerEvent("cgtext", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.ui.cgText.image = data.bg; + core.ui.cgText.memory = data.memory; + core.ui.cgText.head = core.clone(data.head); + core.ui.cgText.name = data.name; + core.ui.cgText.text = data.text; + core.ui.cgText.time = data.time; + core.ui.cgText.wait = data.wait; + core.ui.cgText.WindowSkin = data.WindowSkin; + core.ui.cgText.sound = data.sound || ""; + core.ui.cgText.bodyList = core.clone(data.bodyList); + main.dom.cgText.style.display = "block"; + core.ui.cgText.update(); + } else { + 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 () { + 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 () { // 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...) // 【参数说明】 // name:必填,要绘制到的画布名;可以是一个系统画布,或者是个自定义画布;如果不存在则创建 @@ -325,7 +329,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { // 可以在任何地方(如afterXXX或自定义脚本事件)调用函数,方法为 core.plugin.xxx(); }; }, - shop: function () { + "shop": function () { // 【全局商店】相关的功能 // // 打开一个全局商店 @@ -601,7 +605,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { 60 ); }, - removeMap: function () { + "removeMap": function () { // 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。 // 推荐用法: // 对于超高层或分区域塔,当在1区时将2区以后的地图删除;1区结束时恢复2区,进二区时删除1区地图,以此类推 @@ -690,7 +694,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - fiveLayers: function () { + "fiveLayers": function () { // 是否启用五图层(增加背景2层和前景2层) 将__enable置为true即会启用;启用后请保存后刷新编辑器 // 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层 // 另外 请注意加入两个新图层 会让大地图的性能降低一些 @@ -892,7 +896,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }; }; }, - itemShop: function () { + "itemShop": function () { // 道具商店相关的插件 // 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找) @@ -1294,7 +1298,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ]); }; }, - enemyLevel: function () { + "enemyLevel": function () { // 此插件将提供怪物手册中的怪物境界显示 // 使用此插件需要先给每个怪物定义境界,方法如下: // 点击怪物的【配置表格】,找到“【怪物】相关的表格配置”,然后在【名称】仿照增加境界定义: @@ -1462,7 +1466,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ); }; }, - multiHeros: function () { + "multiHeros": function () { // 多角色插件 // Step 1: 启用本插件 // Step 2: 定义每个新的角色各项初始数据(参见下方注释) @@ -1616,7 +1620,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.setFlag("heroId", toHeroId); // 保存切换到的角色ID }; }, - heroFourFrames: function () { + "heroFourFrames": function () { // 样板的勇士/跟随者移动时只使用2、4两帧,观感较差。本插件可以将四帧全用上。 // 是否启用本插件 @@ -1679,7 +1683,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return false; }; }, - routeFixing: function () { + "routeFixing": function () { // 是否开启本插件,true 表示启用,false 表示禁用。 var __enable = true; if (!__enable) return; @@ -1803,7 +1807,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { 100 ); }, - numpad: function () { + "numpad": function () { // 样板自带的整数输入事件为白屏弹窗且可以误输入任意非法内容但不支持负整数,观感较差。本插件可以将其美化成仿RM样式,使其支持负整数同时带有音效 // 另一方面,4399等第三方平台不允许使用包括 core.myprompt() 和 core.myconfirm() 在内的弹窗,因此也需要此插件来替代,不然类似生命魔杖的道具就不好实现了 // 关于负整数输入,V2.8.2原生支持其录像的压缩和解压,只是默认的 core.events._action_input() 函数将负数取了绝对值,可以只复写下面的 core.isReplaying() 部分来取消 @@ -2060,7 +2064,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - sprites: function () { + "sprites": function () { // 基于canvas的sprite化,摘编整理自万宁魔塔 // // ---------------------------------------- 第一部分 js代码 (必装) --------------------------------------- // @@ -2264,7 +2268,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { window.Sprite = Sprite; }, - hotReload: function () { + "hotReload": function () { /* ---------- 功能说明 ---------- * 1. 当 libs/ main.js index.html 中的任意一个文件被更改后,会自动刷新塔的页面 @@ -2521,7 +2525,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } })(); }, - statusBar: function () { + "statusBar": function () { main.dom.floorMsgGroup.style.display = "none"; main.dom.statusBar.style.display = "none"; main.dom.toolBar.style.display = "none"; @@ -3726,7 +3730,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }; // init() called in `afterLoadResources`. }, - override: function () { + "override": function () { core.statusBar.icons = { floor: 0, name: null, @@ -4076,7 +4080,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ctx.fillText(text, x, y); }; }, - 额外信息: function () { + "额外信息": function () { /* 宝石血瓶左下角显示数值 * 注意!!!不要在道具属性中直接操作flags,使用core.status.hero.flags或core.setFlag系列函数代替! * 需要将 变量:itemDetail改为true才可正常运行 @@ -4233,7 +4237,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } } }, - 编辑器显伤: function () { + "编辑器显伤": function () { // 在此增加新插件 /////// 用户设置 /////// // 将__enable置为false将关闭插件 @@ -4507,7 +4511,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 手册区分特殊属性: function () { + "手册区分特殊属性": function () { // 在此增加新插件 this.arrsame = function (Arraya, Arrayb) { let a = Arraya || []; @@ -4859,7 +4863,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return [enemy, texts]; }; }, - 一防减伤: function () { + "一防减伤": function () { // 在此增加新插件 ui.prototype._drawBook_drawRow3 = function ( index, @@ -4933,7 +4937,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return this.getDefDamage(enemy, null, x, y, floorId); }; }, - "新道具栏/装备栏": function () { + "新道具栏/装备栏": function () { // 在此增加新插件 // 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局 // 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改 @@ -6370,7 +6374,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.registerReplayAction("equip", core.control._replayAction_equip); core.registerReplayAction("unEquip", core.control._replayAction_unEquip); }, - 技能树: function () { + "技能树": function () { // 在此增加新插件 // // 已学习的技能等级 flags._hasSkill_ @@ -7172,7 +7176,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }; core.registerReplayAction("skill", control.prototype._replayAction_skill); }, - animate: function () { + "animate": function () { // -------------------- 插件说明 -------------------- // // github仓库:https://github.com/unanmed/animate @@ -8046,7 +8050,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { inverseTrigo: N, }; }, - func: function () { + "func": function () { // 功能函数集,具体有哪些函数看每个函数前的注释即可 // 安装方式:直接复制到插件里面,注意新建插件自带的 function () { } 不能删 // 使用方式:可以直接使用对象解构按需引入 @@ -8486,7 +8490,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 音频系统: function () { + "音频系统": function () { // 在此增加新插件 /*首先,在造塔群下载所需的库文件,然后放置在塔目录下的 libs/thirdparty 或其他目录下,之后在 index.html 的最后加上下面这几行: @@ -10597,7 +10601,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.ui._drawSwitchs_sounds(); }; }, - 怪物碎裂特效: function () { + "怪物碎裂特效": function () { // 在此增加新插件 // -------------------- 安装说明 -------------------- // // 先安装两个在插件简介中说明的前置插件 @@ -10842,7 +10846,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { applyFragWith, }; }, - 自定义常用事件: function () { + "自定义常用事件": function () { // editorBlocklyconfigPlus.js // 自訂常見事件模板插件 // 本插件引用了通用函數插件(Utility.js) @@ -12131,7 +12135,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { .split("// end mark sfergsvae")[0]; } }, - 夹击激光动画: function () { + "夹击激光动画": function () { function createCanvas(name, zIndex) { if (!name) return; var canvas = document.createElement("canvas"); @@ -12362,7 +12366,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 瞬移轨迹: function () { + "瞬移轨迹": function () { // 在此增加新插件 function popMove() { var ctx = core.getContextByName("popMove"); @@ -12438,7 +12442,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - "墓碑(编辑器)": function () { + "墓碑(编辑器)": function () { // 在此增加新插件 if (main.mode != "editor") return; // 编辑器模式下使用 var mapData = null; @@ -12509,7 +12513,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.setAlpha("event2", alpha); }; }, - 小地图: function () { + "小地图": function () { // 在此增加新插件 // ----- 不可自定义 杂七杂八的变量 /** @type {{[x: string]: BFSResult}} */ @@ -12928,7 +12932,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 楼传: function () { + "楼传": function () { // 在此增加新插件 core.canMoveFloor = function () { @@ -14036,7 +14040,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { 0 ); }, - CG回廊: function () { + "CG回廊": function () { // 在此增加新插件 const CGUI = document.createElement("canvas"); //CGui画布设置 CGUI.style.position = "absolute"; @@ -14539,7 +14543,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { main.core.ui.CG.update(); }; }, - 光标设置: function () { + "光标设置": function () { // 在此增加新插件 this.changeMouse = function ( icon, @@ -14576,7 +14580,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.dom[div].style.cursor = "auto"; }; }, - 信息弹出: function () { + "信息弹出": function () { // 在此增加新插件 /* 弹出显示某个内容 * 使用方法:core.addPop(px, py, value, color, boldColor, left, jump, time, show, font, speed) @@ -14683,7 +14687,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { else core.status.pop.push(data); }; }, - warning: function () { + "warning": function () { // 在此增加新插件 // 默认音效名 var defaultSound = "jingbao.opus"; @@ -14746,7 +14750,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 1600); }; }, - 立体声音效: function () { + "立体声音效": function () { // 在此增加新插件 // 音效双声道播放 var can = true; @@ -14850,7 +14854,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 10); }; }, - 滑动转场: function () { + "滑动转场": function () { // 在此增加新插件 const defaultChange = { left: "leftPortal", // 左箭头 @@ -15040,7 +15044,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 25); }; }, - 剧情cg: function () { + "剧情cg": function () { // 在此增加新插件 const cg = document.createElement("canvas"); //cg画布设置 cg.style.position = "absolute"; @@ -15569,7 +15573,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } core.ui.cgText = new cgText(); }, - 旁白: function () { + "旁白": function () { // 在此增加新插件 const over = document.createElement("canvas"); //over画布设置 over.style.position = "absolute"; @@ -16059,7 +16063,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 回合制boss战: function () { + "回合制boss战": function () { // 在此增加新插件 const boss = document.createElement("canvas"); //boss战画布设置 boss.style.position = "absolute"; @@ -16107,7 +16111,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } core.ui.boss = new boss1(); }, - 剧情视频引用: function () { + "剧情视频引用": function () { // 在此增加新插件 let a; let bgm; @@ -16291,7 +16295,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - "帧动画/图片叠拼": function () { + "帧动画/图片叠拼": function () { // 在此增加新插件 this.animationDrawable = function ( allFarme, @@ -16413,1042 +16417,1135 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ); }; }, - musicMode: function () { - // 在此增加新插件 - const music = document.createElement("canvas"); - music.style.position = "absolute"; - music.style.zIndex = 300; - music.style.display = "none"; - music.id = "music"; - main.dom.gameGroup.insertAdjacentElement("afterend", music); - music.style.top = "50%"; - music.style.left = "50%"; - music.style.transform = "translate(-50%,-50%)"; - const ctx = music.getContext("2d"); - main.dom.music = music; - - const audio = core.plugin.audioSystem.bgmController; - - let page = 0; //初始页面 - - let isvolume = false; - - function shuffle(arr) { - let n = arr.length, - random; - while (n) { - random = (Math.random() * n--) >>> 0; - [arr[n], arr[random]] = [arr[random], arr[n]]; - } - return arr; - } - music.addEventListener("mousedown", function (e) { - e.stopPropagation(); - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor((e.clientX - left) / core.domStyle.scale), - py = Math.floor((e.clientY - top) / core.domStyle.scale); - core.ui.music.mousedown(px * 3, py * 3); - }); - music.addEventListener("mousemove", function (e) { - e.stopPropagation(); - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor((e.clientX - left) / core.domStyle.scale), - py = Math.floor((e.clientY - top) / core.domStyle.scale); - core.ui.music.mousemove(px * 3, py * 3); - }); - music.addEventListener("mouseup", function (e) { - e.stopPropagation(); - - isvolume = false; - }); - music.addEventListener("mouseleave", function (e) { - e.stopPropagation(); - - isvolume = false; - }); - music.addEventListener("touchstart", function (e) { - e.preventDefault(); - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor( - (e.touches[0].clientX - left) / core.domStyle.scale - ), - py = Math.floor((e.touches[0].clientY - top) / core.domStyle.scale); - core.ui.music.mousedown(px * 3, py * 3); - }); - music.addEventListener("touchmove", function (e) { - e.stopPropagation(); - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor( - (e.touches[0].clientX - left) / core.domStyle.scale - ), - py = Math.floor((e.touches[0].clientY - top) / core.domStyle.scale); - core.ui.music.mousemove(px * 3, py * 3); - }); - music.addEventListener("touchend", function (e) { - e.stopPropagation(); - - isvolume = false; - }); - music.addEventListener("touchcancel", function (e) { - e.stopPropagation(); - - isvolume = false; - }); - - class musicclass { - constructor() { - this.musics = ["theme.mp3"]; - //music列表 - //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 - this.musicMx = [ - [ - "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 (Full.ver)", - "Blind_Alley.opus": "Blind Alley", - "Crawler.opus": "Crawler", - "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; - this.type = "xunhuan"; - this.randomList = []; - this.random = 0; - } - - //更新 - update() { - this.background(); - this.drawUI(); - } - background() { - //画布大小设置 - if (core.domStyle.isVertical) { - music.width = 1248; - music.height = 2028; - } else { - music.width = 2028; - music.height = 1248; - } - } - mousedown(px, py) { - //鼠标按下时 - - const makeBox = ([x, y], [w, h]) => { - return [ - [x, y], - [x + w, y + h], - ]; - }; - const inRect = ([x, y], [[sx, sy], [dx, dy]]) => { - return sx <= x && x <= dx && sy <= y && y <= dy; - }; - const pos = [px, py]; - const backbox = makeBox([15, 35], [210, 90]); - if (inRect(pos, backbox)) { - //离开按钮是一致的,其余的记区分横竖屏 - music.style.display = "none"; - core.clearMap(ctx); - - core.unregisterAnimationFrame("music"); - core.restart(); - - return; - } - if (core.domStyle.isVertical) { - //竖屏 - - const pageupbox = makeBox([100, 1230], [200, 100]); - const pagedownbox = makeBox([950, 1230], [200, 100]); - const musicbox = makeBox( - [100, 200], - [1048, this.musicMx[page].length * 100] - ); - 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; - return; - } - if (inRect(pos, pagedownbox)) { - if (page !== this.musicMx.length - 1) page += 1; - return; - } - if (inRect(pos, playbox)) { - if (this.stop) { - this.stop = !this.stop; - - core.resumeBgm(); - } else { - this.stop = !this.stop; - core.pauseBgm(); - } - return; - } - if (inRect(pos, beforebox)) { - this.stop = false; - switch (this.type) { - case "danqu": - 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": - 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[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; - } - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); - - break; - case "suiji": - 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; - } - return; - } - if (inRect(pos, afterbox)) { - this.stop = false; - switch (this.type) { - case "danqu": - 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": - 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[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; - } - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); - - break; - case "suiji": - 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]; - 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; - } - return; - } - if (inRect(pos, typebox)) { - switch (this.type) { - case "danqu": - this.type = "xunhuan"; - break; - case "xunhuan": - this.type = "suiji"; - break; - case "suiji": - this.type = "danqu"; - break; - } - return; - } - if (inRect(pos, musicbox)) { - const index = Math.floor((py - 200) / 100); - if (page !== this.selection[0] || index !== 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( - 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; - } - } else { - if (this.stop) { - this.stop = !this.stop; - core.resumeBgm(); - } else { - this.stop = !this.stop; - core.pauseBgm(); - } - } - return; - } - - 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 { - //横屏 - const pageupbox = makeBox([1050, 1100], [200, 100]); - const pagedownbox = makeBox([1550, 1100], [200, 100]); - const musicbox = makeBox( - [900, 100], - [1000, this.musicMx[page].length * 100] - ); - 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; - return; - } - if (inRect(pos, pagedownbox)) { - if (page !== this.musicMx.length - 1) page += 1; - return; - } - if (inRect(pos, playbox)) { - if (this.stop) { - this.stop = !this.stop; - core.resumeBgm(); - } else { - this.stop = !this.stop; - core.pauseBgm(); - } - return; - } - if (inRect(pos, beforebox)) { - this.stop = false; - switch (this.type) { - case "danqu": - 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": - 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[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; - } - core.playBgm( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); - - break; - case "suiji": - 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; - } - return; - } - if (inRect(pos, afterbox)) { - this.stop = false; - switch (this.type) { - case "danqu": - 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": - 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[1] += 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": - 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; - } - return; - } - if (inRect(pos, typebox)) { - switch (this.type) { - case "danqu": - this.type = "xunhuan"; - break; - case "xunhuan": - this.type = "suiji"; - break; - case "suiji": - this.type = "danqu"; - break; - } - return; - } - if (inRect(pos, musicbox)) { - const index = Math.floor((py - 100) / 100); - if (page !== this.selection[0] || index !== 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; - } - } else { - if (this.stop) { - this.stop = !this.stop; - core.resumeBgm(); - } else { - this.stop = !this.stop; - core.pauseBgm(); - } - } - return; - } - - 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) { - 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); - } - } - } - - drawUI() { - //绘制页面 - core.clearMap(music); - const bgVertical = core.material.images.images["bg_2010.webp"]; //竖屏背景 - const bg = core.material.images.images["bg_5043.webp"]; //竖屏背景 - if (core.domStyle.isVertical) { - //竖屏 - - core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 - ctx.globalAlpha = 0.3; //透明度 - if (bgVertical) - ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 - - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - "◀离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - - ctx.strokeStyle = "#FFFFFF"; - ctx.lineWidth = 3; - ctx.beginPath(); - ctx.moveTo(100, 200); - ctx.lineTo(1148, 200); - - ctx.stroke(); - let posy = 300; - const indexList = this.musicMx[page]; - core.setTextAlign(ctx, "left"); - for (let i = 0; i < indexList.length; i++) { - const text = this.musicname[indexList[i]]; - 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(); - ctx.moveTo(100, 1210); - ctx.lineTo(1148, 1210); - ctx.moveTo(100, 1200); - ctx.lineTo(1148, 1200); - ctx.stroke(); - - core.fillBoldText1( - ctx, - "上一页", - 100, - 1300, - page === 0 ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - - core.fillBoldText1( - ctx, - page + 1 + "/" + this.musicMx.length, - 580, - 1300, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - core.fillBoldText1( - ctx, - "下一页", - 950, - 1300, - page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 3; - - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 96px Verdana"; - ctx.fillText("|", 100, 1697); - ctx.fillText("◀", 115, 1700); - ctx.beginPath(); - ctx.arc(505, 1670, 80, 0, 3 * Math.PI); - ctx.stroke(); - ctx.fillText("|", 835, 1697); - ctx.fillText("▶", 785, 1700); - if (this.stop) { - ctx.fillText("▶", 473, 1697); - } else { - ctx.fillText("||", 453, 1694); - } - - const img = core.material.images.images[this.type + ".webp"]; - if (img) ctx.drawImage(img, 1000, 1555, 200, 200); - core.setTextAlign(ctx, "center"); - ctx.font = "bold 52px Verdana"; - ctx.fillText("当前歌曲", 625, 1397); - ctx.fillText( - this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], - 625, - 1507 - ); - - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 48px Verdana"; - ctx.fillText("音量", 150, 1970); - ctx.lineWidth = 3; - ctx.beginPath(); - ctx.moveTo(250, 1950); - ctx.lineTo(1050, 1950); - ctx.stroke(); - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 9; - ctx.fillStyle = "rgba(255,255,255,0.5)"; - - ctx.beginPath(); - ctx.moveTo(250, 1950); - ctx.lineTo(800 * audio.getVolume() + 250, 1950); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(800 * audio.getVolume() + 250, 1950, 10, 0, 2 * Math.PI); - ctx.fill(); - core.fillBoldText1( - ctx, - Math.floor(100 * audio.getVolume()), - 1120, - 1970, - "#FFFFFF", - "#000000", - 6, - 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); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 - core.setTextAlign(ctx, "center"); - - core.fillBoldText1( - ctx, - "◀离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - - ctx.strokeStyle = "#FFFFFF"; - ctx.lineWidth = 3; - ctx.beginPath(); - ctx.moveTo(800, 100); - ctx.lineTo(800, 1148); - ctx.moveTo(900, 100); - ctx.lineTo(1900, 100); - ctx.stroke(); - let posy = 200; - const indexList = this.musicMx[page]; - core.setTextAlign(ctx, "left"); - for (let i = 0; i < indexList.length; i++) { - const text = this.musicname[indexList[i]]; - 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( - ctx, - "上一页", - 1050, - 1200 - 30, - page === 0 ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - - core.fillBoldText1( - ctx, - page + 1 + "/" + this.musicMx.length, - 1350, - 1200 - 30, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - core.fillBoldText1( - ctx, - "下一页", - 1550, - 1200 - 30, - page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 3; - - ctx.fillStyle = "#ffffff"; - ctx.font = "bold 96px Verdana"; - ctx.fillText("|", 60, 697); - ctx.fillText("◀", 70, 700); - ctx.beginPath(); - ctx.arc(295, 670, 80, 0, 2 * Math.PI); - ctx.stroke(); - if (this.stop) { - ctx.fillText("▶", 245, 697); - } else { - ctx.fillText("||", 245, 694); - } - - ctx.fillText("|", 490, 697); - ctx.fillText("▶", 450, 700); - ctx.font = "bold 48px Verdana"; - ctx.fillText("音量", 350, 900); - ctx.beginPath(); - ctx.moveTo(100, 1000); - ctx.lineTo(700, 1000); - ctx.stroke(); - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 9; - ctx.fillStyle = "rgba(255,255,255,0.5)"; - - ctx.beginPath(); - ctx.moveTo(100, 1000); - ctx.lineTo(600 * audio.getVolume() + 100, 1000); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(600 * audio.getVolume() + 100, 1000, 10, 0, 2 * Math.PI); - ctx.fill(); - core.fillBoldText1( - ctx, - Math.floor(100 * audio.getVolume()), - 720, - 1010, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(56, true) - ); - const img = core.material.images.images[this.type + ".webp"]; - if (img) ctx.drawImage(img, 580, 560, 200, 200); - core.setTextAlign(ctx, "center"); - ctx.font = "bold 48px Verdana"; - ctx.fillText("当前歌曲", 400, 297); - ctx.fillText( - this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], - 400, - 397 - ); - } - } - } - 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] - ] - ); - - const arr = main.core.ui.music.musicMx.flat(Infinity); - main.core.ui.music.randomList = shuffle(arr); - main.core.ui.music.random = main.core.ui.music.randomList.indexOf( - main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ - main.core.ui.music.selection[1] - ] - ); - page = 0; - music.style.display = "block"; - let time = 0; - core.registerAnimationFrame("music", null, (temptime) => { - 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 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) { - if (core.domStyle.isVertical) { - core.ui.music.mousedown(830, 1770); - } else { - core.ui.music.mousedown(475, 765); - } - } - } - }); - }; - }, - 横屏切换: function () { + "musicMode": function () { + // 在此增加新插件 + const music = document.createElement("canvas"); + music.style.position = "absolute"; + music.style.zIndex = 300; + music.style.display = "none"; + music.id = "music"; + main.dom.gameGroup.insertAdjacentElement("afterend", music); + music.style.top = "50%"; + music.style.left = "50%"; + music.style.transform = "translate(-50%,-50%)"; + const ctx = music.getContext("2d"); + main.dom.music = music; + + const audio = core.plugin.audioSystem.bgmController; + + let page = 0; //初始页面 + + let isvolume = false; + + function shuffle(arr) { + let n = arr.length, + random; + while (n) { + random = (Math.random() * n--) >>> 0; + [arr[n], arr[random]] = [arr[random], arr[n]]; + } + return arr; + } + music.addEventListener("mousedown", function (e) { + e.stopPropagation(); + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor((e.clientX - left) / core.domStyle.scale), + py = Math.floor((e.clientY - top) / core.domStyle.scale); + core.ui.music.mousedown(px * 3, py * 3); + }); + music.addEventListener("mousemove", function (e) { + e.stopPropagation(); + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor((e.clientX - left) / core.domStyle.scale), + py = Math.floor((e.clientY - top) / core.domStyle.scale); + core.ui.music.mousemove(px * 3, py * 3); + }); + music.addEventListener("mouseup", function (e) { + e.stopPropagation(); + + isvolume = false; + }); + music.addEventListener("mouseleave", function (e) { + e.stopPropagation(); + + isvolume = false; + }); + music.addEventListener("touchstart", function (e) { + e.preventDefault(); + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor( + (e.touches[0].clientX - left) / core.domStyle.scale + ), + py = Math.floor((e.touches[0].clientY - top) / core.domStyle.scale); + core.ui.music.mousedown(px * 3, py * 3); + }); + music.addEventListener("touchmove", function (e) { + e.stopPropagation(); + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor( + (e.touches[0].clientX - left) / core.domStyle.scale + ), + py = Math.floor((e.touches[0].clientY - top) / core.domStyle.scale); + core.ui.music.mousemove(px * 3, py * 3); + }); + music.addEventListener("touchend", function (e) { + e.stopPropagation(); + + isvolume = false; + }); + music.addEventListener("touchcancel", function (e) { + e.stopPropagation(); + + isvolume = false; + }); + + class musicclass { + constructor() { + this.musics = ["theme.mp3"]; + //music列表 + //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 + this.musicMx = [ + [ + "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 (Full.ver)", + "Blind_Alley.opus": "Blind Alley", + "Crawler.opus": "Crawler", + "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; + this.type = "xunhuan"; + this.randomList = []; + this.random = 0; + } + + //更新 + update() { + this.background(); + this.drawUI(); + } + background() { + //画布大小设置 + if (core.domStyle.isVertical) { + music.width = 1248; + music.height = 2028; + } else { + music.width = 2028; + music.height = 1248; + } + } + mousedown(px, py) { + //鼠标按下时 + + const makeBox = ([x, y], [w, h]) => { + return [ + [x, y], + [x + w, y + h], + ]; + }; + const inRect = ([x, y], [ + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + const pos = [px, py]; + const backbox = makeBox([15, 35], [210, 90]); + if (inRect(pos, backbox)) { + //离开按钮是一致的,其余的记区分横竖屏 + music.style.display = "none"; + core.clearMap(ctx); + + core.unregisterAnimationFrame("music"); + core.restart(); + + return; + } + if (core.domStyle.isVertical) { + //竖屏 + + const pageupbox = makeBox([100, 1230], [200, 100]); + const pagedownbox = makeBox([950, 1230], [200, 100]); + const musicbox = makeBox( + [100, 200], + [1048, this.musicMx[page].length * 100] + ); + 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; + return; + } + if (inRect(pos, pagedownbox)) { + if (page !== this.musicMx.length - 1) page += 1; + return; + } + if (inRect(pos, playbox)) { + if (this.stop) { + this.stop = !this.stop; + + core.resumeBgm(); + } else { + this.stop = !this.stop; + core.pauseBgm(); + } + return; + } + if (inRect(pos, beforebox)) { + this.stop = false; + switch (this.type) { + case "danqu": + 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": + 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[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; + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + + break; + case "suiji": + 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; + } + return; + } + if (inRect(pos, afterbox)) { + this.stop = false; + switch (this.type) { + case "danqu": + 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": + 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[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; + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + + break; + case "suiji": + 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]; + 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; + } + return; + } + if (inRect(pos, typebox)) { + switch (this.type) { + case "danqu": + this.type = "xunhuan"; + break; + case "xunhuan": + this.type = "suiji"; + break; + case "suiji": + this.type = "danqu"; + break; + } + return; + } + if (inRect(pos, musicbox)) { + const index = Math.floor((py - 200) / 100); + if (page !== this.selection[0] || index !== 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( + 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; + } + } else { + if (this.stop) { + this.stop = !this.stop; + core.resumeBgm(); + } else { + this.stop = !this.stop; + core.pauseBgm(); + } + } + return; + } + + 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 { + //横屏 + const pageupbox = makeBox([1050, 1100], [200, 100]); + const pagedownbox = makeBox([1550, 1100], [200, 100]); + const musicbox = makeBox( + [900, 100], + [1000, this.musicMx[page].length * 100] + ); + 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; + return; + } + if (inRect(pos, pagedownbox)) { + if (page !== this.musicMx.length - 1) page += 1; + return; + } + if (inRect(pos, playbox)) { + if (this.stop) { + this.stop = !this.stop; + core.resumeBgm(); + } else { + this.stop = !this.stop; + core.pauseBgm(); + } + return; + } + if (inRect(pos, beforebox)) { + this.stop = false; + switch (this.type) { + case "danqu": + 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": + 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[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; + } + core.playBgm( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + + break; + case "suiji": + 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; + } + return; + } + if (inRect(pos, afterbox)) { + this.stop = false; + switch (this.type) { + case "danqu": + 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": + 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[1] += 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": + 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; + } + return; + } + if (inRect(pos, typebox)) { + switch (this.type) { + case "danqu": + this.type = "xunhuan"; + break; + case "xunhuan": + this.type = "suiji"; + break; + case "suiji": + this.type = "danqu"; + break; + } + return; + } + if (inRect(pos, musicbox)) { + const index = Math.floor((py - 100) / 100); + if (page !== this.selection[0] || index !== 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; + } + } else { + if (this.stop) { + this.stop = !this.stop; + core.resumeBgm(); + } else { + this.stop = !this.stop; + core.pauseBgm(); + } + } + return; + } + + 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) { + 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); + } + } + } + + drawUI() { + //绘制页面 + core.clearMap(music); + const bgVertical = core.material.images.images["bg_2010.webp"]; //竖屏背景 + const bg = core.material.images.images["bg_5043.webp"]; //竖屏背景 + if (core.domStyle.isVertical) { + //竖屏 + + core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 + ctx.globalAlpha = 0.3; //透明度 + if (bgVertical) + ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 + ctx.globalAlpha = 1; //恢复为不透明 + + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + "◀离开", + 110, + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + + ctx.strokeStyle = "#FFFFFF"; + ctx.lineWidth = 3; + ctx.beginPath(); + ctx.moveTo(100, 200); + ctx.lineTo(1148, 200); + + ctx.stroke(); + let posy = 300; + const indexList = this.musicMx[page]; + core.setTextAlign(ctx, "left"); + for (let i = 0; i < indexList.length; i++) { + const text = this.musicname[indexList[i]]; + 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(); + ctx.moveTo(100, 1210); + ctx.lineTo(1148, 1210); + ctx.moveTo(100, 1200); + ctx.lineTo(1148, 1200); + ctx.stroke(); + + core.fillBoldText1( + ctx, + "上一页", + 100, + 1300, + page === 0 ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + + core.fillBoldText1( + ctx, + page + 1 + "/" + this.musicMx.length, + 580, + 1300, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + core.fillBoldText1( + ctx, + "下一页", + 950, + 1300, + page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 3; + + + 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(); + 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) { + core.fillText( + ctx, + "▶", + 473, + 1700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + + } else { + + core.fillText( + ctx, + "||", + 453, + 1700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + } + + const img = core.material.images.images[this.type + ".webp"]; + if (img) ctx.drawImage(img, 1000, 1555, 200, 200); + core.setTextAlign(ctx, "center"); + ctx.font = "bold 52px Verdana"; + ctx.fillText("当前歌曲", 625, 1397); + ctx.fillText( + this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], + 625, + 1507 + ); + + ctx.fillStyle = "#ffffff"; + ctx.font = "bold 48px Verdana"; + ctx.fillText("音量", 150, 1970); + ctx.lineWidth = 3; + ctx.beginPath(); + ctx.moveTo(250, 1950); + ctx.lineTo(1050, 1950); + ctx.stroke(); + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 9; + ctx.fillStyle = "rgba(255,255,255,0.5)"; + + ctx.beginPath(); + ctx.moveTo(250, 1950); + ctx.lineTo(800 * audio.getVolume() + 250, 1950); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(800 * audio.getVolume() + 250, 1950, 10, 0, 2 * Math.PI); + ctx.fill(); + core.fillBoldText1( + ctx, + Math.floor(100 * audio.getVolume()), + 1120, + 1970, + "#FFFFFF", + "#000000", + 6, + 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); //绘制半透明背景图片 + ctx.globalAlpha = 1; //恢复为不透明 + core.setTextAlign(ctx, "center"); + + core.fillBoldText1( + ctx, + "◀离开", + 110, + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + + ctx.strokeStyle = "#FFFFFF"; + ctx.lineWidth = 3; + ctx.beginPath(); + ctx.moveTo(800, 100); + ctx.lineTo(800, 1148); + ctx.moveTo(900, 100); + ctx.lineTo(1900, 100); + ctx.stroke(); + let posy = 200; + const indexList = this.musicMx[page]; + core.setTextAlign(ctx, "left"); + for (let i = 0; i < indexList.length; i++) { + const text = this.musicname[indexList[i]]; + 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( + ctx, + "上一页", + 1050, + 1200 - 30, + page === 0 ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + + core.fillBoldText1( + ctx, + page + 1 + "/" + this.musicMx.length, + 1350, + 1200 - 30, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + core.fillBoldText1( + ctx, + "下一页", + 1550, + 1200 - 30, + page === this.musicMx.length - 1 ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 3; + + 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) { + core.fillText( + ctx, + "▶", + 265, + 700, + "#FFFFFF", + core.ui._buildFont(96, true) + ); + + } else { + 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.font = "bold 48px Verdana"; + ctx.fillText("音量", 350, 900); + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(700, 1000); + ctx.stroke(); + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 9; + ctx.fillStyle = "rgba(255,255,255,0.5)"; + + ctx.beginPath(); + ctx.moveTo(100, 1000); + ctx.lineTo(600 * audio.getVolume() + 100, 1000); + ctx.stroke(); + ctx.beginPath(); + ctx.arc(600 * audio.getVolume() + 100, 1000, 10, 0, 2 * Math.PI); + ctx.fill(); + core.fillBoldText1( + ctx, + Math.floor(100 * audio.getVolume()), + 720, + 1010, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(56, true) + ); + const img = core.material.images.images[this.type + ".webp"]; + if (img) ctx.drawImage(img, 580, 560, 200, 200); + core.setTextAlign(ctx, "center"); + ctx.font = "bold 48px Verdana"; + ctx.fillText("当前歌曲", 400, 297); + ctx.fillText( + this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], + 400, + 397 + ); + } + } + } + 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] + ] + ); + + const arr = main.core.ui.music.musicMx.flat(Infinity); + main.core.ui.music.randomList = shuffle(arr); + main.core.ui.music.random = main.core.ui.music.randomList.indexOf( + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][ + main.core.ui.music.selection[1] + ] + ); + page = 0; + music.style.display = "block"; + let time = 0; + core.registerAnimationFrame("music", null, (temptime) => { + 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 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) { + if (core.domStyle.isVertical) { + core.ui.music.mousedown(830, 1770); + } else { + core.ui.music.mousedown(475, 765); + } + } + } + }); + }; +}, + "横屏切换": function () { // 在此增加新插件 this.triggerFullscreen = async function (full) { if (!!document.fullscreenElement && !full) { @@ -17486,7 +17583,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 图片压缩webp导出: function () { + "图片压缩webp导出": function () { // 在此增加新插件 //使用方法:进入游戏后开始游戏,F12打开控制台,输入core.towebp(image),image为已在全塔属性中注册过的图片名字,需要""括起来 this.towebp = function (image) { @@ -17517,7 +17614,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - "帧动画特效(游戏界面)": function () { + "帧动画特效(游戏界面)": function () { // 在此增加新插件 const animate2 = document.createElement("canvas"); //画布设置 animate2.style.zIndex = 71; @@ -17713,7 +17810,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }); }, - "intro&loop": function () { + "intro&loop": function () { // 在此增加新插件 this.introAndLoop = function (intro, time, loop) { core.playBgm(intro); @@ -17722,4 +17819,240 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 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'); + } +} +} \ No newline at end of file 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; +}