diff --git a/project/plugins.js b/project/plugins.js index 8129fec..bd0456e 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1,5 +1,6 @@ -var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { - init: function () { +var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = +{ + "init": function () { this._afterLoadResources = function () { // 本函数将在所有资源加载完毕后,游戏开启前被执行 core.ui.statusBar.init(); @@ -258,7 +259,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - drawLight: function () { + "drawLight": function () { // 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...) // 【参数说明】 // name:必填,要绘制到的画布名;可以是一个系统画布,或者是个自定义画布;如果不存在则创建 @@ -324,7 +325,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { // 可以在任何地方(如afterXXX或自定义脚本事件)调用函数,方法为 core.plugin.xxx(); }; }, - shop: function () { + "shop": function () { // 【全局商店】相关的功能 // // 打开一个全局商店 @@ -600,7 +601,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { 60 ); }, - removeMap: function () { + "removeMap": function () { // 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。 // 推荐用法: // 对于超高层或分区域塔,当在1区时将2区以后的地图删除;1区结束时恢复2区,进二区时删除1区地图,以此类推 @@ -689,7 +690,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - fiveLayers: function () { + "fiveLayers": function () { // 是否启用五图层(增加背景2层和前景2层) 将__enable置为true即会启用;启用后请保存后刷新编辑器 // 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层 // 另外 请注意加入两个新图层 会让大地图的性能降低一些 @@ -891,7 +892,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }; }; }, - itemShop: function () { + "itemShop": function () { // 道具商店相关的插件 // 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找) @@ -1293,7 +1294,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ]); }; }, - enemyLevel: function () { + "enemyLevel": function () { // 此插件将提供怪物手册中的怪物境界显示 // 使用此插件需要先给每个怪物定义境界,方法如下: // 点击怪物的【配置表格】,找到“【怪物】相关的表格配置”,然后在【名称】仿照增加境界定义: @@ -1461,7 +1462,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ); }; }, - multiHeros: function () { + "multiHeros": function () { // 多角色插件 // Step 1: 启用本插件 // Step 2: 定义每个新的角色各项初始数据(参见下方注释) @@ -1615,7 +1616,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.setFlag("heroId", toHeroId); // 保存切换到的角色ID }; }, - heroFourFrames: function () { + "heroFourFrames": function () { // 样板的勇士/跟随者移动时只使用2、4两帧,观感较差。本插件可以将四帧全用上。 // 是否启用本插件 @@ -1678,7 +1679,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return false; }; }, - routeFixing: function () { + "routeFixing": function () { // 是否开启本插件,true 表示启用,false 表示禁用。 var __enable = true; if (!__enable) return; @@ -1802,7 +1803,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() 部分来取消 @@ -2059,7 +2060,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - sprites: function () { + "sprites": function () { // 基于canvas的sprite化,摘编整理自万宁魔塔 // // ---------------------------------------- 第一部分 js代码 (必装) --------------------------------------- // @@ -2263,7 +2264,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { window.Sprite = Sprite; }, - hotReload: function () { + "hotReload": function () { /* ---------- 功能说明 ---------- * 1. 当 libs/ main.js index.html 中的任意一个文件被更改后,会自动刷新塔的页面 @@ -2520,7 +2521,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"; @@ -3733,7 +3734,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }; // init() called in `afterLoadResources`. }, - override: function () { + "override": function () { core.statusBar.icons = { floor: 0, name: null, @@ -4297,7 +4298,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { // 仿RM窗口皮肤 ↑ }; }, - 额外信息: function () { + "额外信息": function () { /* 宝石血瓶左下角显示数值 * 注意!!!不要在道具属性中直接操作flags,使用core.status.hero.flags或core.setFlag系列函数代替! * 需要将 变量:itemDetail改为true才可正常运行 @@ -4454,7 +4455,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } } }, - 编辑器显伤: function () { + "编辑器显伤": function () { // 在此增加新插件 /////// 用户设置 /////// // 将__enable置为false将关闭插件 @@ -4728,7 +4729,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 手册区分特殊属性: function () { + "手册区分特殊属性": function () { // 在此增加新插件 this.arrsame = function (Arraya, Arrayb) { let a = Arraya || []; @@ -5080,7 +5081,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return [enemy, texts]; }; }, - 一防减伤: function () { + "一防减伤": function () { // 在此增加新插件 ui.prototype._drawBook_drawRow3 = function ( index, @@ -5154,7 +5155,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { return this.getDefDamage(enemy, null, x, y, floorId); }; }, - "新道具栏/装备栏": function () { + "新道具栏/装备栏": function () { // 在此增加新插件 // 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局 // 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改 @@ -6591,7 +6592,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_ @@ -7393,7 +7394,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 @@ -8267,7 +8268,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { inverseTrigo: N, }; }, - func: function () { + "func": function () { // 功能函数集,具体有哪些函数看每个函数前的注释即可 // 安装方式:直接复制到插件里面,注意新建插件自带的 function () { } 不能删 // 使用方式:可以直接使用对象解构按需引入 @@ -8707,7 +8708,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 音频系统: function () { + "音频系统": function () { // 在此增加新插件 /*首先,在造塔群下载所需的库文件,然后放置在塔目录下的 libs/thirdparty 或其他目录下,之后在 index.html 的最后加上下面这几行: @@ -10797,7 +10798,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.ui._drawSwitchs_sounds(); }; }, - 怪物碎裂特效: function () { + "怪物碎裂特效": function () { // 在此增加新插件 // -------------------- 安装说明 -------------------- // // 先安装两个在插件简介中说明的前置插件 @@ -11042,7 +11043,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { applyFragWith, }; }, - 自定义常用事件: function () { + "自定义常用事件": function () { // editorBlocklyconfigPlus.js // 自訂常見事件模板插件 // 本插件引用了通用函數插件(Utility.js) @@ -12331,7 +12332,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"); @@ -12562,7 +12563,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 瞬移轨迹: function () { + "瞬移轨迹": function () { // 在此增加新插件 function popMove() { var ctx = core.getContextByName("popMove"); @@ -12638,7 +12639,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - "墓碑(编辑器)": function () { + "墓碑(编辑器)": function () { // 在此增加新插件 if (main.mode != "editor") return; // 编辑器模式下使用 var mapData = null; @@ -12709,7 +12710,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.setAlpha("event2", alpha); }; }, - 小地图: function () { + "小地图": function () { // 在此增加新插件 // ----- 不可自定义 杂七杂八的变量 /** @type {{[x: string]: BFSResult}} */ @@ -13128,7 +13129,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 楼传: function () { + "楼传": function () { // 在此增加新插件 core.canMoveFloor = function () { @@ -14241,7 +14242,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { 0 ); }, - CG回廊: function () { + "CG回廊": function () { // 在此增加新插件 const CGUI = document.createElement("canvas"); //CGui画布设置 CGUI.style.position = "absolute"; @@ -14744,7 +14745,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { main.core.ui.CG.update(); }; }, - 光标设置: function () { + "光标设置": function () { // 在此增加新插件 this.changeMouse = function ( icon, @@ -14781,7 +14782,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) @@ -14888,7 +14889,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { else core.status.pop.push(data); }; }, - warning: function () { + "warning": function () { // 默认音效名 var defaultSound = "jingbao.mp3"; // 默认字体名 @@ -15004,7 +15005,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 1600); }; }, - 滑动转场: function () { + "滑动转场": function () { // 在此增加新插件 const defaultChange = { left: "leftPortal", // 左箭头 @@ -15194,906 +15195,904 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, 25); }; }, - 剧情cg: function () { - // 在此增加新插件 - const cg = document.createElement("canvas"); //cg画布设置 - cg.style.position = "absolute"; - cg.style.zIndex = 300; - cg.style.display = "none"; - cg.id = "cgText"; - main.dom.gameGroup.insertAdjacentElement("afterend", cg); - cg.style.top = "50%"; - cg.style.left = "50%"; - cg.style.transform = "translate(-50%,-50%)"; - const ctx = cg.getContext("2d"); - main.dom.cgText = cg; - const logcanvas = document.createElement("canvas"); //cg画布设置 - logcanvas.style.position = "absolute"; - logcanvas.style.zIndex = 301; - logcanvas.style.display = "none"; - logcanvas.id = "cgText"; - main.dom.gameGroup.insertAdjacentElement("afterend", logcanvas); - logcanvas.style.top = "50%"; - logcanvas.style.left = "50%"; - logcanvas.style.transform = "translate(-50%,-50%)"; - const logctx = logcanvas.getContext("2d"); - main.dom.logcanvas = logcanvas; - logcanvas.onmouseup = function (e) { - //鼠标抬起 + "剧情cg": function () { + // 在此增加新插件 + // 在此增加新插件 + const cg = document.createElement("canvas"); //cg画布设置 + cg.style.position = "absolute"; + cg.style.zIndex = 300; + cg.style.display = "none"; + cg.id = "cgText"; + main.dom.gameGroup.insertAdjacentElement("afterend", cg); + cg.style.top = "50%"; + cg.style.left = "50%"; + cg.style.transform = "translate(-50%,-50%)"; + const ctx = cg.getContext("2d"); + main.dom.cgText = cg; + const logcanvas = document.createElement("canvas"); //cg画布设置 + logcanvas.style.position = "absolute"; + logcanvas.style.zIndex = 301; + logcanvas.style.display = "none"; + logcanvas.id = "cgText"; + main.dom.gameGroup.insertAdjacentElement("afterend", logcanvas); + logcanvas.style.top = "50%"; + logcanvas.style.left = "50%"; + logcanvas.style.transform = "translate(-50%,-50%)"; + const logctx = logcanvas.getContext("2d"); + main.dom.logcanvas = logcanvas; + logcanvas.onmouseup = function (e) { + //鼠标抬起 - try { - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) { - console.error(ee); - } - }; - logcanvas.onmousedown = function (e) { - //鼠标按下 - try { - 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.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - logcanvas.ontouchend = function (e) { - //触摸抬起 + core.insertAction(data); + core.doAction(); + } + } catch (ee) { + console.error(ee); + } + }; + logcanvas.onmousedown = function (e) { + //鼠标按下 + try { + 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.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + logcanvas.ontouchend = function (e) { + //触摸抬起 - try { - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - core.setFlag("skip", false); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + core.setFlag("skip", false); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) {} - }; - logcanvas.ontouchstart = function (e) { - //触摸按下 - try { - if (!core.isPlaying()) return false; - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor( - (e.targetTouches[0].clientX - left) / core.domStyle.scale - ), - py = Math.floor( - (e.targetTouches[0].clientY - top) / core.domStyle.scale - ); - core.ui.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - cg.onmouseup = function (e) { - //鼠标抬起 + core.insertAction(data); + core.doAction(); + } + } catch (ee) {} + }; + logcanvas.ontouchstart = function (e) { + //触摸按下 + try { + if (!core.isPlaying()) return false; + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor( + (e.targetTouches[0].clientX - left) / core.domStyle.scale + ), + py = Math.floor( + (e.targetTouches[0].clientY - top) / core.domStyle.scale + ); + core.ui.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + cg.onmouseup = function (e) { + //鼠标抬起 - try { - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) { - console.error(ee); - } - }; - cg.onmousedown = function (e) { - //鼠标按下 - try { - 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.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - cg.ontouchend = function (e) { - //触摸抬起 + core.insertAction(data); + core.doAction(); + } + } catch (ee) { + console.error(ee); + } + }; + cg.onmousedown = function (e) { + //鼠标按下 + try { + 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.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + cg.ontouchend = function (e) { + //触摸抬起 - try { - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - core.setFlag("skip", false); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + core.setFlag("skip", false); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) { - console.error(ee); - } - }; - cg.ontouchstart = function (e) { - //触摸按下 - try { - if (!core.isPlaying()) return false; - const left = core.dom.gameGroup.offsetLeft; - const top = core.dom.gameGroup.offsetTop; - const px = Math.floor( - (e.targetTouches[0].clientX - left) / core.domStyle.scale - ), - py = Math.floor( - (e.targetTouches[0].clientY - top) / core.domStyle.scale - ); - core.ui.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - let auto = false; + core.insertAction(data); + core.doAction(); + } + } catch (ee) { + console.error(ee); + } + }; + cg.ontouchstart = function (e) { + //触摸按下 + try { + if (!core.isPlaying()) return false; + const left = core.dom.gameGroup.offsetLeft; + const top = core.dom.gameGroup.offsetTop; + const px = Math.floor( + (e.targetTouches[0].clientX - left) / core.domStyle.scale + ), + py = Math.floor( + (e.targetTouches[0].clientY - top) / core.domStyle.scale + ); + core.ui.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + let auto = false; - class cgText { - constructor() { - //绘制需要的变量 - this.image = ""; - this.head = { name: "face_050445.webp", px: -300 }; - this.bodyList = [ - { name: "tati_050145a.webp", px: 100, filter: false }, - { name: "tati_120124.webp", px: 1100, filter: true }, - ]; - this.name = ""; - this.text = ""; - this.time = 0; - this.WindowSkin = false; - this.sound = ""; - this.beforeSound = 0; - this.wait = 1000; - this.memory = false; - this.textList = []; - this.page = 1; - this.overpage = 1; - this.log = false; - this.index = 0; - } - click(px, py) { - //点击效果 + class cgText { + constructor() { + //绘制需要的变量 + this.image = ""; + this.head = { name: "face_050445.webp", px: -300 }; + this.bodyList = [ + { name: "tati_050145a.webp", px: 100, filter: false }, + { name: "tati_120124.webp", px: 1100, filter: true }, + ]; + this.name = ""; + this.text = ""; + this.time = 0; + this.WindowSkin = false; + this.sound = ""; + this.beforeSound = 0; + this.wait = 1000; + this.memory = false; + this.textList = []; + this.page = 1; + this.overpage = 1; + this.log = false; + this.index = 0; + } + click(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 savebox = makeBox([1700, 1100], [192, 96]); - const saveboxVertical = makeBox([52, 1700], [96, 192]); - const skipbox = makeBox([1700, 1000], [192, 96]); - const skipboxVertical = makeBox([152, 1700], [96, 192]); - const autobox = makeBox([1700, 900], [192, 96]); - const autoboxVertical = makeBox([252, 1700], [96, 192]); - const textbox = makeBox([1700, 800], [192, 96]); - const textboxVertical = makeBox([352, 1700], [96, 192]); - const backbox = makeBox([15, 35], [210, 90]); - const backboxVertical = makeBox([1123, 15], [90, 210]); - const pageupbox = makeBox([300, 1130], [200, 100]); - const pageupboxVertical = makeBox([18, 300], [100, 200]); - const pagedownbox = makeBox([1500, 1130], [200, 100]); - const pagedownboxVertical = makeBox([18, 1500], [100, 200]); - if (this.log) { - if ( - (core.domStyle.isVertical && inRect(pos, backboxVertical)) || - (!core.domStyle.isVertical && inRect(pos, backbox)) - ) { - core.clearMap(logctx); - main.dom.logcanvas.style.display = "none"; - this.log = false; - } else if ( - (core.domStyle.isVertical && inRect(pos, pageupboxVertical)) || - (!core.domStyle.isVertical && inRect(pos, pageupbox)) - ) { - core.clearMap(logctx); - if (this.page > 1) this.page--; - this.logdraw(this.page); - } else if ( - (core.domStyle.isVertical && inRect(pos, pagedownboxVertical)) || - (!core.domStyle.isVertical && inRect(pos, pagedownbox)) - ) { - core.clearMap(logctx); - if (this.page < this.overpage) this.page++; - this.logdraw(this.page); - } - } else { - if ( - (core.domStyle.isVertical && - inRect(pos, skipboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, skipbox)) - ) { - auto = false; + 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 savebox = makeBox([1700, 1100], [192, 96]); + const saveboxVertical = makeBox([52, 1700], [96, 192]); + const skipbox = makeBox([1700, 1000], [192, 96]); + const skipboxVertical = makeBox([152, 1700], [96, 192]); + const autobox = makeBox([1700, 900], [192, 96]); + const autoboxVertical = makeBox([252, 1700], [96, 192]); + const textbox = makeBox([1700, 800], [192, 96]); + const textboxVertical = makeBox([352, 1700], [96, 192]); + const backbox = makeBox([15, 35], [210, 90]); + const backboxVertical = makeBox([1123, 15], [90, 210]); + const pageupbox = makeBox([300, 1130], [200, 100]); + const pageupboxVertical = makeBox([18, 300], [100, 200]); + const pagedownbox = makeBox([1500, 1130], [200, 100]); + const pagedownboxVertical = makeBox([18, 1500], [100, 200]); + if (this.log) { + if ( + (core.domStyle.isVertical && inRect(pos, backboxVertical)) || + (!core.domStyle.isVertical && inRect(pos, backbox)) + ) { + core.clearMap(logctx); + main.dom.logcanvas.style.display = "none"; + this.log = false; + } else if ( + (core.domStyle.isVertical && inRect(pos, pageupboxVertical)) || + (!core.domStyle.isVertical && inRect(pos, pageupbox)) + ) { + core.clearMap(logctx); + if (this.page > 1) this.page--; + this.logdraw(this.page); + } else if ( + (core.domStyle.isVertical && inRect(pos, pagedownboxVertical)) || + (!core.domStyle.isVertical && inRect(pos, pagedownbox)) + ) { + core.clearMap(logctx); + if (this.page < this.overpage) this.page++; + this.logdraw(this.page); + } + } else { + if ( + (core.domStyle.isVertical && + inRect(pos, skipboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, skipbox)) + ) { + auto = false; + let time = 0; + core.stopSound(this.beforeSound); + core.registerAnimationFrame("skip", true, (timestamp) => { + if (timestamp > time + 50) { + time = timestamp; + if ( + core.status.event.id == "action" && + core.status.event.data.type == "cgtext" + ) { + core.setFlag("skip", true); + main.dom.cgText.style.display = "none"; + core.doAction(); + } + } + }); + } else if ( + (core.domStyle.isVertical && + inRect(pos, textboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, textbox)) + ) { + auto = false; + this.log = true; + this.overpage = Math.floor(this.index / 6) + 1; + this.page = this.overpage; + logcanvas.style.display = "block"; + const data = core.clone(core.status.event.data.current); + data.showAll = true; + data.time = 0; + data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 + data.sound = ""; + core.insertAction(data); + core.doAction(); + this.logdraw(this.page); + } else if ( + (core.domStyle.isVertical && + inRect(pos, autoboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, autobox)) + ) { + auto = !auto; - let time = 0; - core.stopSound(this.beforeSound); - core.registerAnimationFrame("skip", true, (timestamp) => { - if (timestamp > time + 50) { - time = timestamp; - if ( - core.status.event.id == "action" && - core.status.event.data.type == "cgtext" - ) { - core.setFlag("skip", true); - main.dom.cgText.style.display = "none"; - core.doAction(); - } - } - }); - } else if ( - (core.domStyle.isVertical && - inRect(pos, textboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, textbox)) - ) { - auto = false; - this.log = true; - this.overpage = Math.floor(this.index / 6) + 1; - this.page = this.overpage; - logcanvas.style.display = "block"; - const data = core.clone(core.status.event.data.current); - data.showAll = true; - data.time = 0; - data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 - data.sound = ""; - core.insertAction(data); - core.doAction(); - this.logdraw(this.page); - } else if ( - (core.domStyle.isVertical && - inRect(pos, autoboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, autobox)) - ) { - auto = !auto; - // 打字机效果显示全部文字 - if (core.status.event.interval != null) { - const data = core.clone(core.status.event.data?.current); - data.showAll = true; - data.time = 0; - data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 - data.sound = ""; - core.insertAction(data); - core.doAction(); - return; - } else { - core.stopSound(this.beforeSound); - cg.style.display = "none"; - core.doAction(); - } - } else if ( - (core.domStyle.isVertical && - inRect(pos, saveboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, savebox)) - ) { - //存档 - auto = false; - if (core.status.event.animateUI) return; - if (core.status.event.interval != null) return; - const current = core.clone(core.status.event.data.current); - current.showAll = true; - current.time = 0; - current.sound = ""; - current.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除当前事件所有打字机效果 - cg.style.display = "none"; - const data = [{ type: "callSave" }, current]; //插入存档事件 - core.insertAction(data); + const data = core.clone(core.status.event.data.current); + data.showAll = true; + data.time = 0; + data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 + data.sound = ""; + core.insertAction(data); + core.doAction(); + } else if ( + (core.domStyle.isVertical && + inRect(pos, saveboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, savebox)) + ) { + //存档 + auto = false; + if (core.status.event.animateUI) return; + if (core.status.event.interval != null) return; + const current = core.clone(core.status.event.data.current); + current.showAll = true; + current.time = 0; + current.sound = ""; + current.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除当前事件所有打字机效果 + cg.style.display = "none"; + const data = [{ type: "callSave" }, current]; //插入存档事件 + core.insertAction(data); - core.doAction(); - } else if (!core.status.event.data) { - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } else { - // 正在淡入淡出的话不执行 - if (core.status.event.animateUI) return; - auto = false; + core.doAction(); + } else if (!core.status.event.data) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } else { + // 正在淡入淡出的话不执行 + if (core.status.event.animateUI) return; + auto = false; - // 打字机效果显示全部文字 - if (core.status.event.interval != null) { - const data = core.clone(core.status.event.data?.current); - data.showAll = true; - data.time = 0; - data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 - data.sound = ""; - core.insertAction(data); - core.doAction(); - return; - } else { - core.stopSound(this.beforeSound); - } + // 打字机效果显示全部文字 + if (core.status.event.interval != null) { + const data = core.clone(core.status.event.data?.current); + data.showAll = true; + data.time = 0; + data.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除打字机暂停效果 + data.sound = ""; + core.insertAction(data); + core.doAction(); + return; + } else { + core.stopSound(this.beforeSound); + } - cg.style.display = "none"; + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + } + } - core.doAction(); - } - } - } + drawTextContent(ctx, content, config) { + //绘制多行文字并执行打字机效果 - drawTextContent(ctx, content, config) { - //绘制多行文字并执行打字机效果 + ctx = core.getContextByName(ctx); + // 设置默认配置项 + var textAttribute = + core.status.textAttribute || core.initStatus.textAttribute; + var globalAttribute = + core.status.globalAttribute || core.initStatus.globalAttribute; + config = core.clone(config || {}); + config.left = config.left || 0; + config.right = + config.left + (config.maxWidth == null ? core._PX_ : config.maxWidth); + config.top = config.top || 0; + config.color = core.arrayToRGBA(config.color || textAttribute.text); + if (config.bold == null) config.bold = textAttribute.bold; + config.italic = config.italic || false; + config.align = config.align || textAttribute.align || "left"; + config.fontSize = config.fontSize || textAttribute.textfont; + config.lineHeight = config.lineHeight || config.fontSize * 1.3; + config.defaultFont = config.font = config.font || globalAttribute.font; + config.time = config.time || 0; + config.letterSpacing = + config.letterSpacing == null ? + textAttribute.letterSpacing || 0 : + config.letterSpacing; - ctx = core.getContextByName(ctx); - // 设置默认配置项 - var textAttribute = - core.status.textAttribute || core.initStatus.textAttribute; - var globalAttribute = - core.status.globalAttribute || core.initStatus.globalAttribute; - config = core.clone(config || {}); - config.left = config.left || 0; - config.right = - config.left + (config.maxWidth == null ? core._PX_ : config.maxWidth); - config.top = config.top || 0; - config.color = core.arrayToRGBA(config.color || textAttribute.text); - if (config.bold == null) config.bold = textAttribute.bold; - config.italic = config.italic || false; - config.align = config.align || textAttribute.align || "left"; - config.fontSize = config.fontSize || textAttribute.textfont; - config.lineHeight = config.lineHeight || config.fontSize * 1.3; - config.defaultFont = config.font = config.font || globalAttribute.font; - config.time = config.time || 0; - config.letterSpacing = - config.letterSpacing == null - ? textAttribute.letterSpacing || 0 - : config.letterSpacing; + config.index = 0; + config.currcolor = config.color; + config.currfont = config.fontSize; + config.lineMargin = Math.max( + Math.round(config.fontSize / 4), + config.lineHeight - config.fontSize + ); + config.topMargin = parseInt(config.lineMargin / 2); + config.lineMaxHeight = config.lineMargin + config.fontSize; + config.offsetX = 0; + config.offsetY = 0; + config.line = 0; + config.blocks = []; + config.isHD = ctx == null || ctx.canvas.hasAttribute("isHD"); - config.index = 0; - config.currcolor = config.color; - config.currfont = config.fontSize; - config.lineMargin = Math.max( - Math.round(config.fontSize / 4), - config.lineHeight - config.fontSize - ); - config.topMargin = parseInt(config.lineMargin / 2); - config.lineMaxHeight = config.lineMargin + config.fontSize; - config.offsetX = 0; - config.offsetY = 0; - config.line = 0; - config.blocks = []; - config.isHD = ctx == null || ctx.canvas.hasAttribute("isHD"); + // 创建一个新的临时画布 + var tempCtx = document.createElement("canvas").getContext("2d"); + if (config.isHD && ctx) { + core.maps._setHDCanvasSize( + tempCtx, + ctx.canvas.width, + ctx.canvas.height + ); + } else { + tempCtx.canvas.width = ctx == null ? 1 : ctx.canvas.width; + tempCtx.canvas.height = ctx == null ? 1 : ctx.canvas.height; + } - // 创建一个新的临时画布 - var tempCtx = document.createElement("canvas").getContext("2d"); - if (config.isHD && ctx) { - core.maps._setHDCanvasSize( - tempCtx, - ctx.canvas.width, - ctx.canvas.height - ); - } else { - tempCtx.canvas.width = ctx == null ? 1 : ctx.canvas.width; - tempCtx.canvas.height = ctx == null ? 1 : ctx.canvas.height; - } + tempCtx.textBaseline = "top"; + tempCtx.font = core.ui._buildFont( + config.fontSize, + config.bold, + config.italic, + config.font + ); + tempCtx.fillStyle = config.color; + config = this._drawTextContent_draw(ctx, tempCtx, content, config); + return config; + } + _drawTextContent_draw(ctx, tempCtx, content, config) { + // Step 1: 绘制到tempCtx上,并记录下图块信息 + while (core.ui._drawTextContent_next(tempCtx, content, config)); - tempCtx.textBaseline = "top"; - tempCtx.font = core.ui._buildFont( - config.fontSize, - config.bold, - config.italic, - config.font - ); - tempCtx.fillStyle = config.color; - config = this._drawTextContent_draw(ctx, tempCtx, content, config); - return config; - } - _drawTextContent_draw(ctx, tempCtx, content, config) { - // Step 1: 绘制到tempCtx上,并记录下图块信息 - while (core.ui._drawTextContent_next(tempCtx, content, config)); + if (ctx == null) return config; - if (ctx == null) return config; + // Step 2: 从tempCtx绘制到画布上 + config.index = 0; + var _drawNext = function () { + if (config.index >= config.blocks.length) return false; + var block = config.blocks[config.index++]; + if (block != null) { + // It works, why? + const scale = config.isHD ? + devicePixelRatio * core.domStyle.scale : + 1; + ctx.restore(); + ctx.save(); //保存设置 + if (core.domStyle.isVertical) { + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } + ctx.drawImage( + tempCtx.canvas, + block.left * scale, + block.top * scale, + block.width * scale, + block.height * scale, + config.left + block.left + block.marginLeft, + config.top + block.top + block.marginTop, + block.width, + block.height + ); + ctx.restore(); + } + return true; + }; - // Step 2: 从tempCtx绘制到画布上 - config.index = 0; - var _drawNext = function () { - if (config.index >= config.blocks.length) return false; - var block = config.blocks[config.index++]; - if (block != null) { - // It works, why? - const scale = config.isHD - ? devicePixelRatio * core.domStyle.scale - : 1; - ctx.restore(); - ctx.save(); //保存设置 - if (core.domStyle.isVertical) { - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } - ctx.drawImage( - tempCtx.canvas, - block.left * scale, - block.top * scale, - block.width * scale, - block.height * scale, - config.left + block.left + block.marginLeft, - config.top + block.top + block.marginTop, - block.width, - block.height - ); - ctx.restore(); - } - return true; - }; + if (config.time == 0) { + while (_drawNext()); - if (config.time == 0) { - while (_drawNext()); + if ( + (auto && !core.ui.cgText.WindowSkin && !core.ui.cgText.sound) || + (core.ui.cgText.sound && !core.musicStatus.soundStatus) + ) { + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, core.ui.cgText.wait); + } + } else { + clearInterval(core.status.event.interval); + core.status.event.interval = setInterval(function () { + if (!_drawNext()) { + clearInterval(core.status.event.interval); + core.status.event.interval = null; - if ( - (auto && !core.ui.cgText.WindowSkin && !core.ui.cgText.sound) || - (core.ui.cgText.sound && !core.musicStatus.soundStatus) - ) { - setTimeout(() => { - if (auto) { - cg.style.display = "none"; + if ( + (auto && !core.ui.cgText.WindowSkin && !core.ui.cgText.sound) || + (core.ui.cgText.sound && !core.musicStatus.soundStatus) + ) + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, core.ui.cgText.wait); + } + }, config.time); + } - core.doAction(); - } - }, core.ui.cgText.wait); - } - } else { - clearInterval(core.status.event.interval); - core.status.event.interval = setInterval(function () { - if (!_drawNext()) { - clearInterval(core.status.event.interval); - core.status.event.interval = null; + return config; + } - if ( - (auto && !core.ui.cgText.WindowSkin && !core.ui.cgText.sound) || - (core.ui.cgText.sound && !core.musicStatus.soundStatus) - ) - setTimeout(() => { - if (auto) { - cg.style.display = "none"; + update() { + this.background(); + if (this.log) this.logdraw(this.page); + } + logdraw(page) { + if (core.domStyle.isVertical) { + logctx.canvas.width = 1248; + logctx.canvas.height = 2028; + logctx.save(); //保存设置 + logctx.translate(1248, 0); //重新定位右上角为基准 + logctx.rotate(Math.PI / 2); //旋转90度 + } else { + logctx.canvas.width = 2028; + logctx.canvas.height = 1248; + } + core.fillRect(logctx, 0, 0, 2028, 1248, "rgba(0,0,0,0.5)"); + core.setTextAlign(logctx, "center"); + core.fillBoldText1( + logctx, + "◀离开", + 110, + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + logctx.strokeStyle = "#FFFFFF"; + logctx.lineWidth = 3; + logctx.beginPath(); + logctx.moveTo(100, 150); + logctx.lineTo(1928, 150); - core.doAction(); - } - }, core.ui.cgText.wait); - } - }, config.time); - } + logctx.stroke(); + let posy = 150; + const indexList = this.textList; + core.setTextAlign(logctx, "left"); + for ( + let i = (page - 1) * 6; i <= Math.min(this.index, page * 6 - 1); i++ + ) { + const text = this.textList[i][1].replaceAll( + /(\\(d|e|f|g|i|n|r|b|c|t|z))(\[.*?\])?/g, + "" + ); //取消打字机 + const name = this.textList[i][0] ? + "【" + this.textList[i][0] + "】" : + ""; + if (name) { + core.fillBoldText1( + logctx, + name, + 150, + posy + 50, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + } + if (text.length < 30) { + core.fillBoldText1( + logctx, + text, + 650, + posy + 50, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + } else { + let text1 = text.slice(0, 30); + core.fillBoldText1( + logctx, + text1, + 650, + posy + 50, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + if (text.length > 60) { + let text2 = text.slice(30, 60); + let text3 = text.slice(60); + core.fillBoldText1( + logctx, + text2, + 650, + posy + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + core.fillBoldText1( + logctx, + text3, + 650, + posy + 150, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + } else { + let text2 = text.slice(30); + core.fillBoldText1( + logctx, + text2, + 650, + posy + 100, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(42, true) + ); + } + } - return config; - } + logctx.strokeStyle = "#FFFFFF"; + logctx.lineWidth = 3; + logctx.beginPath(); + logctx.moveTo(100, posy); + logctx.lineTo(1928, posy); + logctx.stroke(); - update() { - this.background(); - if (this.log) this.logdraw(this.page); - } - logdraw(page) { - if (core.domStyle.isVertical) { - logctx.canvas.width = 1248; - logctx.canvas.height = 2028; - logctx.save(); //保存设置 - logctx.translate(1248, 0); //重新定位右上角为基准 - logctx.rotate(Math.PI / 2); //旋转90度 - } else { - logctx.canvas.width = 2028; - logctx.canvas.height = 1248; - } - core.fillRect(logctx, 0, 0, 2028, 1248, "rgba(0,0,0,0.5)"); - core.setTextAlign(logctx, "center"); - core.fillBoldText1( - logctx, - "◀离开", - 110, - 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - logctx.strokeStyle = "#FFFFFF"; - logctx.lineWidth = 3; - logctx.beginPath(); - logctx.moveTo(100, 150); - logctx.lineTo(1928, 150); + posy += 160; + } + logctx.beginPath(); + logctx.moveTo(100, 1120); + logctx.lineTo(1928, 1120); + logctx.moveTo(100, 1110); + logctx.lineTo(1928, 1110); + logctx.stroke(); + core.fillBoldText1( + logctx, + "上一页", + 300, + 1200, + page === 1 ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); - logctx.stroke(); - let posy = 150; - const indexList = this.textList; - core.setTextAlign(logctx, "left"); - for ( - let i = (page - 1) * 6; - i <= Math.min(this.index, page * 6 - 1); - i++ - ) { - const text = this.textList[i][1].replaceAll( - /(\\(d|e|f|g|i|n|r|b|c|t|z))(\[.*?\])?/g, - "" - ); //取消打字机 - const name = this.textList[i][0] - ? "【" + this.textList[i][0] + "】" - : ""; - if (name) { - core.fillBoldText1( - logctx, - name, - 150, - posy + 50, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - } - if (text.length < 30) { - core.fillBoldText1( - logctx, - text, - 650, - posy + 50, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - } else { - let text1 = text.slice(0, 30); - core.fillBoldText1( - logctx, - text1, - 650, - posy + 50, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - if (text.length > 60) { - let text2 = text.slice(30, 60); - let text3 = text.slice(60); - core.fillBoldText1( - logctx, - text2, - 650, - posy + 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - core.fillBoldText1( - logctx, - text3, - 650, - posy + 150, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - } else { - let text2 = text.slice(30); - core.fillBoldText1( - logctx, - text2, - 650, - posy + 100, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(42, true) - ); - } - } + core.fillBoldText1( + logctx, + page + "/" + this.overpage, + 1000, + 1200, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + core.fillBoldText1( + logctx, + "下一页", + 1500, + 1200, + page === this.overpage ? "#444444" : "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(66, true) + ); + } + background() { + const img = core.material.images.images?.[this.image]; - logctx.strokeStyle = "#FFFFFF"; - logctx.lineWidth = 3; - logctx.beginPath(); - logctx.moveTo(100, posy); - logctx.lineTo(1928, posy); - logctx.stroke(); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 2028; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 2028; + ctx.canvas.height = 1248; + } - posy += 160; - } - logctx.beginPath(); - logctx.moveTo(100, 1120); - logctx.lineTo(1928, 1120); - logctx.moveTo(100, 1110); - logctx.lineTo(1928, 1110); - logctx.stroke(); - core.fillBoldText1( - logctx, - "上一页", - 300, - 1200, - page === 1 ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); + if (img) { + //绘制背景 + if (this.memory) ctx.filter = "sepia(50%)"; + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 2028, 1248); + } + this.bodyList.forEach((v) => { + //绘制立绘 + const body = core.material.images.images?.[v.name]; + if (v.filter) ctx.filter = "brightness(50%)"; + if (body) { + if (!v.w && !v.h && !v.scale) v.scale = 1.7; + if (!v.w && !v.h) { + ctx.drawImage( + body, + 0, + 0, + body.width, + body.height, + v.px, + 1248 - body.height * v.scale, + body.width * v.scale, + body.height * v.scale + ); + } else { + ctx.drawImage( + body, + 0, + 0, + body.width, + body.height, + v.px, + 1248 - (v.h ?? body.height), + v.w ?? body.width, + v.h ?? body.height + ); + } + } + ctx.filter = "none"; + }); + if (core.isPlaying() && !this.WindowSkin) + core.drawWindowSkin( + "winskin.webp", + ctx, + 30, + 780, + 1968, + 436, + null, + null, + null, + 3 + ); //绘制对话框 + const head = core.material.images.images?.[this.head.name]; + if (head) { + //绘制头像 + ctx.drawImage( + head, + 0, + 0, + head.width, + head.height, + this.head.px, + 1248 - head.height * 2.2, + head.width * 2.2, + head.height * 2.2 + ); + } + if (core.isPlaying() && !this.WindowSkin) { + core.drawWindowSkin( + "winskin.webp", + ctx, + 1700, + 800, + 192, + 96, + null, + null, + null, + 3 + ); + core.fillBoldText1( + ctx, + "记 录", + 1736, + 866, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + core.drawWindowSkin( + "winskin.webp", + ctx, + 1700, + 1100, + 192, + 96, + null, + null, + null, + 3 + ); + core.fillBoldText1( + ctx, + "存 档", + 1736, + 1166, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + core.drawWindowSkin( + "winskin.webp", + ctx, + 1700, + 1000, + 192, + 96, + null, + null, + null, + 3 + ); + core.fillBoldText1( + ctx, + "▶▶", + 1756, + 1066, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + core.drawWindowSkin( + "winskin.webp", + ctx, + 1700, + 900, + 192, + 96, + null, + null, + null, + 3 + ); + let autoText = "AUTO"; + if (auto) autoText = "STOP"; + core.fillBoldText1( + ctx, + autoText, + 1722, + 966, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + } + if (this.name) + core.fillBoldText1( + ctx, + `【${this.name}】`, + 550, + 880, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); //绘制名字 - core.fillBoldText1( - logctx, - page + "/" + this.overpage, - 1000, - 1200, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - core.fillBoldText1( - logctx, - "下一页", - 1500, - 1200, - page === this.overpage ? "#444444" : "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(66, true) - ); - } - background() { - const img = core.material.images.images?.[this.image]; + if ( + this.sound && + core.sounds && + !core.getFlag("skip", false) && + core.musicStatus.soundStatus + ) { + this.beforeSound = core.playSound(this.sound, null, () => { + if ( + this.sound && + auto && + !this.WindowSkin && + core.musicStatus.soundStatus + ) { + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, this.wait); + } + }); + } + if (this.text && !core.getFlag("skip", false)) { + //绘制对话 + this.drawTextContent(ctx, this.text, { + left: 550, + top: 950, + bold: true, + color: "#FFFFFF", + align: "left", + fontSize: 48, + time: this.time || 0, + font: "Verdana", + maxWidth: 1000, + }); + } - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 2028; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 2028; - ctx.canvas.height = 1248; - } - - if (img) { - //绘制背景 - if (this.memory) ctx.filter = "sepia(50%)"; - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - this.bodyList.forEach((v) => { - //绘制立绘 - const body = core.material.images.images?.[v.name]; - if (v.filter) ctx.filter = "brightness(50%)"; - if (body) { - if (!v.w && !v.h && !v.scale) v.scale = 1.7; - if (!v.w && !v.h) { - ctx.drawImage( - body, - 0, - 0, - body.width, - body.height, - v.px, - 1248 - body.height * v.scale, - body.width * v.scale, - body.height * v.scale - ); - } else { - ctx.drawImage( - body, - 0, - 0, - body.width, - body.height, - v.px, - 1248 - (v.h ?? body.height), - v.w ?? body.width, - v.h ?? body.height - ); - } - } - ctx.filter = "none"; - }); - if (core.isPlaying() && !this.WindowSkin) - core.drawWindowSkin( - "winskin.webp", - ctx, - 30, - 780, - 1968, - 436, - null, - null, - null, - 3 - ); //绘制对话框 - const head = core.material.images.images?.[this.head.name]; - if (head) { - //绘制头像 - ctx.drawImage( - head, - 0, - 0, - head.width, - head.height, - this.head.px, - 1248 - head.height * 2.2, - head.width * 2.2, - head.height * 2.2 - ); - } - if (core.isPlaying() && !this.WindowSkin) { - core.drawWindowSkin( - "winskin.webp", - ctx, - 1700, - 800, - 192, - 96, - null, - null, - null, - 3 - ); - core.fillBoldText1( - ctx, - "记 录", - 1736, - 866, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - core.drawWindowSkin( - "winskin.webp", - ctx, - 1700, - 1100, - 192, - 96, - null, - null, - null, - 3 - ); - core.fillBoldText1( - ctx, - "存 档", - 1736, - 1166, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - core.drawWindowSkin( - "winskin.webp", - ctx, - 1700, - 1000, - 192, - 96, - null, - null, - null, - 3 - ); - core.fillBoldText1( - ctx, - "▶▶", - 1756, - 1066, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - core.drawWindowSkin( - "winskin.webp", - ctx, - 1700, - 900, - 192, - 96, - null, - null, - null, - 3 - ); - let autoText = "AUTO"; - if (auto) autoText = "STOP"; - core.fillBoldText1( - ctx, - autoText, - 1722, - 966, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - } - if (this.name) - core.fillBoldText1( - ctx, - `【${this.name}】`, - 550, - 880, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); //绘制名字 - - if ( - this.sound && - core.sounds && - !core.getFlag("skip", false) && - core.musicStatus.soundStatus - ) { - this.beforeSound = core.playSound(this.sound, null, () => { - if ( - this.sound && - auto && - !this.WindowSkin && - core.musicStatus.soundStatus - ) { - setTimeout(() => { - if (auto) { - cg.style.display = "none"; - - core.doAction(); - } - }, this.wait); - } - }); - } - if (this.text && !core.getFlag("skip", false)) { - //绘制对话 - this.drawTextContent(ctx, this.text, { - left: 550, - top: 950, - bold: true, - color: "#FFFFFF", - align: "left", - fontSize: 48, - time: this.time || 0, - font: "Verdana", - maxWidth: 1000, - }); - } - - ctx.restore(); - } - } - core.ui.cgText = new cgText(); - }, - 旁白: function () { + ctx.restore(); + } + } + core.ui.cgText = new cgText(); +}, + "旁白": function () { // 在此增加新插件 const over = document.createElement("canvas"); //over画布设置 over.style.position = "absolute"; @@ -16579,7 +16578,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 回合制boss战: function () { + "回合制boss战": function () { // 在此增加新插件 const boss = document.createElement("canvas"); //boss战画布设置 boss.style.position = "absolute"; @@ -16627,7 +16626,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } core.ui.boss = new boss1(); }, - 剧情视频引用: function () { + "剧情视频引用": function () { // 在此增加新插件 let a; let bgm; @@ -16810,7 +16809,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - "帧动画/图片叠拼": function () { + "帧动画/图片叠拼": function () { // 在此增加新插件 this.animationDrawable = function ( allFarme, @@ -16932,7 +16931,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ); }; }, - musicMode: function () { + "musicMode": function () { // 在此增加新插件 const music = document.createElement("canvas"); music.style.position = "absolute"; @@ -18068,7 +18067,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - 横屏切换: function () { + "横屏切换": function () { // 在此增加新插件 this.triggerFullscreen = async function (full) { if (!!document.fullscreenElement && !full) { @@ -18106,7 +18105,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }; }, - 图片压缩webp导出: function () { + "图片压缩webp导出": function () { // 在此增加新插件 //使用方法:进入游戏后开始游戏,F12打开控制台,输入core.towebp(image),image为已在全塔属性中注册过的图片名字,需要""括起来 this.towebp = function (image) { @@ -18137,7 +18136,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - "帧动画特效(游戏界面)": function () { + "帧动画特效(游戏界面)": function () { // 在此增加新插件 const animate2 = document.createElement("canvas"); //画布设置 animate2.style.zIndex = 91; @@ -18333,7 +18332,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { } }); }, - "intro&loop": function () { + "intro&loop": function () { // 在此增加新插件 this.introAndLoop = function (intro, time, loop) { core.playBgm(intro); @@ -18342,7 +18341,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }, time * 1000); }; }, - 开局选项悬停: function () { + "开局选项悬停": function () { // 在此增加新插件 main.dom.playGame.addEventListener("mouseenter", () => { @@ -18425,7 +18424,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.dom.replayGame.style.backgroundColor = "transparent"; }); }, - 天气叠加: function () { + "天气叠加": function () { //使用方法:使用core.setWeather(天气,等级)来增加天气,使用core.setWeather()来清空天气 // 天气叠加功能 ////// 更改天气效果 ////// @@ -18677,7 +18676,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ); }; }, - 回合战斗动画: function () { + "回合战斗动画": function () { // 在此增加新插件 const animateAttack = document.createElement("canvas"); //画布设置 animateAttack.style.zIndex = 80; @@ -18823,7 +18822,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { }); }; }, - 剧情内容: function () { + "剧情内容": function () { // 在此增加新插件 // 每项为一个数组,第一项是名字,第二项是对话内容 // 回放只会在同一个this下回放,进入剧情前请以事件块声明进入哪个剧情数组 @@ -19393,5 +19392,5 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { ["梅尔特", "「我忘记了」"], ["吉克", "「骗人」"], ]; - }, -}; + } +} \ No newline at end of file