diff --git a/_saves/Eustia_autoSave b/_saves/Eustia_autoSave index f31acdb..b68992a 100644 --- a/_saves/Eustia_autoSave +++ b/_saves/Eustia_autoSave @@ -1 +1 @@ -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= \ No newline at end of file diff --git a/project/data.js b/project/data.js index 5999829..8a8ee74 100644 --- a/project/data.js +++ b/project/data.js @@ -54,6 +54,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "bg_6004.webp", "cao.webp", "d.webp", + "danqu.webp", "dl.webp", "dlr.webp", "dr.webp", @@ -172,6 +173,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "other_0004.webp", "r.webp", "status.webp", + "suiji.webp", "tati_020101.webp", "tati_020101a.webp", "tati_020101y.webp", @@ -265,7 +267,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "winbackground.webp", "winbackgroundVertical.webp", "winskin.webp", - "winskin1.webp" + "winskin1.webp", + "xunhuan.webp" ], "tilesets": [ "magictower.webp", diff --git a/project/images/danqu.webp b/project/images/danqu.webp new file mode 100644 index 0000000..f38b54f Binary files /dev/null and b/project/images/danqu.webp differ diff --git a/project/images/suiji.webp b/project/images/suiji.webp new file mode 100644 index 0000000..34b2a06 Binary files /dev/null and b/project/images/suiji.webp differ diff --git a/project/images/xunhuan.webp b/project/images/xunhuan.webp new file mode 100644 index 0000000..a588af0 Binary files /dev/null and b/project/images/xunhuan.webp differ diff --git a/project/plugins.js b/project/plugins.js index 513270c..9856fd0 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -11792,526 +11792,491 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); }, "CG回廊": function () { - // 在此增加新插件 - const CGUI = document.createElement("canvas"); //CGui画布设置 - CGUI.style.position = "absolute"; - CGUI.style.zIndex = 300; - CGUI.style.display = "none"; - CGUI.id = "CGUI"; - main.dom.gameGroup.insertAdjacentElement("afterend", CGUI); - CGUI.style.top = "50%"; - CGUI.style.left = "50%"; - CGUI.style.transform = "translate(-50%,-50%)"; - const ctx = CGUI.getContext("2d"); - main.dom.CGUI = CGUI; - let page = 0; //初始页面 - let show = false; //展示状态 - CGUI.onclick = function (e) { - try { - e.preventDefault(); - if (core.isPlaying()) return false; - 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.CG.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; + // 在此增加新插件 + const CGUI = document.createElement("canvas"); //CGui画布设置 + CGUI.style.position = "absolute"; + CGUI.style.zIndex = 300; + CGUI.style.display = "none"; + CGUI.id = "CGUI"; + main.dom.gameGroup.insertAdjacentElement("afterend", CGUI); + CGUI.style.top = "50%"; + CGUI.style.left = "50%"; + CGUI.style.transform = "translate(-50%,-50%)"; + const ctx = CGUI.getContext("2d"); + main.dom.CGUI = CGUI; + let page = 0; //初始页面 + let show = false; //展示状态 + CGUI.onclick = function (e) { + try { + e.preventDefault(); + if (core.isPlaying()) return false; + 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.CG.onclick(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; - class CG { - constructor() { - //cg列表 - this.UIMx = [ - //空位用‘none’填充,当前ui至多4列6行 - [ - ["eve_010102.webp", "eve_010203.webp", "eve_010304.webp"], - ["eve_010501.webp", "eve_010601.webp", "eve_010701.webp"], - ], - [ - ["eve_010801.webp", "eve_010902.webp", "eve_011001.webp"], - ["eve_011101.webp", "eve_011202.webp", "eve_011302.webp"], - ], - [ - ["eve_011402.webp", "eve_020102.webp", "eve_020201.webp"], - ["eve_020301.webp", "eve_020401.webp", "eve_020501.webp"], - ], - [ - ["eve_020605.webp", "eve_020701.webp", "eve_020801.webp"], - ["eve_030101.webp", "eve_030206.webp", "eve_030302.webp"], - ], - [ - ["eve_030508.webp", "eve_030601.webp", "eve_030801.webp"], - ["eve_030901.webp", "eve_031002.webp", "eve_031101.webp"], - ], - [ - ["eve_040201.webp", "eve_040401.webp", "eve_040501.webp"], - ["eve_040601.webp", "eve_040702.webp", "eve_040801.webp"], - ], - [ - ["eve_050101.webp", "eve_050201.webp", "eve_050401.webp"], - ["eve_050501.webp", "eve_050601.webp", "eve_050704.webp"], - ], - [ - ["eve_050801.webp", "eve_070101.webp", "bg_1511.webp"], - ["bg_1521.webp", "bg_2011.webp", "bg_2521.webp"], - ], - [ - ["bg_3042.webp", "bg_3551.webp", "bg_3571.webp"], - ["bg_3721.webp", "bg_5033.webp", "bg_5044.webp"], - ], - ]; - } + class CG { + constructor() { + //cg列表 + this.UIMx = [ + //空位用‘none’填充,当前ui至多4列6行 + [ + ["eve_010102.webp", "eve_010203.webp", "eve_010304.webp"], + ["eve_010501.webp", "eve_010601.webp", "eve_010701.webp"], + ], + [ + ["eve_010801.webp", "eve_010902.webp", "eve_011001.webp"], + ["eve_011101.webp", "eve_011202.webp", "eve_011302.webp"], + ], + [ + ["eve_011402.webp", "eve_020102.webp", "eve_020201.webp"], + ["eve_020301.webp", "eve_020401.webp", "eve_020501.webp"], + ], + [ + ["eve_020605.webp", "eve_020701.webp", "eve_020801.webp"], + ["eve_030101.webp", "eve_030206.webp", "eve_030302.webp"], + ], + [ + ["eve_030508.webp", "eve_030601.webp", "eve_030801.webp"], + ["eve_030901.webp", "eve_031002.webp", "eve_031101.webp"], + ], + [ + ["eve_040201.webp", "eve_040401.webp", "eve_040501.webp"], + ["eve_040601.webp", "eve_040702.webp", "eve_040801.webp"], + ], + [ + ["eve_050101.webp", "eve_050201.webp", "eve_050401.webp"], + ["eve_050501.webp", "eve_050601.webp", "eve_050704.webp"], + ], + [ + ["eve_050801.webp", "eve_070101.webp", "bg_1511.webp"], + ["bg_1521.webp", "bg_2011.webp", "bg_2521.webp"], + ], + [ + ["bg_3042.webp", "bg_3551.webp", "bg_3571.webp"], + ["bg_3721.webp", "bg_5033.webp", "bg_5044.webp"], + ], + ]; + } - //更新 - update() { - this.background(); - this.drawUI(); - } - background() { - //画布大小设置 - if (core.domStyle.isVertical) { - CGUI.width = 1248; - CGUI.height = 2028; - } else { - CGUI.width = 2028; - CGUI.height = 1248; - } - core.setTextAlign(ctx, "center"); - } - onclick(px, py) { - //点击 - if (show) { - show = !show; - core.clearMap(ctx); - this.update(); - return; - } - 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([45, 45], [120, 80]); - if (inRect(pos, backbox)) { - //离开按钮是一致的,其余的记区分横竖屏 - CGUI.style.display = "none"; - core.clearMap(ctx); - core.restart(); - return; - } - if (core.domStyle.isVertical) { - //竖屏 - const pageupbox = makeBox([30, 380], [144, 144]); - const pagedownbox = makeBox([30, 1080], [144, 144]); + //更新 + update() { + this.background(); + this.drawUI(); + } + background() { + //画布大小设置 + if (core.domStyle.isVertical) { + CGUI.width = 1248; + CGUI.height = 2028; + } else { + CGUI.width = 2028; + CGUI.height = 1248; + } + core.setTextAlign(ctx, "center"); + } + onclick(px, py) { + //点击 + if (show) { + show = !show; + core.clearMap(ctx); + this.update(); + return; + } + 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)) { + //离开按钮是一致的,其余的记区分横竖屏 + CGUI.style.display = "none"; + core.clearMap(ctx); + core.restart(); + return; + } + if (core.domStyle.isVertical) { + //竖屏 + const pageupbox = makeBox([30, 380], [144, 144]); + const pagedownbox = makeBox([30, 1080], [144, 144]); - const imagebox0 = makeBox([200, 300], [480, 320]); - const imagebox1 = makeBox([200, 750], [480, 320]); - const imagebox2 = makeBox([200, 1200], [480, 320]); + const imagebox0 = makeBox([200, 300], [480, 320]); + const imagebox1 = makeBox([200, 750], [480, 320]); + const imagebox2 = makeBox([200, 1200], [480, 320]); - const imagebox3 = makeBox([700, 300], [480, 320]); - const imagebox4 = makeBox([700, 750], [480, 320]); - const imagebox5 = makeBox([700, 1200], [480, 320]); - if (inRect(pos, pagedownbox)) { - //2代表当前最大页数-1 - if (page < this.UIMx.length - 1) { - page++; - core.clearMap(ctx); - this.update(); - } - } else if (inRect(pos, pageupbox)) { - if (page > 0) { - page--; - core.clearMap(ctx); - this.update(); - } - } else if (inRect(pos, imagebox0)) { - const img = core.material.images.images[this.UIMx[page][0][0]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } else if (inRect(pos, imagebox1)) { - const img = core.material.images.images[this.UIMx[page][0][1]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } else if (inRect(pos, imagebox2)) { - const img = core.material.images.images[this.UIMx[page][0][2]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } else if (inRect(pos, imagebox3)) { - const img = core.material.images.images[this.UIMx[page][1][0]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } else if (inRect(pos, imagebox4)) { - const img = core.material.images.images[this.UIMx[page][1][1]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } else if (inRect(pos, imagebox5)) { - const img = core.material.images.images[this.UIMx[page][1][2]]; - if (img) { - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.restore(); //重置画布设置 - show = !show; - } - } - } else { - const pageupbox = makeBox([30, 340], [144, 144]); - const pagedownbox = makeBox([30, 840], [144, 144]); - const imagebox0 = makeBox([300, 300], [480, 320]); - const imagebox1 = makeBox([800, 300], [480, 320]); - const imagebox2 = makeBox([1300, 300], [480, 320]); - const imagebox3 = makeBox([300, 750], [480, 320]); - const imagebox4 = makeBox([800, 750], [480, 320]); - const imagebox5 = makeBox([1300, 750], [480, 320]); - if (inRect(pos, pagedownbox)) { - if (page < this.UIMx.length - 1) { - page++; - core.clearMap(ctx); - this.update(); - } - } else if (inRect(pos, pageupbox)) { - if (page > 0) { - page--; - core.clearMap(ctx); - this.update(); - } - } else if (inRect(pos, imagebox0)) { - const img = core.material.images.images[this.UIMx[page][0][0]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } else if (inRect(pos, imagebox1)) { - const img = core.material.images.images[this.UIMx[page][0][1]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } else if (inRect(pos, imagebox2)) { - const img = core.material.images.images[this.UIMx[page][0][2]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } else if (inRect(pos, imagebox3)) { - const img = core.material.images.images[this.UIMx[page][1][0]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } else if (inRect(pos, imagebox4)) { - const img = core.material.images.images[this.UIMx[page][1][1]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } else if (inRect(pos, imagebox5)) { - const img = core.material.images.images[this.UIMx[page][1][2]]; - if (img) { - ctx.drawImage(img, 0, 0, 2028, 1248); - show = !show; - } - } - } - } - drawUI() { - //绘制页面 - core.clearMap(CGUI); - const bgVertical = core.material.images.images["bg_2010.webp"]; //竖屏背景 - const bg = core.material.images.images["bg_5043.webp"]; //横屏背景 - if (core.domStyle.isVertical) { - //竖屏 + const imagebox3 = makeBox([700, 300], [480, 320]); + const imagebox4 = makeBox([700, 750], [480, 320]); + const imagebox5 = makeBox([700, 1200], [480, 320]); + if (inRect(pos, pagedownbox)) { + //2代表当前最大页数-1 + if (page < this.UIMx.length - 1) { + page++; + core.clearMap(ctx); + this.update(); + } + } else if (inRect(pos, pageupbox)) { + if (page > 0) { + page--; + core.clearMap(ctx); + this.update(); + } + } else if (inRect(pos, imagebox0)) { + const img = core.material.images.images[this.UIMx[page][0][0]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } else if (inRect(pos, imagebox1)) { + const img = core.material.images.images[this.UIMx[page][0][1]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } else if (inRect(pos, imagebox2)) { + const img = core.material.images.images[this.UIMx[page][0][2]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } else if (inRect(pos, imagebox3)) { + const img = core.material.images.images[this.UIMx[page][1][0]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } else if (inRect(pos, imagebox4)) { + const img = core.material.images.images[this.UIMx[page][1][1]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } else if (inRect(pos, imagebox5)) { + const img = core.material.images.images[this.UIMx[page][1][2]]; + if (img) { + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.restore(); //重置画布设置 + show = !show; + } + } + } else { + const pageupbox = makeBox([30, 340], [144, 144]); + const pagedownbox = makeBox([30, 840], [144, 144]); + const imagebox0 = makeBox([300, 300], [480, 320]); + const imagebox1 = makeBox([800, 300], [480, 320]); + const imagebox2 = makeBox([1300, 300], [480, 320]); + const imagebox3 = makeBox([300, 750], [480, 320]); + const imagebox4 = makeBox([800, 750], [480, 320]); + const imagebox5 = makeBox([1300, 750], [480, 320]); + if (inRect(pos, pagedownbox)) { + if (page < this.UIMx.length - 1) { + page++; + core.clearMap(ctx); + this.update(); + } + } else if (inRect(pos, pageupbox)) { + if (page > 0) { + page--; + core.clearMap(ctx); + this.update(); + } + } else if (inRect(pos, imagebox0)) { + const img = core.material.images.images[this.UIMx[page][0][0]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } else if (inRect(pos, imagebox1)) { + const img = core.material.images.images[this.UIMx[page][0][1]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } else if (inRect(pos, imagebox2)) { + const img = core.material.images.images[this.UIMx[page][0][2]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } else if (inRect(pos, imagebox3)) { + const img = core.material.images.images[this.UIMx[page][1][0]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } else if (inRect(pos, imagebox4)) { + const img = core.material.images.images[this.UIMx[page][1][1]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } else if (inRect(pos, imagebox5)) { + const img = core.material.images.images[this.UIMx[page][1][2]]; + if (img) { + ctx.drawImage(img, 0, 0, 2028, 1248); + show = !show; + } + } + } + } + drawUI() { + //绘制页面 + core.clearMap(CGUI); + 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.5; //透明度 - if (bgVertical) - ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 + core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 + ctx.globalAlpha = 0.5; //透明度 + if (bgVertical) + ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 + ctx.globalAlpha = 1; //恢复为不透明 - core.setTextAlign(ctx, "center"); - core.fillRoundRect( - ctx, - 45 - 6, - 45 - 6, - 120 + 12, - 80 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 45 - 12, - 120 + 24, - 80 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "<离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, true) - ); - // 添加向上翻页和向下翻页的按钮 - core.fillRoundRect( - ctx, - 45 - 6, - 400 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 400 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillRoundRect( - ctx, - 45 - 6, - 1100 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 1100 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "向上翻页", - 100, - 450, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); - core.fillBoldText1( - ctx, - "向下翻页", - 100, - 1150, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + '◀离开', + 110, + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + // 添加向上翻页和向下翻页的按钮 + core.fillRoundRect( + ctx, + 45 - 6, + 400 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 400 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillRoundRect( + ctx, + 45 - 6, + 1100 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 1100 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText1( + ctx, + "向上翻页", + 100, + 450, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.fillBoldText1( + ctx, + "向下翻页", + 100, + 1150, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); - // 添加3*2个4:3的画框,及图片 - for (let i = 0; i < 3; i++) { - for (let j = 0; j < 2; j++) { - const img = core.material.images.images[this.UIMx[page][j][i]]; - core.strokeRect( - ctx, - 200 + j * 500, - 300 + i * 450, - 480, - 320, - "#444444", - 5 - ); - if (img) - ctx.drawImage( - img, - 200 + j * 500 + 15, - 300 + i * 450 + 15, - 480 - 30, - 320 - 30 - ); - } - } - } 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.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248); - core.setTextAlign(ctx, "center"); - core.fillRoundRect( - ctx, - 45 - 6, - 45 - 6, - 120 + 12, - 80 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 45 - 12, - 120 + 24, - 80 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "<离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, true) - ); + // 添加3*2个4:3的画框,及图片 + for (let i = 0; i < 3; i++) { + for (let j = 0; j < 2; j++) { + const img = core.material.images.images[this.UIMx[page][j][i]]; + core.strokeRect( + ctx, + 200 + j * 500, + 300 + i * 450, + 480, + 320, + "#444444", + 5 + ); + if (img) + ctx.drawImage( + img, + 200 + j * 500 + 15, + 300 + i * 450 + 15, + 480 - 30, + 320 - 30 + ); + } + } + } 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.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248); + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + '◀离开', + 110, + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); - // 添加向上翻页和向下翻页的按钮 - core.fillRoundRect( - ctx, - 45 - 6, - 350 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 350 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "向上翻页", - 100, - 400, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); - core.fillRoundRect( - ctx, - 45 - 6, - 850 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 850 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "向下翻页", - 100, - 900, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); + // 添加向上翻页和向下翻页的按钮 + core.fillRoundRect( + ctx, + 45 - 6, + 350 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 350 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText1( + ctx, + "向上翻页", + 100, + 400, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.fillRoundRect( + ctx, + 45 - 6, + 850 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 850 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText1( + ctx, + "向下翻页", + 100, + 900, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); - // 添加3*2个4:3的画框 - for (let i = 0; i < 2; i++) { - for (let j = 0; j < 3; j++) { - core.strokeRect( - ctx, - 300 + j * 500, - 300 + i * 450, - 480, - 320, - "#444444", - 2 - ); - const img = core.material.images.images[this.UIMx[page][i][j]]; - if (img) - ctx.drawImage( - img, - 300 + j * 500 + 15, - 300 + i * 450 + 15, - 480 - 30, - 320 - 30 - ); - } - } - } - } - } - core.ui.CG = new CG(); - main.dom.CGMode.onclick = function () { - //点击开始页面的CG MODE进入cg回廊 - main.core.control.checkBgm(); - page = 0; - CGUI.style.display = "block"; - main.core.ui.CG.update(); - }; - }, + // 添加3*2个4:3的画框 + for (let i = 0; i < 2; i++) { + for (let j = 0; j < 3; j++) { + core.strokeRect( + ctx, + 300 + j * 500, + 300 + i * 450, + 480, + 320, + "#444444", + 2 + ); + const img = core.material.images.images[this.UIMx[page][i][j]]; + if (img) + ctx.drawImage( + img, + 300 + j * 500 + 15, + 300 + i * 450 + 15, + 480 - 30, + 320 - 30 + ); + } + } + } + } + } + core.ui.CG = new CG(); + main.dom.CGMode.onclick = function () { + //点击开始页面的CG MODE进入cg回廊 + main.core.control.checkBgm(); + page = 0; + CGUI.style.display = "block"; + main.core.ui.CG.update(); + }; +}, "光标设置": function () { // 在此增加新插件 this.changeMouse = function ( @@ -14248,186 +14213,592 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "musicMode": function () { - // 在此增加新插件 - const music = document.createElement("canvas"); //CGui画布设置 - 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; - let page = 0; //初始页面 - let show = false; //展示状态 - music.onclick = function (e) { - try { - e.preventDefault(); - if (core.isPlaying()) return false; - 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.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; + // 在此增加新插件 + 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; - class musicclass { - constructor() { - //music列表 - //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 - this.musicMx = [ - ["Asphodelus_Ceui.mp3", "Blind_Alley.mp3"], - ["Crawler.mp3", "op.mp3", "theme.mp3"], - ]; - //音乐别名(将在播放器内显示的音乐名,music列表内的都要有对应歌名) - this.musicname = { - "Asphodelus_Ceui.mp3": "Asphodelus", - "Blind_Alley.mp3": "Blind", - "Crawler.mp3": "Crawler", - "op.mp3": "op", - "theme.mp3": "theme", - }; - } + const audio = document.createElement("audio") + audio.autoplay = true + audio.preload = 'auto' - //更新 - update() { - this.background(); - this.drawUI(); - } - background() { - //画布大小设置 - if (core.domStyle.isVertical) { - music.width = 1248; - music.height = 2028; - } else { - music.width = 2028; - music.height = 1248; - } - } - onclick(px, py) { - //点击 - if (show) { - show = !show; - core.clearMap(ctx); - this.update(); - return; - } - 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([45, 45], [120, 80]); - if (inRect(pos, backbox)) { - //离开按钮是一致的,其余的记区分横竖屏 - music.style.display = "none"; - core.clearMap(ctx); - core.restart(); - return; - } - } - 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) { - //竖屏 + function getRandomInt(min, max) { + const minCeiled = Math.ceil(min); + const maxFloored = Math.floor(max); + return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled); + } + let page = 0; //初始页面 + let ischange = false; + let isvolume = false; + 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); - core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 - ctx.globalAlpha = 0.5; //透明度 - if (bgVertical) - ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 + }) + music.addEventListener('mousemove', function (e) { - core.setTextAlign(ctx, "center"); - core.fillRoundRect( - ctx, - 45 - 6, - 45 - 6, - 120 + 12, - 80 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 45 - 12, - 120 + 24, - 80 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "<离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, 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.fillRoundRect( - ctx, - 45 - 6, - 45 - 6, - 120 + 12, - 80 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 45 - 12, - 120 + 24, - 80 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText1( - ctx, - "<离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, true) - ); - } - } - } - core.ui.music = new musicclass(); - main.dom.musicMode.onclick = function () { - //点击开始页面的CG MODE进入cg回廊 - main.core.control.checkBgm(); - page = 0; - music.style.display = "block"; - main.core.ui.music.update(); - }; - }, + 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(); + ischange = false; + isvolume = false; + if (!main.core.ui.music.stop) audio.play() + + }) + music.addEventListener('mouseleave', function (e) { + + e.stopPropagation(); + ischange = false; + isvolume = false; + if (!main.core.ui.music.stop) audio.play() + + }) + 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(); + ischange = false; + isvolume = false; + if (!main.core.ui.music.stop) audio.play() + + }) + music.addEventListener('touchcancel', function (e) { + + e.stopPropagation(); + ischange = false; + isvolume = false; + + }) + + audio.addEventListener('ended', function () { + console.log(1) + switch (main.core.ui.music.type) { + case 'danqu': + audio.currentTime = 0 + if (!main.core.ui.music.stop) audio.play() + main.core.ui.music.stop = false + page = main.core.ui.music.selection[0] + + break; + case 'xunhuan': + if (main.core.ui.music.selection[1] === main.core.ui.music.musicMx[main.core.ui.music.selection[0]].length - 1) { + if (main.core.ui.music.selection[0] === main.core.ui.music.musicMx.length - 1) { + main.core.ui.music.selection[0] = 0 + main.core.ui.music.selection[1] = 0 + } else { + main.core.ui.music.selection[0] += 1 + main.core.ui.music.selection[1] = 0 + } + } else { + main.core.ui.music.selection[1] += 1 + } + page = main.core.ui.music.selection[0] + audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]] + + if (!main.core.ui.music.stop) audio.play() + main.core.ui.music.stop = false + break; + case 'suiji': + main.core.ui.music.selection[0] = getRandomInt(0, main.core.ui.music.musicMx.length) + main.core.ui.music.selection[1] = getRandomInt(0, main.core.ui.music.musicMx[main.core.ui.music.selection[0]].length) + audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]] + page = main.core.ui.music.selection[0] + + if (!main.core.ui.music.stop) audio.play() + main.core.ui.music.stop = false + break; + } + }) + core.audio = audio + + class musicclass { + constructor() { + //music列表 + //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容 + this.musicMx = [ + ["Asphodelus_Ceui.mp3", "Blind_Alley.mp3"], + ["Crawler.mp3", "op.mp3", "theme.mp3"], + ]; + //音乐别名(将在播放器内显示的音乐名,music列表内的都要有对应歌名) + this.musicname = { + "Asphodelus_Ceui.mp3": "Asphodelus", + "Blind_Alley.mp3": "Blind", + "Crawler.mp3": "Crawler", + "op.mp3": "op", + "theme.mp3": "theme", + }; + this.selection = [0, 0] + this.stop = false + this.type = "xunhuan" + } + + //更新 + 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') + audio.src = "" + core.restart(); + + return; + } + if (core.domStyle.isVertical) { //竖屏 + + } 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([135, 760], [50, 50]) + const afterbox = makeBox([440, 760], [50, 50]) + const playbox = makeBox([260, 730], [100, 100]) + const typebox = makeBox([580, 730], [100, 100]) + const changebox = makeBox([100, 590], [600, 20]) + const volumebox = makeBox([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 + audio.play() + } else { + this.stop = !this.stop + audio.pause() + } + return; + } + if (inRect(pos, beforebox)) { + switch (this.type) { + case 'danqu': + audio.currentTime = 0 + if (!this.stop) audio.play() + this.stop = false + page = this.selection[0] + + break; + case 'xunhuan': + if (this.selection[1] === 0) { + if (this.selection[0] === 0) { + this.selection[0] = this.musicMx.length - 1 + this.selection[1] = this.musicMx[this.selection[0]].length - 1 + } else { + this.selection[0] -= 1 + this.selection[1] = this.musicMx[this.selection[0]].length - 1 + } + } else { + this.selection[1] -= 1 + } + page = this.selection[0] + audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] + + if (!this.stop) audio.play() + this.stop = false + break; + case 'suiji': + this.selection[0] = getRandomInt(0, this.musicMx.length) + this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) + audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] + page = this.selection[0] + + if (!this.stop) audio.play() + this.stop = false + break; + } + return; + } + if (inRect(pos, afterbox)) { + switch (this.type) { + case 'danqu': + audio.currentTime = 0 + if (!this.stop) audio.play() + this.stop = false + page = this.selection[0] + break; + case 'xunhuan': + if (this.selection[1] === this.musicMx[this.selection[0]].length - 1) { + if (this.selection[0] === this.musicMx.length - 1) { + this.selection[0] = 0 + this.selection[1] = 0 + } else { + this.selection[0] += 1 + this.selection[1] = 0 + } + } else { + this.selection[1] += 1 + } + page = this.selection[0] + audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] + + if (!this.stop) audio.play() + this.stop = false + break; + case 'suiji': + this.selection[0] = getRandomInt(0, this.musicMx.length) + this.selection[1] = getRandomInt(0, this.musicMx[this.selection[0]].length) + audio.src = "project/bgms/" + this.musicMx[this.selection[0]][this.selection[1]] + + page = this.selection[0] + if (!this.stop) audio.play() + this.stop = false + break; + } + return; + } + if (inRect(pos, typebox)) { + switch (this.type) { + case 'danqu': + this.type = 'xunhuan' + break; + case 'xunhuan': + this.type = 'suiji' + break; + case 'suiji': + this.type = 'danqu' + break; + } + return; + } + if (inRect(pos, musicbox)) { + const index = Math.floor((py - 100) / 100) + if (page !== this.selection[0] || index !== this.selection[1]) { + this.selection[0] = page + this.selection[1] = index + audio.src = "project/bgms/" + this.musicMx[page][index] + + if (!this.stop) audio.play() + this.stop = false + + } else { + if (this.stop) { + this.stop = !this.stop + audio.play() + } else { + this.stop = !this.stop + audio.pause() + } + } + return; + } + if (inRect(pos, changebox)) { + + const time = Math.floor((px - 100) / 600 * audio.duration) + + audio.pause() + audio.currentTime = time; + + ischange = true + } + if (inRect(pos, volumebox)) { + const time = (px - 100) / 600 + audio.volume = time + isvolume = true + } + } + } + mousemove(px, py) { + if (ischange) { + const time = Math.min(Math.max(Math.floor((px - 100) / 600 * audio.duration), 0), audio.duration) + + audio.currentTime = time + + } + if (isvolume) { + const time = Math.min(Math.max((px - 100) / 600, 0), 1) + audio.volume = 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.5; //透明度 + 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) + ); + + } 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) + ); + //core.fillRect(ctx, 440, 760, 50, 50) + 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]] + 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.beginPath() + ctx.moveTo(100, 600) + ctx.lineTo(700, 600) + ctx.stroke() + ctx.fillStyle = "#ffffff" + ctx.font = "bold 48px Verdana" + ctx.fillText('|', 130, 797) + ctx.fillText('◀', 140, 800) + ctx.beginPath() + ctx.arc(310, 780, 50, 0, 2 * Math.PI) + ctx.stroke() + if (this.stop) { ctx.fillText('▶', 295, 797) } else { ctx.fillText('||', 285, 794) } + + ctx.fillText('|', 470, 797) + ctx.fillText('▶', 450, 800) + ctx.fillText('音量', 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.volume + 100, 1000) + ctx.stroke() + ctx.beginPath() + ctx.arc(600 * audio.volume + 100, 1000, 10, 0, 2 * Math.PI) + ctx.fill() + core.fillBoldText1( + ctx, + Math.floor(100 * audio.volume), + 720, + 1010, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(32, true) + ); + const img = core.material.images.images[this.type + '.webp'] + if (img) ctx.drawImage(img, 580, 730, 100, 100) + core.setTextAlign(ctx, "center"); + ctx.font = "bold 48px Verdana" + ctx.fillText('当前歌曲', 400, 297) + ctx.fillText(this.musicname[this.musicMx[this.selection[0]][this.selection[1]]], 400, 397) + + ctx.font = "bold 36px Verdana" + const thistime = audio.currentTime + + if (thistime) { + const timetext = (Math.floor(thistime / 60).toString()).padStart(2, '0') + ':' + Math.floor(thistime % 60).toString().padStart(2, '0') + ctx.fillText(timetext, 510, 650) + } else { + const timetext = "00:00" + ctx.fillText(timetext, 510, 650) + } + ctx.fillText("/", 580, 650) + const fulltime = audio.duration + + if (fulltime) { + const timetext = Math.floor(fulltime / 60).toString().padStart(2, '0') + ':' + Math.floor(fulltime % 60).toString().padStart(2, '0') + ctx.fillText(timetext, 650, 650) + } else { + const timetext = "00:00" + ctx.fillText(timetext, 650, 650) + } + ctx.strokeStyle = "#ffffff" + ctx.lineWidth = 9 + ctx.fillStyle = 'rgba(255,255,255,0.5)' + const pointx = 600 * thistime / fulltime + 100 + if (fulltime && thistime) { + ctx.beginPath() + ctx.moveTo(100, 600) + ctx.lineTo(pointx, 600) + ctx.stroke() + ctx.beginPath() + ctx.arc(pointx, 600, 10, 0, 2 * Math.PI) + ctx.fill() + } else { + ctx.beginPath() + ctx.arc(100, 600, 10, 0, 2 * Math.PI) + ctx.fill() + } + + } + } + } + core.ui.music = new musicclass(); + main.dom.musicMode.onclick = function () { + //点击开始页面的CG MODE进入cg回廊 + main.core.control.checkBgm(); + main.core.control.pauseBgm(); + audio.src = "project/bgms/" + main.core.ui.music.musicMx[main.core.ui.music.selection[0]][main.core.ui.music.selection[1]] + + page = 0; + music.style.display = "block"; + core.registerAnimationFrame("music", null, () => { main.core.ui.music.update() }) + }; +}, "横屏切换": function () { // 在此增加新插件 this.triggerFullscreen = async function (full) { @@ -14499,7 +14870,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }, "帧动画特效(游戏界面)": function () { // 在此增加新插件 - const animate2 = document.createElement("canvas"); //画布设置 + const animate2 = document.createElement("canvas"); animate2.style.zIndex = 71; animate2.id = "animate2"; animate2.classList.add('gameCanvas', 'anti-aliasing') @@ -14613,8 +14984,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = angle = (Math.PI * (image.angel ?? 0) / 180) + ((Math.PI * (image.aangel ?? 0) / 180) - ((Math.PI * (image.angel ?? 0) / 180)) * (one.farme - beforefarme)) / (afterfarme - beforefarme || 1); if (one.hero) { let sx, sy; - if (core.status.heroMoving < 0) { sx = 0; - sy = 0 } else { + if (core.status.heroMoving < 0) { + sx = 0; + sy = 0 + } else { sx = core.utils.scan[core.status.hero.loc.direction].x * 4 * core.status.heroMoving sy = core.utils.scan[core.status.hero.loc.direction].y * 4 * core.status.heroMoving }