From 239770edda15f57d2cf7227fda7f9c249d77dae1 Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Sun, 30 Mar 2025 18:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E8=AF=BB=E6=A1=A3=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/ui.js | 1 + project/data.js | 4 - project/floors/chushi.js | 8 +- project/floors/jiaocheng03.js | 4 + project/functions.js | 186 ++-- project/plugins.js | 1862 ++++++++++++++++++++++++++++----- 6 files changed, 1725 insertions(+), 340 deletions(-) diff --git a/libs/ui.js b/libs/ui.js index bcead0e..b9c879b 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1270,6 +1270,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch) // 输出 var left = config.offsetX, top = config.offsetY + config.topMargin; core.fillText(tempCtx, ch, left, top); + tempCtx.strokeText(ch, left, top); config.blocks.push({ left: config.offsetX, top: config.offsetY, width: charwidth, height: config.currfont + config.lineMargin, diff --git a/project/data.js b/project/data.js index 639eec5..7ce2e10 100644 --- a/project/data.js +++ b/project/data.js @@ -1946,10 +1946,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = { "type": "insert", "name": "强制横屏" - }, - { - "type": "insert", - "name": "chapter0" } ], "shops": [ diff --git a/project/floors/chushi.js b/project/floors/chushi.js index 132abcb..6f105c1 100644 --- a/project/floors/chushi.js +++ b/project/floors/chushi.js @@ -1,7 +1,7 @@ main.floors.chushi= { "floorId": "chushi", - "title": "抉择", + "title": "开场剧情", "name": "1", "width": 13, "height": 13, @@ -12,6 +12,10 @@ main.floors.chushi= "ratio": 1, "defaultGround": "T400", "firstArrive": [ + { + "type": "insert", + "name": "chapter0" + }, { "type": "confirm", "text": "要进行教程内容吗", @@ -63,7 +67,7 @@ main.floors.chushi= [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ], - "areas": "抉择", + "areas": "开场剧情", "bgmap": [ ], diff --git a/project/floors/jiaocheng03.js b/project/floors/jiaocheng03.js index f1c4dc7..aafa50a 100644 --- a/project/floors/jiaocheng03.js +++ b/project/floors/jiaocheng03.js @@ -22,6 +22,10 @@ main.floors.jiaocheng03= "法杖:魔攻比例10%,魔防比例0%" ], "6,0": [ + { + "type": "setHeroOpacity", + "opacity": 0 + }, { "type": "changeFloor", "floorId": "guangchang", diff --git a/project/functions.js b/project/functions.js index b4d6018..28c3fd3 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1557,90 +1557,116 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }, "control": { "saveData": function () { - // 存档操作,此函数应该返回“具体要存档的内容” + // 存档操作,此函数应该返回“具体要存档的内容” - // 差异化存储values - var values = {}; - for (var key in core.values) { - if (!core.same(core.values[key], core.data.values[key])) - values[key] = core.clone(core.values[key]); - } - - // 要存档的内容 - var data = { - floorId: core.status.floorId, - hero: core.clone(core.status.hero), - hard: core.status.hard, - maps: core.clone(core.maps.saveMap()), - route: core.encodeRoute(core.status.route), - values: values, - version: core.firstData.version, - guid: core.getGuid(), - time: new Date().getTime(), - 'material': core.clone(core.material.enemys) - }; - return data; - }, + // 差异化存储values + var values = {}; + for (var key in core.values) { + if (!core.same(core.values[key], core.data.values[key])) + values[key] = core.clone(core.values[key]); + } + let cg = {} + if (core.getFlag("_cgText")) { + cg.index = core.ui.cgText.index + cg.head = core.ui.cgText.head + cg.name = core.ui.cgText.name + cg.text = core.ui.cgText.text + cg.bodyList = core.clone(core.ui.cgText.bodyList) + cg.nobg = core.ui.cgText.nobg + cg.image = core.ui.cgText.image + cg.time = core.ui.cgText.time + cg.WindowSkin = core.ui.cgText.WindowSkin + cg.sound = core.ui.cgText.sound + cg.beforeSound = core.ui.cgText.beforeSound + cg.wait = core.ui.cgText.wait + cg.memory = core.ui.cgText.memory + cg.textList = core.ui.cgText.textList + cg.page = core.ui.cgText.page + cg.overpage = core.ui.cgText.overpage + cg.log = core.ui.cgText.log + cg.index = core.ui.cgText.index + } + // 要存档的内容 + var data = { + floorId: core.status.floorId, + hero: core.clone(core.status.hero), + hard: core.status.hard, + maps: core.clone(core.maps.saveMap()), + route: core.encodeRoute(core.status.route), + values: values, + version: core.firstData.version, + guid: core.getGuid(), + time: new Date().getTime(), + cg: cg + }; + return data; +}, "loadData": function (data, callback) { - // 读档操作;从存储中读取了内容后的行为 - const play = core.status.played; - // 重置游戏和路线 - core.resetGame( - data.hero, - data.hard, - data.floorId, - core.maps.loadMap(data.maps, null, data.hero.flags), - data.values - ); - //如果作者造塔想随时修改怪物属性平衡数值,请注释下面这行。该行作用为保存怪物当前属性,用以储存临时修改的怪物属性。 - core.material.enemys = data.material ?? core.material.enemys; - core.status.route = core.decodeRoute(data.route); - core.control._bindRoutePush(); - // 文字属性,全局属性 - core.status.textAttribute = core.getFlag( - "textAttribute", - core.status.textAttribute - ); - var toAttribute = core.getFlag( - "globalAttribute", - core.status.globalAttribute - ); - if (!core.same(toAttribute, core.status.globalAttribute)) { - core.status.globalAttribute = toAttribute; - core.resize(); - } - // 重置音量 - core.events.setVolume(core.getFlag("__volume__", 1), 0); - // 加载勇士图标 - var icon = core.status.hero.image; - icon = core.getMappedName(icon); - if (core.material.images.images[icon]) { - core.material.images.hero = core.material.images.images[icon]; - core.material.icons.hero.width = - core.material.images.images[icon].width / 4; - core.material.icons.hero.height = - core.material.images.images[icon].height / 4; - } - core.setFlag("__fromLoad__", true); + // 读档操作;从存储中读取了内容后的行为 + const play = core.status.played; + // 重置游戏和路线 + core.resetGame( + data.hero, + data.hard, + data.floorId, + core.maps.loadMap(data.maps, null, data.hero.flags), + data.values + ); + core.status.route = core.decodeRoute(data.route); + core.control._bindRoutePush(); + // 文字属性,全局属性 + core.status.textAttribute = core.getFlag( + "textAttribute", + core.status.textAttribute + ); + var toAttribute = core.getFlag( + "globalAttribute", + core.status.globalAttribute + ); + if (!core.same(toAttribute, core.status.globalAttribute)) { + core.status.globalAttribute = toAttribute; + core.resize(); + } + // 重置音量 + core.events.setVolume(core.getFlag("__volume__", 1), 0); + // 加载勇士图标 + var icon = core.status.hero.image; + icon = core.getMappedName(icon); + if (core.material.images.images[icon]) { + core.material.images.hero = core.material.images.images[icon]; + core.material.icons.hero.width = + core.material.images.images[icon].width / 4; + core.material.icons.hero.height = + core.material.images.images[icon].height / 4; + } + core.setFlag("__fromLoad__", true); - // TODO:增加自己的一些读档处理 - core.ui.statusBar.clearItemInfo(); - core.ui.statusBar.update(); - core.plugin.playing.clear(); - // 切换到对应的楼层 - core.changeFloor(data.floorId, null, data.hero.loc, 0, function () { - // TODO:可以在这里设置读档后播放BGM - if (core.hasFlag("__bgm__")) { - // 持续播放 - core.playBgm(core.getFlag("__bgm__")); - } + // TODO:增加自己的一些读档处理 + core.ui.statusBar.clearItemInfo(); + core.ui.statusBar.update(); + if (core.getFlag("_cgText")) { + core.setFlag("_cgText", false) + for (let v in data.cg) { - core.removeFlag("__fromLoad__"); - if (!play) core.insertCommonEvent("强制横屏"); - if (callback) callback(); - }); - if (play) core.doAction(); - }, + core.ui.cgText[v] = data.cg[v] + } + core.drawbackground(core.ui.cgText.image, core.ui.cgText.memory) + } + core.plugin.playing.clear(); + // 切换到对应的楼层 + core.changeFloor(data.floorId, null, data.hero.loc, 0, function () { + // TODO:可以在这里设置读档后播放BGM + if (core.hasFlag("__bgm__")) { + // 持续播放 + core.playBgm(core.getFlag("__bgm__")); + } + + core.removeFlag("__fromLoad__"); + if (!play) core.insertCommonEvent("强制横屏"); + if (callback) callback(); + }); + if (play) core.doAction(); +}, "getStatusLabel": function (name) { // 返回某个状态英文名的对应中文标签,如atk -> 攻击,def -> 防御等。 // 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等) diff --git a/project/plugins.js b/project/plugins.js index 08e4579..da57179 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -34,9 +34,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.drawbackground(data.image, data.memory); core.ui.cgText.image = data.image; core.ui.cgText.memory = data.memory; - } else { - core.doAction(); + } + core.doAction(); }); core.registerEvent("clearbackground", function (data) { if (!main.replayChecking && !core.isReplaying()) { @@ -211,7 +211,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } }); core.registerEvent("cgtextList", function (data) { - core.ui.cgText.textList = core.plugin[data.textList]; + core.ui.cgText.textList = data.textList; core.doAction(); }); core.registerEvent("cgtext", function (data) { @@ -219,17 +219,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.cgText.head = core.clone(data.head); core.ui.cgText.index = data.index; - core.ui.cgText.name = core.ui.cgText.textList[data.index][0]; + core.ui.cgText.name = core.plugin[core.ui.cgText.textList][data.index][0]; core.ui.cgText.text = data.text ? data.text : - core.ui.cgText.textList[data.index][1]; + core.plugin[core.ui.cgText.textList][data.index][1]; core.ui.cgText.time = data.time; core.ui.cgText.wait = data.wait; core.ui.cgText.WindowSkin = data.WindowSkin; core.ui.cgText.sound = data.sound === "" ? data.sound : - core.ui.cgText.textList[data.index][2] || ""; + core.plugin[core.ui.cgText.textList][data.index][2] || ""; core.ui.cgText.bodyList = core.clone(data.bodyList); main.dom.cgText.style.display = "block"; core.ui.cgText.update(); @@ -2752,6 +2752,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = main.dom.boss7.style.height = obj.totalHeight + 3 + "px"; main.dom.boss8.style.width = obj.totalWidth + 3 + "px"; main.dom.boss8.style.height = obj.totalHeight + 3 + "px"; + main.dom.saveLoad.style.width = obj.totalWidth + 3 + "px"; main.dom.saveLoad.style.height = obj.totalHeight + 3 + "px"; main.dom.boss.style.width = obj.totalWidth + 3 + "px"; main.dom.boss.style.height = obj.totalHeight + 3 + "px"; @@ -4511,6 +4512,30 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.actions._sys_ondown_lockControl, 30 ); + ////// 结束一切事件和绘制,关闭UI窗口,返回游戏进程 ////// + ui.prototype.closePanel = function () { + core.dom.saveLoad.style.display = "none" + if (core.status.hero && core.status.hero.flags) { + // 清除全部临时变量 + Object.keys(core.status.hero.flags).forEach(function (name) { + if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) { + delete core.status.hero.flags[name]; + } + }); + } + this.clearUI(); + core.maps.generateGroundPattern(); + core.updateStatusBar(true); + core.unlockControl(); + core.status.event.data = null; + core.status.event.id = null; + core.status.event.selection = null; + core.status.event.ui = null; + core.status.event.interval = null; + // 清除onDownInterval + clearInterval(core.interval.onDownInterval); + core.interval.onDownInterval = 'tmp'; + } ////// 绘制提示同时播放错误音效 ////// ui.prototype.drawFailTip = function (text, id, frame) { this.drawTip(text, id, frame); @@ -7105,6 +7130,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.ui.closePanel = function () { + core.dom.saveLoad.style.display = "none" if (core.status.hero && core.status.hero.flags) { // 清除全部临时变量 Object.keys(core.status.hero.flags).forEach(function (name) { @@ -15898,7 +15924,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.beforeSound = 0; this.wait = 1000; this.memory = false; - this.textList = []; + this.textList = ""; this.page = 1; this.overpage = 1; this.log = false; @@ -16062,7 +16088,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = current.sound = ""; current.text = this.text.replaceAll(/(\\(z))(\[.*?\])?/g, ""); //去除当前事件所有打字机效果 cg.style.display = "none"; - const data = [{ type: "callSave" }, current]; //插入存档事件 + core.setFlag("_cgText", true) + const data = [{ type: "callSave" }, { "type": "setValue", "name": "flag:_cgText", "value": "false" }, current]; //插入存档事件 core.insertAction(data); core.doAction(); @@ -16770,7 +16797,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (img) { //绘制背景 if (memory) ctx.filter = "sepia(50%)"; - ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); + core.drawImage(ctx, img, 0, 0, 676 * 3, 416 * 3); ctx.filter = "none"; } else { core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); @@ -17019,7 +17046,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (img2) { //绘制背景 if (memory2) ctx.filter = "sepia(50%)"; - ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + core.drawImage(ctx, img2, 0, 0, 676 * 3, 1248); ctx.filter = "none"; } else { core.fillRect(ctx, 0, 0, 676 * 3, 1248); @@ -17054,7 +17081,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (img1) { //绘制背景 if (memory1) ctx.filter = "sepia(50%)"; - ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + core.drawImage(ctx, img1, 0, 0, 676 * 3, 1248); ctx.filter = "none"; } else { core.fillRect(ctx, 0, 0, 676 * 3, 1248); @@ -17091,7 +17118,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (img1) { //绘制背景 if (memory1) ctx.filter = "sepia(50%)"; - ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + core.drawImage(ctx, img1, 0, 0, 676 * 3, 1248); ctx.filter = "none"; } else { core.fillRect(ctx, 0, 0, 676 * 3, 1248); @@ -17100,7 +17127,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (img2) { //绘制背景 if (memory2) ctx.filter = "sepia(50%)"; - ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + core.drawImage(ctx, img2, 0, 0, 676 * 3, 1248); ctx.filter = "none"; } else { core.fillRect(ctx, 0, 0, 676 * 3, 1248); @@ -17121,8 +17148,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } }; this.drawbackground = function (image, memory) { - const img = core.material.images.images?.[this.image]; - over.style.display = "block"; + if (core.domStyle.isVertical) { ctx.canvas.width = 1248; ctx.canvas.height = 2028; @@ -17134,16 +17160,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx.canvas.height = 1248; } - if (img) { - //绘制背景 - if (memory) ctx.filter = "sepia(70%)"; - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } + over.style.display = "block"; + + //绘制背景 + if (memory) ctx.filter = "sepia(70%)"; + core.drawImage(ctx, image, 0, 0, 2028, 1248); + ctx.filter = "none"; ctx.restore(); - core.doAction(); + } this.clearbackground = function () { @@ -23667,6 +23691,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = saveLoad.style.transform = "translate(-50%,-50%)"; const ctx = saveLoad.getContext("2d"); main.dom.saveLoad = saveLoad + let cg = false + let choose = false //////存读档界面更新 class SL { constructor() { @@ -23674,6 +23700,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.refresh = false; this.page = 0; this.max_page = 1000 + this.id = "" } update() { @@ -23687,26 +23714,603 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = setPage(page = this.page) { this.page = page } + setOffset(offset = this.offset) { + this.offset = offset + } setMax_page(max_page = this.max_page) { this.max_page = max_page } + setId(id) { + this.id = id + } } core.saveLoad = new SL() + saveLoad.onclick = function (e) { //画布点击监听 + try { + e.preventDefault(); + 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); + + let x, y; + if (core.domStyle.isVertical) { //对竖屏进行坐标转换 + x = py * 3; + y = 1248 - px * 3; + } else { + x = px * 3; + y = py * 3; + } + saveLoadclick(x, y) + } catch (ee) { + main.log(ee); + } + } + ////// 删除某个存档 + control.prototype.removeSave = function (index, callback) { + if (index == 0 || index == "autoSave") { + index = "autoSave"; + core.removeLocalForage(index, function () { + core.saves.autosave.data = null; + core.saves.autosave.updated = false; + if (callback) callback(); + }); + return; + } + core.removeLocalForage( + "save" + index, + function () { + core.saves.favorite = core.saves.favorite.filter(function (i) { + return core.hasSave(i); + }); + delete core.saves.favoriteName[index]; + core.setLocalStorage("_slText" + index) + core.control._updateFavoriteSaves(); + if (callback) callback(); + }, + function () { + core.playSound("操作失败"); + core.drawTip("无法删除存档!"); + if (callback) callback(); + } + ); + }; + + function saveLoadclick(x, y) { //点击画布(x,y)触发的效果 + const makeBox = ([x, y], [w, h]) => { //创建点击检测区域 + return [ + [x, y], + [x + w, y + h], + ]; + }; + const pos = [x, y]; //创建点击坐标pos + const inRect = ([x, y], [ //检测点击坐标是否在检测区域中 + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + let page = core.status.event.data.page, + offset = core.status.event.data.offset; + let index = page * 10 + offset; + + const upbox = makeBox([675, 370], [100, 100]); + const upupbox = makeBox([675, 260], [100, 110]); + const upupupbox = makeBox([675, 150], [100, 120]); + const downbox = makeBox([675, 660], [100, 100]); + const downdownbox = makeBox([675, 760], [100, 110]); + const downdowndownbox = makeBox([675, 870], [100, 120]); + const addbox = makeBox([650, 1010], [150, 100]); + const modebox = makeBox([30, 124], [270, 1000]); + const save0box = makeBox([300, 100], [350, 124]); + const savebox = makeBox([300, 224], [350, 800]); + const save9box = makeBox([300, 1024], [350, 124]); + const backbox = makeBox([1750, 1150], [200, 100]); + const savenamebox = makeBox([800, 970], [250, 70]); + const classnamebox = makeBox([800, 1070], [250, 70]); + const savetextbox = makeBox([1050, 982], [640, 150]); + const cgbox = makeBox([1200, 1150], [300, 100]) + const changebox = makeBox([1700, 970], [200, 70]) + const deletebox = makeBox([1700, 1070], [200, 70]) + const gobox = makeBox([800, 100], [1050, 870]) + const favbox = makeBox([900, 300], [500, 110]) + const class1box = makeBox([900, 410], [500, 110]) + const class2box = makeBox([900, 520], [500, 110]) + const class3box = makeBox([900, 630], [500, 110]) + const class4box = makeBox([900, 740], [500, 110]) + const class5box = makeBox([1400, 300], [500, 110]) + const class6box = makeBox([1400, 410], [500, 110]) + const class7box = makeBox([1400, 520], [500, 110]) + const class8box = makeBox([1400, 630], [500, 110]) + const changebackbox = makeBox([1700, 740], [130, 110]) + + if (inRect(pos, upbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page - 1) + offset); + return; + } + if (inRect(pos, upupbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page - 10) + offset); + return; + } + if (inRect(pos, upupupbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page - 100) + offset); + return; + } + if (inRect(pos, downbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page + 1) + offset); + return; + } + if (inRect(pos, downdownbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page + 10) + offset); + return; + } + if (inRect(pos, downdowndownbox)) { + choose = false + core.playSound('光标移动'); + core.ui._drawSLPanel(10 * (page + 100) + offset); + return; + } + if (inRect(pos, backbox)) { + choose = false + if (core.events.recoverEvents(core.status.event.interval)) + return; + core.ui.closePanel(); + delete core.status.tempRoute; + if (!core.isPlaying()) + core.showStartAnimate(true); + return; + } + if (inRect(pos, gobox) && !choose) { + if (offset == 0) + core.doSL("autoSave", core.status.event.id); + else { + var id = 9 * page + offset; + if (core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1]; + if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== 'all') id = core.saves[core.status.event.data.mode][id - 1]; + core.doSL(id, core.status.event.id); + } + return; + } + if (inRect(pos, addbox) && core.status.event.data.mode === "all" && core.getLocalStorage("save_page", 0) !== 8000) { + core.playSound('确定'); + core.setLocalStorage("save_page", core.getLocalStorage("save_page", 0) + 1000) + core.ui._drawSLPanel(10 * page + offset, true); + return; + } + if (inRect(pos, modebox)) { + choose = false + let mode = Math.floor((y - 124) / 100) - 1 + if (mode < 0 && core.status.event.data.mode !== "all") { + core.status.event.data.mode = "all" + page = parseInt((core.saves.saveIndex - 1) / 9); + offset = core.saves.saveIndex - 9 * page; + core.ui._drawSLPanel(0, true); + return; + } + if (mode === 0 && core.status.event.data.mode !== "fav") { + core.status.event.data.mode = "fav" + core.ui._drawSLPanel(0, true); + return; + } + if (mode > 0 && core.status.event.data.mode !== `class_${mode}`) { + core.status.event.data.mode = `class_${mode}` + core.ui._drawSLPanel(0, true); + return; + } + return; + } + + if (inRect(pos, save0box)) { + choose = false + core.saveLoad.setId("autoSave") + if (offset === 0) { + core.doSL("autoSave", core.status.event.id) + return + } + core.ui._drawSLPanel(10 * page) + return; + } + if (inRect(pos, savebox)) { + choose = false + let a = Math.ceil((y - 224) / 100) + let real_id = 9 * page + a + if (real_id == index) { + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[a - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][a - 1] + } + core.saveLoad.setId(real_id) + core.doSL(real_id, core.status.event.id) + return + } else { + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[a - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][a - 1] + } + core.saveLoad.setId(real_id) + } + core.ui._drawSLPanel(10 * page + a) + return; + } + if (inRect(pos, save9box)) { + choose = false + let real_id = 9 * page + 9 + if (real_id == index) { + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + 8] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + 8] + } + core.saveLoad.setId(real_id) + core.doSL(real_id, core.status.event.id) + return + } else { + real_id = core.saves.favorite[9 * page + 8] + + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + 8] + } + core.saveLoad.setId(real_id) + + } + core.ui._drawSLPanel(10 * page + 9) + return; + } + if (inRect(pos, changebox)) { + choose = !choose + core.ui._drawSLPanel(index) + return; + } + if (inRect(pos, deletebox)) { + choose = false + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + core.removeSave(real_id, function () { + core.ui._drawSLPanel(index, true); + }); + return; + } + if (inRect(pos, cgbox)) { + choose = false + cg = !cg + core.ui._drawSLPanel(10 * page + offset, true) + return; + } + if (inRect(pos, savenamebox) && offset !== 0) { + choose = false + + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + + + core.myprompt("请输入想要显示的存档名(长度不超过5字符)", null, function (value) { + if (value && value.length <= 5) { + core.saves.favoriteName[real_id] = value; + core.control._updateFavoriteSaves(); + core.ui._drawSLPanel(10 * page + offset); + } else if (value) { + alert("无效的输入!"); + } else { + delete core.saves.favoriteName[real_id]; + core.control._updateFavoriteSaves(); + core.ui._drawSLPanel(10 * page + offset); + } + }); + + return; + } + if (inRect(pos, savetextbox) && offset !== 0) { + choose = false + + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + + + core.myprompt("请输入存档笔记(长度不超过60字符)", null, function (value) { + if (value && value.length <= 60) { + core.setLocalStorage("_slText" + real_id, value) + core.ui._drawSLPanel(10 * page + offset); + } else if (value) { + alert("无效的输入!"); + } else { + core.setLocalStorage("_slText" + real_id) + core.ui._drawSLPanel(10 * page + offset); + } + }); + + return; + } + if (inRect(pos, classnamebox) && core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + choose = false + + core.myprompt("请输入想要显示的存档分类(长度不超过5字符)", null, function (value) { + if (value && value.length <= 5) { + core.setLocalStorage("slClass_" + core.status.event.data.mode[6], value) + core.ui._drawSLPanel(10 * page + offset); + } else if (value) { + alert("无效的输入!"); + } else { + core.setLocalStorage("slClass_" + core.status.event.data.mode[6]) + core.ui._drawSLPanel(10 * page + offset); + } + }); + + return; + } + if (choose) { + if (inRect(pos, changebackbox)) { + choose = false + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, favbox)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + + let v = core.saves.favorite.indexOf(real_id) + if (v >= 0) { // 已经处于收藏状态:取消收藏 + core.saves.favorite.splice(v, 1); + if (core.status.event.data.mode === "fav") choose = false + } else if (core.hasSave(real_id)) { // 存在存档则进行收藏 + + core.saves.favorite.push(real_id); + + core.saves.favorite = core.saves.favorite.sort(function (a, b) { return a - b; }); // 保证有序 + + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class1box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_1.indexOf(real_id) + if (v >= 0) { + core.saves.class_1.splice(v, 1); + if (core.status.event.data.mode === "class_1") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_1.push(real_id); + core.saves.class_1 = core.saves.class_1.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class2box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_2.indexOf(real_id) + if (v >= 0) { + core.saves.class_2.splice(v, 1); + if (core.status.event.data.mode === "class_2") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_2.push(real_id); + core.saves.class_2 = core.saves.class_2.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class3box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_3.indexOf(real_id) + if (v >= 0) { + core.saves.class_3.splice(v, 1); + if (core.status.event.data.mode === "class_3") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_3.push(real_id); + core.saves.class_3 = core.saves.class_3.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class4box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_4.indexOf(real_id) + if (v >= 0) { + core.saves.class_4.splice(v, 1); + if (core.status.event.data.mode === "class_4") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_4.push(real_id); + core.saves.class_4 = core.saves.class_4.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class5box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_5.indexOf(real_id) + if (v >= 0) { + core.saves.class_5.splice(v, 1); + if (core.status.event.data.mode === "class_5") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_5.push(real_id); + core.saves.class_5 = core.saves.class_5.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class6box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_6.indexOf(real_id) + if (v >= 0) { + core.saves.class_6.splice(v, 1); + if (core.status.event.data.mode === "class_6") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_6.push(real_id); + core.saves.class_6 = core.saves.class_6.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class7box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_7.indexOf(real_id) + if (v >= 0) { + core.saves.class_7.splice(v, 1); + if (core.status.event.data.mode === "class_7") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_7.push(real_id); + core.saves.class_7 = core.saves.class_7.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + if (inRect(pos, class8box)) { + let real_id = 9 * page + offset + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[9 * page + offset - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][9 * page + offset - 1] + } + let v = core.saves.class_8.indexOf(real_id) + if (v >= 0) { + core.saves.class_8.splice(v, 1); + if (core.status.event.data.mode === "class_8") choose = false + } else if (core.hasSave(real_id)) { + core.saves.class_8.push(real_id); + core.saves.class_8 = core.saves.class_8.sort(function (a, b) { return a - b; }); // 保证有序 + } + core.control._updateFavoriteSaves() + core.ui._drawSLPanel(index); + return + } + } + } + ///// 读取收藏信息 + control.prototype._loadFavoriteSaves = function () { + core.saves.favorite = core.getLocalStorage("favorite", []); + // --- 移除不存在的收藏 + core.saves.favorite = core.saves.favorite.filter(function (i) { + return core.hasSave(i); + }); + core.saves.favoriteName = core.getLocalStorage("favoriteName", {}); + }; + + + ///// 读取分类信息 + control.prototype._loadClassSaves = function () { + for (let i = 1; i < 9; i++) { + core.saves["class_" + i] = core.getLocalStorage("class_" + i, []) + core.saves["class_" + i] = core.saves["class_" + i].filter(function (i) { + return core.hasSave(i); + }) + } + + }; + + control.prototype._updateFavoriteSaves = function () { + core.setLocalStorage("favorite", core.saves.favorite); + for (let i = 1; i < 9; i++) { + core.setLocalStorage("class_" + i, core.saves["class_" + i]) + } + core.setLocalStorage("favoriteName", core.saves.favoriteName); + }; ////// 绘制存档/读档界面 ////// ui.prototype._drawSLPanel = function (index, refresh) { + core.control._updateFavoriteSaves() + core.control._loadClassSaves(); core.control._loadFavoriteSaves(); + if (index == null) index = 1; if (index < 0) index = 0; var page = parseInt(index / 10), offset = index % 10; - var max_page = main.savePages || 30; + var max_page = (main.savePages + core.getLocalStorage("save_page", 0)) || 30; if (core.status.event.data && core.status.event.data.mode == 'fav') - max_page = Math.ceil((core.saves.favorite || []).length / 5); + max_page = Math.ceil((core.saves.favorite || []).length / 9); if (page >= max_page) page = max_page - 1; - if (offset > 5) offset = 5; if (core.status.event.data && core.status.event.data.mode == 'fav' && page == max_page - 1) { - offset = Math.min(offset, (core.saves.favorite || []).length - 5 * page); + offset = Math.min(offset, (core.saves.favorite || []).length - 9 * page); + } + if (core.status.event.data && (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== 'all')) + max_page = Math.ceil((core.saves[core.status.event.data.mode] || []).length / 9); + if (page >= max_page) page = max_page - 1; + if (core.status.event.data && (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== 'all') && page == max_page - 1) { + offset = Math.min(offset, (core.saves[core.status.event.data.mode] || []).length - 9 * page); } var last_page = -1; @@ -23717,6 +24321,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.saveLoad.setIndex(index, refresh) core.saveLoad.setPage(page) + core.saveLoad.setOffset(offset) core.saveLoad.setMax_page(max_page) core.status.event.data = { 'page': page, 'offset': offset, 'mode': mode }; core.status.event.ui = core.status.event.ui || []; @@ -23747,61 +24352,222 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.setTextAlign(ctx, 'center'); var bottom = 1248 - 39; - core.fillText(ctx, '返回游戏', 1850, bottom, '#DDDDDD', this._buildFont(45, true)); + core.fillBoldText1( + ctx, + "返回游戏", + 1850, + bottom, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); if (core.status.event.selection) core.setFillStyle(ctx, '#FF6A6A'); - if (core.status.event.id == 'save') - core.fillText(ctx, '删除模式', 1300, bottom); - else { + ctx.strokeStyle = "#DDDDDD"; + ctx.fillStyle = "#BBBB44" + ctx.lineWidth = 6 + ctx.beginPath(); - core.fillText(ctx, '收藏', 100, 800, core.status.event.data.mode == 'all' ? "#DDDDDD" : "#DDDD44"); + ctx.moveTo(300, 124) + ctx.lineTo(60, 124) + ctx.arcTo(30, 124, 30, 224, 30) + ctx.lineTo(30, 194) + ctx.arcTo(30, 224, 300, 224, 30) + ctx.lineTo(300, 224) + ctx.stroke() + if (core.status.event.data.mode === "all") ctx.fill() + ctx.beginPath(); - core.fillText(ctx, '全部', 100, 400, core.status.event.data.mode == 'all' ? "#DDDD44" : "#DDDDDD"); + ctx.moveTo(300, 224) + ctx.lineTo(60, 224) + ctx.arcTo(30, 224, 30, 324, 30) + ctx.lineTo(30, 294) + ctx.arcTo(30, 324, 300, 324, 30) + ctx.lineTo(300, 324) + ctx.stroke() + if (core.status.event.data.mode === "fav") ctx.fill() + ctx.beginPath(); - } - if (core.status.event.id !== 'save') { - ctx.strokeStyle = "#DDDDDD"; - ctx.lineWidth = 6 - ctx.beginPath(); + ctx.moveTo(300, 324) + ctx.lineTo(60, 324) + ctx.arcTo(30, 324, 30, 424, 30) + ctx.lineTo(30, 394) + ctx.arcTo(30, 424, 300, 424, 30) + ctx.lineTo(300, 424) + ctx.stroke() + if (core.status.event.data.mode === "class_1") ctx.fill() + ctx.beginPath(); - ctx.moveTo(60, 624) - if (core.status.event.data.mode == 'all') { - ctx.arcTo(60, 624, 30, 624, 60) - ctx.lineTo(30, 994) - ctx.arcTo(30, 994, 60, 1024, 30) - ctx.lineTo(200, 1024) - ctx.lineTo(200, 624) - ctx.stroke() - ctx.strokeStyle = "#DDDD44" - ctx.beginPath() - ctx.moveTo(200, 624) - ctx.lineTo(60, 624) - ctx.arcTo(60, 624, 30, 594, 30) - ctx.lineTo(30, 254) - ctx.arcTo(30, 254, 60, 224, 30) - ctx.lineTo(200, 224) - ctx.stroke() - } else { - ctx.lineTo(60, 624) - ctx.arc(60, 654, 30, Math.PI / 2, Math.PI) - ctx.lineTo(30, 254) - ctx.arc(60, 254, 30, 3 / 2 * Math.PI, 2 * Math.PI) - ctx.lineTo(200, 224) - ctx.lineTo(200, 624) - ctx.stroke() - ctx.strokeStyle = "#DDDD44" - ctx.beginPath() - ctx.moveTo(200, 624) - ctx.lineTo(60, 624) - ctx.arc(60, 654, 30, 2 * Math.PI, 3 / 2 * Math.PI) - ctx.lineTo(30, 994) - ctx.arc(60, 994, 30, Math.PI, Math.PI / 2) - ctx.lineTo(200, 1024) - ctx.stroke() - } + ctx.moveTo(300, 424) + ctx.lineTo(60, 424) + ctx.arcTo(30, 424, 30, 524, 30) + ctx.lineTo(30, 494) + ctx.arcTo(30, 524, 300, 524, 30) + ctx.lineTo(300, 524) + ctx.stroke() + if (core.status.event.data.mode === "class_2") ctx.fill() + ctx.beginPath(); - } + ctx.moveTo(300, 524) + ctx.lineTo(60, 524) + ctx.arcTo(30, 524, 30, 624, 30) + ctx.lineTo(30, 594) + ctx.arcTo(30, 624, 300, 624, 30) + ctx.lineTo(300, 624) + ctx.stroke() + if (core.status.event.data.mode === "class_3") ctx.fill() + ctx.beginPath(); + + ctx.moveTo(300, 624) + ctx.lineTo(60, 624) + ctx.arcTo(30, 624, 30, 724, 30) + ctx.lineTo(30, 694) + ctx.arcTo(30, 724, 300, 724, 30) + ctx.lineTo(300, 724) + ctx.stroke() + if (core.status.event.data.mode === "class_4") ctx.fill() + ctx.beginPath(); + + ctx.moveTo(300, 724) + ctx.lineTo(60, 724) + ctx.arcTo(30, 724, 30, 824, 30) + ctx.lineTo(30, 794) + ctx.arcTo(30, 824, 300, 824, 30) + ctx.lineTo(300, 824) + ctx.stroke() + if (core.status.event.data.mode === "class_5") ctx.fill() + ctx.beginPath(); + + ctx.moveTo(300, 824) + ctx.lineTo(60, 824) + ctx.arcTo(30, 824, 30, 924, 30) + ctx.lineTo(30, 894) + ctx.arcTo(30, 924, 300, 924, 30) + ctx.lineTo(300, 924) + ctx.stroke() + if (core.status.event.data.mode === "class_6") ctx.fill() + ctx.beginPath(); + + ctx.moveTo(300, 924) + ctx.lineTo(60, 924) + ctx.arcTo(30, 924, 30, 1024, 30) + ctx.lineTo(30, 994) + ctx.arcTo(30, 1024, 300, 1024, 30) + ctx.lineTo(300, 1024) + ctx.stroke() + if (core.status.event.data.mode === "class_7") ctx.fill() + ctx.beginPath() + ctx.moveTo(300, 1024) + ctx.lineTo(60, 1024) + ctx.arcTo(30, 1024, 30, 1124, 30) + ctx.lineTo(30, 1094) + ctx.arcTo(30, 1124, 300, 1124, 30) + ctx.lineTo(300, 1124) + ctx.stroke() + if (core.status.event.data.mode === "class_8") ctx.fill() + core.fillBoldText1( + ctx, + '全部', + 170, + 190, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + '收藏★', + 170, + 290, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_1", "默认分类1"), + 170, + 390, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_2", "默认分类2"), + 170, + 490, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_3", "默认分类3"), + 170, + 590, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_4", "默认分类4"), + 170, + 690, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_5", "默认分类5"), + 170, + 790, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_6", "默认分类6"), + 170, + 890, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_7", "默认分类7"), + 170, + 990, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.getLocalStorage("slClass_8", "默认分类8"), + 170, + 1090, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.strokeRoundRect(ctx, 300, 100, 1648, 1048, 30, "#DDDDDD") // --- 绘制记录 this._drawSLPanel_drawRecords(); ctx.restore(); @@ -23812,7 +24578,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ui.prototype._drawSLPanel_drawBackground = function () { - const bg = core.material.images.images["bg_5043.webp"]; //背景 + const bg = core.material.images.images["eve_011101.webp"]; //背景 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); //绘制半透明背景图片 @@ -23822,10 +24588,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ui.prototype._drawSLPanel_loadSave = function (page, callback) { var ids = [0]; - for (var i = 1; i <= 5; ++i) { - var id = 5 * page + i; + for (var i = 1; i <= 10; ++i) { + var id = 10 * page + i; if (core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1]; // 因为favorite第一个不是自动存档 所以要偏移1 + if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== "all") + id = core.saves[core.status.event.data.mode][id - 1] ids.push(id); } core.getSaves(ids, function (data) { @@ -23837,89 +24605,736 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } // 在以x为中心轴 y为顶坐标 的位置绘制一条宽为size的记录 cho表示是否被选中 选中会加粗 highlight表示高亮标题 ✐ - ui.prototype._drawSLPanel_drawRecord = function (title, data, x, y, size, cho, highLight) { - var globalAttribute = core.status.globalAttribute || core.initStatus.globalAttribute; - var strokeColor = globalAttribute.selectColor; - if (core.status.event.selection) strokeColor = '#FF6A6A'; - if (!data || !data.floorId) highLight = false; - if (data && data.__toReplay__) title = '[R]' + title; - var w = size * core._PX_, - h = size * core._PY_; - core.fillText('ui', title, x, y, highLight ? globalAttribute.selectColor : '#FFFFFF', this._buildFont(17, true)); - core.strokeRect('ui', x - w / 2, y + 15, w, h, cho ? strokeColor : '#FFFFFF', cho ? 3 : 1); + ui.prototype._drawSLPanel_drawRecord = function (page, offset) { + var data = core.status.event.ui[offset] + var id = 9 * page + offset + core.drawWindowSkin( + "winskin.webp", + ctx, 1032, + 252, + 660, + 660, + null, + null, + null, + 3 + ); if (data && data.floorId) { core.setTextAlign('ui', "center"); var map = core.maps.loadMap(data.maps, data.floorId); core.extractBlocksForUI(map, data.hero.flags); + core.drawThumbnail(data.floorId, map.blocks, { heroLoc: data.hero.loc, heroIcon: data.hero.image, flags: data.hero.flags, - ctx: 'ui', - x: x - w / 2, - y: y + 15, - size: size, + ctx: ctx, + x: 1050, + y: 270, + size: 1.5, centerX: data.hero.loc.x, centerY: data.hero.loc.y, noHD: true }); if (core.isPlaying() && core.getFlag("hard") != data.hero.flags.hard) { - core.fillRect('ui', x - w / 2, y + 15, w, h, [0, 0, 0, 0.4]); - core.fillText('ui', data.hard, x, parseInt(y + 22 + h / 2), data.hero.flags.__hardColor__ || 'white', this._buildFont(30, true)); + core.fillRect(ctx, 1050, 270, 624, 624, [0, 0, 0, 0.4]); + core.fillText(ctx, data.hard, 1362, 620, data.hero.flags.__hardColor__ || 'white', this._buildFont(180, true)); } - // 绘制存档笔记 - if (data.hero.notes && data.hero.notes.length > 0) { - core.setTextAlign('ui', 'left'); - if (data.hero.notes.length >= 2) { - core.fillRect('ui', x - w / 2, y + 15, w, 28, [0, 0, 0, 0.3]); - core.fillBoldText('ui', data.hero.notes.length - 1 + ". " + data.hero.notes[data.hero.notes.length - 2].substring(0, 10), - x - w / 2 + 2, y + 15 + 12, '#FFFFFF', null, this._buildFont(10, false)); - core.fillBoldText('ui', data.hero.notes.length + ". " + data.hero.notes[data.hero.notes.length - 1].substring(0, 10), - x - w / 2 + 2, y + 15 + 24); - } else { - core.fillRect('ui', x - w / 2, y + 15, w, 16, [0, 0, 0, 0.3]); - core.fillBoldText('ui', data.hero.notes.length + ". " + data.hero.notes[data.hero.notes.length - 1].substring(0, 10), - x - w / 2 + 2, y + 15 + 12, '#FFFFFF', null, this._buildFont(10, false)); + core.drawIcon(ctx, "hp", 800, 260, 96, 96); + core.drawIcon(ctx, "atk", 800, 370, 96, 96); + core.drawIcon(ctx, "def", 800, 470, 96, 96); + core.drawIcon(ctx, "I374", 800, 580, 96, 96); + core.drawIcon(ctx, "jumpShoes", 800, 690, 96, 96); + core.drawIcon(ctx, "money", 800, 810, 96, 96); + core.setTextAlign(ctx, 'left'); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.hp, true), + 900, + 320, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.atk, true), + 900, + 430, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.def, true), + 900, + 540, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.spell, true), + 900, + 650, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.speed, true), + 900, + 760, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + core.formatBigNumber(data.hero.money, true), + 900, + 880, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.setTextAlign(ctx, 'center'); + core.fillBoldText1( + ctx, + core.floors[data.floorId].title, + 1350, + 150, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + `[${core.floors[data.floorId].areas}]`, + 1350, + 220, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.drawWindowSkin( + "winskin.webp", + ctx, 1700, + 260, + 96, + 96, + null, + null, + null, + 1 + ); + core.drawWindowSkin( + "winskin.webp", + ctx, 1700, + 400, + 96, + 96, + null, + null, + null, + 1 + ); + core.drawWindowSkin( + "winskin.webp", + ctx, 1700, + 540, + 96, + 96, + null, + null, + null, + 1 + ); + core.drawWindowSkin( + "winskin.webp", + ctx, 1700, + 680, + 96, + 96, + null, + null, + null, + 1 + ); + core.drawWindowSkin( + "winskin.webp", + ctx, 1700, + 810, + 96, + 96, + null, + null, + null, + 1 + ); + if (data.hero.equipment[0]) core.drawIcon(ctx, data.hero.equipment[0], 1700, 260, 96, 96) + else core.fillBoldText1( + ctx, + "无", + 1750, + 320, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + + if (data.hero.equipment[1]) core.drawIcon(ctx, data.hero.equipment[1], 1700, 400, 96, 96) + else core.fillBoldText1( + ctx, + "无", + 1750, + 460, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + + if (data.hero.equipment[2]) core.drawIcon(ctx, data.hero.equipment[2], 1700, 540, 96, 96) + else core.fillBoldText1( + ctx, + "无", + 1750, + 600, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + + if (data.hero.equipment[3]) core.drawIcon(ctx, data.hero.equipment[3], 1700, 680, 96, 96) + else core.fillBoldText1( + ctx, + "无", + 1750, + 740, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + if (data.hero.equipment[3]) core.drawIcon(ctx, data.hero.equipment[3], 1700, 810, 96, 96) + else core.fillBoldText1( + ctx, + "无", + 1750, + 870, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.drawIcon(ctx, "yellowKey", 1800, 260, 96, 96) + core.drawIcon(ctx, "blueKey", 1800, 420, 96, 96) + core.drawIcon(ctx, "redKey", 1800, 580, 96, 96) + core.drawIcon(ctx, "greenKey", 1800, 740, 96, 96) + core.fillBoldText1( + ctx, + data.hero.items.tools.yellowKey ?? 0, + 1850, + 390, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + data.hero.items.tools.blueKey ?? 0, + 1850, + 550, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + data.hero.items.tools.redKey ?? 0, + 1850, + 710, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + data.hero.items.tools.greenKey ?? 0, + 1850, + 870, + '#DDDDDD', + "#000000", + 6, + this._buildFont(45, true) + ); + core.fillBoldText1( + ctx, + `存档时间${core.formatDate(new Date(data.time))}`, + 1350, 960, data.hero.flags.debug ? '#FF6A6A' : '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + if (offset !== 0) core.fillBoldText1( + ctx, + "修改存档名", + 920, 1020, '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + if (offset !== 0) core.fillBoldText1( + ctx, + "存档分类", + 1800, 1020, '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + if (offset !== 0) core.fillBoldText1( + ctx, + "删除存档", + 1800, 1120, '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + + if (core.status.event.data.mode !== "all" && core.status.event.data.mode !== "fav") core.fillBoldText1( + ctx, + "修改分类名", + 920, 1120, '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + if (data.hero.flags._cgText) { + core.fillBoldText1( + ctx, + cg ? "剧情CG模式" : "缩略图模式", + 1350, 1220, '#FFFFFF', + "#000000", + 6, + this._buildFont(45, true) + ); + if (!cg) { + core.drawWindowSkin( + "winskin.webp", + ctx, 805, + 252, + 1140, + 660, + null, + null, + null, + 3 + ); + core.drawImage(ctx, data.cg.image, 823, 270, 1104, 624) + let s = 0.5 + data.cg.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, + 823 + v.px * s, + 894 - body.height * v.scale * s, + body.width * v.scale * s, + body.height * v.scale * s + ); + } else { + ctx.drawImage( + body, + 0, + 0, + body.width, + body.height, + 823 + v.px * s, + 894 - (v.h ?? body.height) * s, + v.w ?? body.width * s, + v.h ?? body.height * s + ); + } + } + ctx.filter = "none"; + }); + core.fillRect(ctx, 823, 694, 1104, 200, "rgba(0,0,0,0.3)") + const head = core.material.images.images?.[data.cg.head.name]; + if (head) { + //绘制头像 + ctx.drawImage( + head, + 0, + 0, + head.width, + head.height, + 823 + data.cg.head.px * s, + 894 - head.height * 2.2 * s, + head.width * 2.2 * s, + head.height * 2.2 * s + ); + + + } + core.setTextAlign(ctx, "left") + core.fillBoldText1( + ctx, + `【${data.cg.name}】`, + 1143, 720, '#FFFFFF', + "#000000", + 2, + this._buildFont(30, true) + ); + core.drawTextContent(ctx, data.cg.text, { + left: 1143, + top: 750, + bold: true, + color: "#FFFFFF", + align: "left", + fontSize: 30, + time: 0, + font: "Verdana", + maxWidth: 800, + }); } } - core.setTextAlign('ui', "center"); - var v = core.formatBigNumber(data.hero.hp, true) + "/" + core.formatBigNumber(data.hero.atk, true) + "/" + core.formatBigNumber(data.hero.def, true); - var v2 = "/" + core.formatBigNumber(data.hero.mdef, true); - if (core.calWidth('ui', v + v2, this._buildFont(10, false)) <= w) v += v2; - core.fillText('ui', v, x, y + 30 + h, globalAttribute.selectColor); - core.fillText('ui', core.formatDate(new Date(data.time)), x, y + 43 + h, data.hero.flags.debug ? '#FF6A6A' : '#FFFFFF'); + if (offset !== 0) core.drawWindowSkin( + "winskin.webp", + ctx, 1050, + 982, + 640, + 150, + null, + null, + null, + 1 + ); + let real_id = id + if (core.status.event.data.mode === "fav") { + real_id = core.saves.favorite[id - 1] + } + if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { + real_id = core.saves[core.status.event.data.mode][id - 1] + } + if (offset !== 0) core.drawTextContent(ctx, core.getLocalStorage("_slText" + real_id, "点击填写存档笔记"), { + left: 1070, + top: 1000, + bold: true, + color: "#FFFFFF", + align: "left", + fontSize: 30, + time: 0, + font: "HATTEN", + maxWidth: 620, + }); + if (choose) { + core.drawWindowSkin( + "winskin.webp", + ctx, 805, + 252, + 1140, + 660, + null, + null, + null, + 3 + ); + core.fillRect(ctx, 823, 270, 1104, 624, "#000000") + + core.setTextAlign(ctx, 'left') + core.fillBoldText1( + ctx, + `${core.saves.favorite.indexOf(real_id)>=0?"☑":"□"}收藏★`, + 920, 370, core.saves.favorite.indexOf(real_id) >= 0 ? '#FFFF44' : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_1.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_1", "默认分类1")}`, + 920, 480, core.saves.class_1.indexOf(real_id) >= 0 ? '#FFFF44' : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_2.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_2", "默认分类2")}`, + 920, 590, core.saves.class_2.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_3.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_3", "默认分类3")}`, + 920, 700, core.saves.class_3.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_4.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_4", "默认分类4")}`, + 920, 810, core.saves.class_4.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_5.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_5", "默认分类5")}`, + 1400, 370, core.saves.class_5.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_6.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_6", "默认分类6")}`, + 1400, 480, core.saves.class_6.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_7.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_7", "默认分类7")}`, + 1400, 590, core.saves.class_7.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + `${core.saves.class_8.indexOf(real_id)>=0?"☑":"□"}${core.getLocalStorage("slClass_8", "默认分类8")}`, + 1400, 700, core.saves.class_8.indexOf(real_id) >= 0 ? "#FFFF44" : '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + core.fillBoldText1( + ctx, + "返回", + 1700, 810, '#FFFFFF', + "#000000", + 6, + this._buildFont(60, true) + ); + + } + ctx.lineWidth = 6 + core.setTextAlign(ctx, "center") } else { - core.fillRect('ui', x - w / 2, y + 15, w, h, '#333333'); - core.fillText('ui', '空', x, parseInt(y + 22 + h / 2), '#FFFFFF', this._buildFont(30, true)); + + core.fillRect(ctx, 1050, 270, 624, 624, '#333333'); + core.fillText(ctx, '无存档', 1362, 620, "#444444", this._buildFont(180, true)); } } ui.prototype._drawSLPanel_drawRecords = function (n) { var page = core.status.event.data.page; var offset = core.status.event.data.offset; - var u = Math.floor(core._PX_ / 6), - size = 0.3; var name = core.status.event.id == 'save' ? "存档" : core.status.event.id == 'load' ? "读档" : "回放"; + core.drawLine(ctx, 650, 100, 650, 1148) + core.drawLine(ctx, 800, 100, 800, 1148) + let liney = 0 + core.fillText( + ctx, + "自动存档", + 470, + 190, + offset === 0 ? '#DDDD44' : core.status.event.ui[0] ? "#FFFFFF" : "#BBBBBB", + this._buildFont(45, true) + ); + core.setStrokeStyle(ctx, "#DDDDDD") + core.drawLine(ctx, 300, 224, 650, 224) + core.fillText( + ctx, + "▲", + 725, + 240, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▲", + 725, + 220, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▲", + 725, + 200, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▲", + 725, + 320, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▲", + 725, + 340, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▲", + 725, + 440, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + page + 1, + 725, + 540, + "#DDDD44", + this._buildFont(45, true) + ); + core.fillText( + ctx, + "/", + 725, + 590, + "#DDDDDD", + this._buildFont(45, true) + ); + core.fillText( + ctx, + core.saveLoad.max_page, + 725, + 640, + "#DDDDDD", + this._buildFont(45, true) + ); + core.fillText( + ctx, + "▼", + 725, + 740, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▼", + 725, + 820, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▼", + 725, + 840, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▼", + 725, + 940, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▼", + 725, + 960, + "#DDDDDD", + this._buildFont(60, true) + ); + core.fillText( + ctx, + "▼", + 725, + 980, + "#DDDDDD", + this._buildFont(60, true) + ); + if (core.status.event.data.mode === 'all' && core.getLocalStorage("save_page", 0) !== 8000) core.fillText( + ctx, + "扩容", + 725, + 1090, + "#DDDDDD", + this._buildFont(60, true) + ); - for (var i = 0; i < (n || 6); i++) { + this._drawSLPanel_drawRecord(page, offset) + for (var i = 1; i < (n || 10); i++) { var data = core.status.event.ui[i]; - var id = 5 * page + i; - var highLight = (i > 0 && core.saves.favorite.indexOf(id) >= 0) || core.status.event.data.mode == 'fav'; + var id = 9 * page + i; + var highLight = (core.status.event.data.mode !== 'fav' && core.saves.favorite.indexOf(id) >= 0) || core.status.event.data.mode == 'fav'; var title = (highLight ? '★ ' : '☆ ') + (core.saves.favoriteName[id] || (name + id)); - if (i != 0 && core.status.event.data.mode == 'fav') { + if (i != 0 && core.status.event.data.mode !== 'all') { if (!data) break; var real_id = core.saves.favorite[id - 1]; - title = (core.saves.favoriteName[real_id] || (name + real_id)) + ' ✐'; - } - var charSize = 32; // 字体占用像素范围 - var topSpan = parseInt((core._PY_ - charSize - 2 * (charSize * 2 + size * core._PY_)) / 3); // Margin - var yTop1 = topSpan + parseInt(charSize / 2) + 8; // 文字的中心 - var yTop2 = yTop1 + charSize * 2 + size * core._PY_ + topSpan; - if (i < 3) { - this._drawSLPanel_drawRecord(i == 0 ? "自动存档" : title, data, (2 * i + 1) * u, yTop1, size, i == offset, highLight); - } else { - this._drawSLPanel_drawRecord(title, data, (2 * i - 5) * u, yTop2, size, i == offset, highLight); + for (let a = 1; a < 9; a++) { + if (core.status.event.data.mode === ("class_" + a)) + real_id = core.saves["class_" + a][id - 1] + } + title = (core.saves.favoriteName[real_id] || (name + real_id)); + } + if (data && data.__toReplay__) title = '[R]' + title; + liney += 100 + core.fillText( + ctx, + title, + 470, + 190 + liney, + offset === i ? '#DDDD44' : data ? "#FFFFFF" : "#BBBBBB", + this._buildFont(45, true) + ); + core.setStrokeStyle(ctx, "#DDDDDD") + if (i != 9) core.drawLine(ctx, 300, 224 + liney, 650, 224 + liney) + } }; ////// 点击保存按钮时的打开操作 ////// @@ -23937,8 +25352,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return; if (!this._checkStatus("save", fromUserAction)) return; var saveIndex = core.saves.saveIndex; - var page = parseInt((saveIndex - 1) / 5), - offset = saveIndex - 5 * page; + var page = parseInt((saveIndex - 1) / 9), + offset = saveIndex - 9 * page; core.playSound("打开界面"); core.ui._drawSLPanel(10 * page + offset); }; @@ -23947,8 +25362,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = events.prototype.load = function (fromUserAction) { if (core.isReplaying()) return; var saveIndex = core.saves.saveIndex; - var page = parseInt((saveIndex - 1) / 5), - offset = saveIndex - 5 * page; + var page = parseInt((saveIndex - 1) / 9), + offset = saveIndex - 9 * page; // 游戏开始前读档 if (!core.isPlaying()) { core.dom.startPanel.style.display = "none"; @@ -23989,105 +25404,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.lockControl(); core.status.event.id = "save"; var saveIndex = core.saves.saveIndex; - var page = parseInt((saveIndex - 1) / 5), - offset = saveIndex - 5 * page; + var page = parseInt((saveIndex - 1) / 9), + offset = saveIndex - 9 * page; core.ui._drawSLPanel(10 * page + offset); }; - ////// 存读档界面时的点击操作 ////// - actions.prototype._clickSL = function (x, y) { - var page = core.status.event.data.page, - offset = core.status.event.data.offset; - var index = page * 10 + offset; - // 上一页 - if ((x == this._HX_ - 2 || x == this._HX_ - 3) && y === core._HEIGHT_ - 1) { - core.playSound('光标移动'); - core.ui._drawSLPanel(10 * (page - 1) + offset); - return; - } - // 下一页 - if ((x == this._HX_ + 2 || x == this._HX_ + 3) && y === core._HEIGHT_ - 1) { - core.playSound('光标移动'); - core.ui._drawSLPanel(10 * (page + 1) + offset); - return; - } - // 返回 - if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) { - core.playSound('取消'); - if (core.events.recoverEvents(core.status.event.interval)) - return; - core.ui.closePanel(); - delete core.status.tempRoute; - if (!core.isPlaying()) - core.showStartAnimate(true); - return; - } - // 删除 - if (x >= 0 && x <= 2 && y === core._HEIGHT_ - 1) { - if (core.status.event.id == 'save') { - core.status.event.selection = !core.status.event.selection; - core.ui._drawSLPanel(index); - } else { // 显示收藏 - core.status.event.data.mode = core.status.event.data.mode == 'all' ? 'fav' : 'all'; - if (core.status.event.data.mode == 'fav') - core.ui._drawSLPanel(1, true); - else { - page = parseInt((core.saves.saveIndex - 1) / 5); - offset = core.saves.saveIndex - 5 * page; - core.ui._drawSLPanel(10 * page + offset, true); - } - } - return; - } - // 点存档名 - var xLeft = parseInt(core._WIDTH_ / 3), - xRight = parseInt(core._WIDTH_ * 2 / 3); - var topY1 = 0, - topY2 = this._HY_; - if (y >= topY1 && y <= topY1 + 1) { - if (x >= xLeft && x < xRight) return this._clickSL_favorite(page, 1); - if (x >= xRight) return this._clickSL_favorite(page, 2); - } - if (y >= topY2 && y <= topY2 + 1) { - if (x < xLeft) return this._clickSL_favorite(page, 3); - if (x >= xLeft && x < xRight) return this._clickSL_favorite(page, 4); - if (x >= xRight) return this._clickSL_favorite(page, 5); - } - - var id = null; - if (y >= topY1 + 2 && y < this._HY_ - 1) { - if (x < xLeft) id = "autoSave"; - if (x >= xLeft && x < xRight) id = 5 * page + 1; - if (x >= xRight) id = 5 * page + 2; - } - if (y >= topY2 + 2 && y < core._HEIGHT_ - 1) { - if (x < xLeft) id = 5 * page + 3; - if (x >= xLeft && x < xRight) id = 5 * page + 4; - if (x >= xRight) id = 5 * page + 5; - } - if (id != null) { - if (core.status.event.selection) { - if (id == 'autoSave') { - core.playSound('操作失败'); - core.drawTip("无法删除自动存档!"); - } else { - core.removeSave(id, function () { - core.ui._drawSLPanel(index, true); - }); - } - } else { - if (core.status.event.data.mode == 'fav' && id != 'autoSave') - id = core.saves.favorite[id - 1]; - core.doSL(id, core.status.event.id); - } - } - } actions.prototype._clickSL_favorite = function (page, offset) { if (offset == 0) return; - var index = 5 * page + offset; + var index = 9 * page + offset; if (core.status.event.data.mode == 'fav') { // 收藏模式下点击的下标直接对应favorite index = core.saves.favorite[index - 1]; core.myprompt("请输入想要显示的存档名(长度不超过5字符)", null, function (value) { @@ -24124,48 +25451,43 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (keycode == 37) { // left core.playSound('光标移动'); - if (offset == 0) { - core.ui._drawSLPanel(10 * (page - 1) + 5); - } else { - core.ui._drawSLPanel(index - 1); - } + + core.ui._drawSLPanel(10 * (page - 1) + offset); return; } if (keycode == 38) { // up core.playSound('光标移动'); - if (offset < 3) { - core.ui._drawSLPanel(10 * (page - 1) + offset + 3); + if (offset > 1) { + core.ui._drawSLPanel(10 * page + offset - 1); } else { - core.ui._drawSLPanel(index - 3); + core.ui._drawSLPanel(10 * (page - 1) + 9); } return; } if (keycode == 39) { // right core.playSound('光标移动'); - if (offset == 5) { - core.ui._drawSLPanel(10 * (page + 1) + 1); - } else { - core.ui._drawSLPanel(index + 1); - } + + core.ui._drawSLPanel(10 * (page + 1) + offset); + return; } if (keycode == 40) { // down core.playSound('光标移动'); - if (offset >= 3) { - core.ui._drawSLPanel(10 * (page + 1) + offset - 3); + if (offset < 9) { + core.ui._drawSLPanel(10 * page + offset + 1); } else { - core.ui._drawSLPanel(index + 3); + core.ui._drawSLPanel(10 * (page + 1)); } return; } if (keycode == 33) { // PAGEUP core.playSound('光标移动'); - core.ui._drawSLPanel(10 * (page - 1) + offset); + core.ui._drawSLPanel(10 * (page - 10) + offset); return; } if (keycode == 34) { // PAGEDOWN core.playSound('光标移动'); - core.ui._drawSLPanel(10 * (page + 1) + offset); + core.ui._drawSLPanel(10 * (page + 10) + offset); return; } } @@ -24176,8 +25498,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = offset = core.status.event.data.offset; var index = page * 10 + offset; - if (keycode == 27 || keycode == 88 || (core.status.event.id == 'save' && keycode == 83) || (core.status.event.id == 'load' && keycode == 68)) { - this._clickSL(core._WIDTH_ - 1, core._HEIGHT_ - 1); + if (keycode == 27 || keycode == 88 || (core.status.event.id == 'save' && keycode == 83) || (core.status.event.id == 'load' && keycode == 68)) { //退出 + saveLoadclick(1800, 1200); return; } if (keycode >= 48 && keycode <= 57) { @@ -24189,31 +25511,63 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (offset == 0) core.doSL("autoSave", core.status.event.id); else { - var id = 5 * page + offset; + var id = 9 * page + offset; if (core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1]; + if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== 'all') id = core.saves[core.status.event.data.mode][id - 1]; core.doSL(id, core.status.event.id); } return; } - if (keycode == 69 && core.status.event.id != 'save') { // E 收藏切换 - this._clickSL(0, core._HEIGHT_ - 1); - return; + if (keycode == 69) { //e + switch (core.status.event.data.mode) { + case "all": + core.status.event.data.mode = 'fav' + break; + case "fav": + core.status.event.data.mode = 'class_1' + break; + case "class_1": + core.status.event.data.mode = 'class_2' + break; + case "class_2": + core.status.event.data.mode = 'class_3' + break; + case "class_3": + core.status.event.data.mode = 'class_4' + break; + case "class_4": + core.status.event.data.mode = 'class_5' + break; + case "class_5": + core.status.event.data.mode = 'class_6' + break; + case "class_6": + core.status.event.data.mode = 'class_7' + break; + case "class_7": + core.status.event.data.mode = 'class_8' + break; + case "class_8": + core.status.event.data.mode = 'all' + break; + } + + core.ui._drawSLPanel(0) } if (keycode == 46) { if (offset == 0) { core.playSound('操作失败'); core.drawTip("无法删除自动存档!"); } else { - var id = 5 * page + offset; + var id = 9 * page + offset; if (core.status.event.data.mode == 'fav') id = core.saves.favorite[id - 1]; + if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== 'all') id = core.saves[core.status.event.data.mode][id - 1]; core.removeSave(id, function () { core.ui._drawSLPanel(index, true); }); } } - if (keycode == 70 && core.status.event.data.mode == 'all') { // F - this._clickSL_favorite(page, offset); - } + } }, "scrollingText": function () {