修复存读档及动画bug

This commit is contained in:
草莓 2025-04-30 00:03:29 +08:00
parent 83d38be844
commit 0ec0dc1c53
7 changed files with 219 additions and 149 deletions

View File

@ -587,12 +587,12 @@ editor_uievent_wrapper = function (editor) {
var disabled = _isTileset && value.indexOf(one) >= 0 ? 'disabled' : '' var disabled = _isTileset && value.indexOf(one) >= 0 ? 'disabled' : ''
html += `<input type="checkbox" key="${one}" class="materialCheckbox" ${checked} ${disabled}/> ${one}`; html += `<input type="checkbox" key="${one}" class="materialCheckbox" ${checked} ${disabled}/> ${one}`;
// 预览图片 // 预览图片
if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) { if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')||one.endsWith('.webp')) {
html += "<button onclick='editor.uievent._previewMaterialImage(this)' style='margin-left: 10px'>预览</button>"; html += "<button onclick='editor.uievent._previewMaterialImage(this)' style='margin-left: 10px'>预览</button>";
html += '<br style="display:none"/><img key="' + directory + one + '" style="display:none; max-width: 100%"/>'; html += '<br style="display:none"/><img key="' + directory + one + '" style="display:none; max-width: 100%"/>';
} }
// 试听音频 // 试听音频
if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')) { if (one.endsWith('.mp3') || one.endsWith('.ogg') || one.endsWith('.wav') || one.endsWith('.m4a') || one.endsWith('.flac')||one.endsWith('.opus')) {
html += "<button onclick='editor.uievent._previewMaterialAudio(this)' style='margin-left: 10px'>播放</button>" html += "<button onclick='editor.uievent._previewMaterialAudio(this)' style='margin-left: 10px'>播放</button>"
html += "<small> 音调:<input value='100' style='width:28px' onchange='editor.uievent._previewMaterialAudio_onPitchChange(this)'></small>"; html += "<small> 音调:<input value='100' style='width:28px' onchange='editor.uievent._previewMaterialAudio_onPitchChange(this)'></small>";
html += `<small style='display:none; margin-left: 15px'>0:00 / 0:00</small><br style="display:none"/> html += `<small style='display:none; margin-left: 15px'>0:00 / 0:00</small><br style="display:none"/>

View File

@ -2489,6 +2489,7 @@ control.prototype.checkAutosave = function () {
////// 实际进行存读档事件 ////// ////// 实际进行存读档事件 //////
control.prototype.doSL = function (id, type) { control.prototype.doSL = function (id, type) {
switch (type) { switch (type) {
case "save": case "save":
this._doSL_save(id); this._doSL_save(id);

View File

@ -1269,7 +1269,9 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
// 输出 // 输出
var left = config.offsetX, top = config.offsetY + config.topMargin; var left = config.offsetX, top = config.offsetY + config.topMargin;
core.fillText(tempCtx, ch, left, top); tempCtx.lineWidth = 2;
tempCtx.strokeText( ch, left, top);
tempCtx.fillText( ch, left, top);
config.blocks.push({ config.blocks.push({
left: config.offsetX, top: config.offsetY, left: config.offsetX, top: config.offsetY,
width: charwidth, height: config.currfont + config.lineMargin, width: charwidth, height: config.currfont + config.lineMargin,

View File

@ -2124,7 +2124,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"animateSpeed": 300, "animateSpeed": 300,
"moveSpeed": 100, "moveSpeed": 100,
"statusCanvasRowsOnMobile": 3, "statusCanvasRowsOnMobile": 3,
"floorChangeTime": 0, "floorChangeTime": 500,
"yellowGem": 2 "yellowGem": 2
}, },
"flags": { "flags": {

View File

@ -284,29 +284,6 @@ main.floors.jiaocheng02=
"type": "hide", "type": "hide",
"remove": true "remove": true
} }
],
"3,8": [
{
"type": "animationDrawable",
"allFarme": 30,
"color": [
0,
0,
0
],
"imageList": [
{
"image": ""
}
],
"soundList": [
{
"sound": "",
"startfarme": 0,
"stopbefore": false
}
]
}
] ]
}, },
"changeFloor": { "changeFloor": {

View File

@ -145,7 +145,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// ---------- 重绘新地图这一步将会设置core.status.floorId ---------- // // ---------- 重绘新地图这一步将会设置core.status.floorId ---------- //
core.drawMap(floorId); core.drawMap(floorId);
// 切换楼层BGM // 切换楼层BGM
if (core.status.maps[floorId].bgm) { if (core.status.maps[floorId].bgm) {
var bgm = core.status.maps[floorId].bgm; var bgm = core.status.maps[floorId].bgm;
@ -190,14 +189,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} else { } else {
// 每次抵达楼层执行的事件 // 每次抵达楼层执行的事件
core.insertAction(core.floors[floorId].eachArrive); core.insertAction(core.floors[floorId].eachArrive);
core.ui.statusBar._update_map();
// 首次抵达楼层时执行的事件(后插入,先执行) // 首次抵达楼层时执行的事件(后插入,先执行)
if (!core.hasVisitedFloor(floorId)) { if (!core.hasVisitedFloor(floorId)) {
core.insertAction(core.floors[floorId].firstArrive); core.insertAction(core.floors[floorId].firstArrive);
core.visitFloor(floorId); core.visitFloor(floorId);
core.plugin.bfs(); core.plugin.bfs();
} }
} }
if (!core.isReplaying()) core.plugin.drawCommentSign() if (!core.isReplaying()) core.plugin.drawCommentSign()
}, },
"flyTo": function (toId, callback) { "flyTo": function (toId, callback) {
@ -1760,13 +1761,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
}, },
"updateStatusBar": function () { "updateStatusBar": function () {
if (!core.control.noAutoEvents) core.checkAutoEvents()
// 更新状态栏 // 更新状态栏
core.ui.statusBar.update(); core.ui.statusBar.update();
// 更新阻激夹域的伤害值 // 更新阻激夹域的伤害值
core.updateCheckBlock(); core.updateCheckBlock();
// 更新全地图显伤 // 更新全地图显伤
core.updateDamage(); core.updateDamage();
}, },
"updateCheckBlock": function (floorId) { "updateCheckBlock": function (floorId) {
// 领域、夹击、阻击等的伤害值计算 // 领域、夹击、阻击等的伤害值计算

View File

@ -2828,8 +2828,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const ctx = core.dymCanvas[name], const ctx = core.dymCanvas[name],
canvas = ctx.canvas; canvas = ctx.canvas;
const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1; const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1;
canvas.style.width = (innerSize / ratio) * core.domStyle.scale + "px"; canvas.style.width = core.__PIXELS__ * core.domStyle.scale + "px";
canvas.style.height = (innerSize / ratio) * core.domStyle.scale + "px"; canvas.style.height = core.__PIXELS__ * core.domStyle.scale + "px";
canvas.style.left = canvas.style.left =
parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
canvas.style.top = canvas.style.top =
@ -2956,6 +2956,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
_resize_canvas(obj); _resize_canvas(obj);
if (core.status.automaticRoute == null) core.status.automaticRoute = {}; if (core.status.automaticRoute == null) core.status.automaticRoute = {};
core.updateStatusBar(); core.updateStatusBar();
if (main.dom.CGUI && main.dom.CGUI.style.display === "block") if (main.dom.CGUI && main.dom.CGUI.style.display === "block")
core.ui.CG.update(); core.ui.CG.update();
@ -3021,6 +3023,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
_redrawMap() { _redrawMap() {
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
core.clearMap( core.clearMap(
uictx, uictx,
MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_LEFT_VERTICAL,
@ -3747,10 +3750,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
31 * 3, 31 * 3,
31 * 3, 31 * 3,
]); ]);
if (core.status.lockControl || core.isMoving()) return;
if (core.isReplaying()) { if (core.isReplaying()) {
this.replayAction[col][row].call(core); this.replayAction[col][row].call(core);
} else if (core.isPlaying()) { } else if (core.isPlaying()) {
if (core.status.lockControl || core.isMoving()) return;
if (col === 0 && row === 3) { if (col === 0 && row === 3) {
core.doSL("autoSave", "load"); core.doSL("autoSave", "load");
} else if (col === 1 && row === 3) { } else if (col === 1 && row === 3) {
@ -3834,10 +3838,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
31 * 3, 31 * 3,
31 * 3, 31 * 3,
]); ]);
if (core.status.lockControl || core.isMoving()) return;
if (core.isReplaying()) { if (core.isReplaying()) {
this.replayAction[col][row].call(core); this.replayAction[col][row].call(core);
} else if (core.isPlaying()) { } else if (core.isPlaying()) {
if (core.status.lockControl || core.isMoving()) return;
if (col === 0 && row === 3) { if (col === 0 && row === 3) {
core.doSL("autoSave", "load"); core.doSL("autoSave", "load");
} else if (col === 1 && row === 3) { } else if (col === 1 && row === 3) {
@ -15606,6 +15611,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}, },
"滑动转场": function () { "滑动转场": function () {
// 在此增加新插件 // 在此增加新插件
const defaultChange = { const defaultChange = {
left: "leftPortal", // 左箭头 left: "leftPortal", // 左箭头
up: "upPortal", // 上箭头 up: "upPortal", // 上箭头
@ -15625,14 +15631,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}; };
let allChangeEntries = Object.entries(defaultChange); let allChangeEntries = Object.entries(defaultChange);
const move = document.createElement("canvas"); const move = document.createElement("canvas");
const speed = 12; const move2 = document.createElement("canvas");
let modedata = 0;
move.width = 1248; move.width = 416;
move.height = 1248; move.height = 416;
move2.width = 416;
move2.height = 416;
const ctx = move.getContext("2d"); const ctx = move.getContext("2d");
const ctx2 = move2.getContext("2d");
events.prototype.changeFloor = function ( events.prototype.changeFloor = function (
floorId, floorId,
stair, stair,
@ -15661,6 +15668,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this._changeFloor_beforeChange(info, block, callback); this._changeFloor_beforeChange(info, block, callback);
}; };
const { Animation, linear, bezier, circle, hyper, trigo, power, inverseTrigo, shake, sleep } = core.plugin.animate
events.prototype._changeFloor_beforeChange = function ( events.prototype._changeFloor_beforeChange = function (
info, info,
block, block,
@ -15689,95 +15698,100 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
); );
const v = dirData[dir][1], // 水平数值 const v = dirData[dir][1], // 水平数值
h = dirData[dir][0]; //竖直数值 h = dirData[dir][0]; //竖直数值
ctx.clearRect(0, 0, 1248, 1248); ctx.clearRect(0, 0, 416, 416);
ctx2.clearRect(0, 0, 416, 416);
core.drawThumbnail(core.status.floorId, null, { core.drawThumbnail(core.status.floorId, null, {
damage: data.damage, damage: data.damage,
ctx: ctx, ctx: ctx,
x: 416, x: 0,
y: 416, y: 0,
size: 1, size: 1,
all: data.all, all: data.all,
}); });
if (dir !== "upFloor" && dir !== "downFloor") { if (dir !== "upFloor" && dir !== "downFloor") {
core.drawThumbnail(toFloorId, null, { core.drawThumbnail(toFloorId, null, {
damage: dataTo.damage, damage: dataTo.damage,
ctx: ctx, ctx: ctx2,
x: 416 + 416 * v, x: 0,
y: 416 + 416 * h, y: 0,
size: 1, size: 1,
all: dataTo.all, all: dataTo.all,
}); });
var _run = function () { const changefloor = async function () {
var cb = function () { const animate = new Animation()
modedata = 0; const change = core.createCanvas("change", 0, 0, 416, 416, 100)
core.clearUI(); change.canvas.style.width = core.__PIXELS__ * core.domStyle.scale + "px"
core.clearMap("data"); change.canvas.style.height = core.__PIXELS__ * core.domStyle.scale + "px"
const fn = () => {
const x1 = -animate.x * v;
const y1 = -animate.x * h
const x2 = (416 - animate.x) * v;
const y2 = (416 - animate.x) * h;
let status = animate.x > 208 ? "rightFoot" : "leftFoot";
const img = core.material.images.hero;
const heroIconArr = core.material.icons.hero;
const width = core.material.icons.hero.width || 32;
const height = core.material.icons.hero.height;
const heroIcon = heroIconArr[dir];
const imgx = (heroIcon[status] % 4) * width,
imgy = heroIcon.loc * height,
x = core.status.hero.loc.x * 32 -
core.bigmap.offsetX -
(animate.x - (animate.x * 32) / 416) * v,
y = core.status.hero.loc.y * 32 -
16 -
(animate.x - (animate.x * 32) / 416) * h;
const ctx3 = core.dymCanvas.change
core.clearMap(ctx3)
core.fillRect(ctx3, x1,
y1, 416, 416)
ctx3.drawImage(
move,
0, 0, 416, 416,
x1,
y1, 416, 416
);
ctx3.drawImage(
move2,
0, 0, 416, 416,
x2,
y2,
416, 416
);
ctx3.drawImage(
img,
imgx, imgy,
width,
height,
x, y,
width,
height
);
}
animate.ticker.add(fn)
animate.mode(linear()).time(core.values.floorChangeTime).move(416, 0)
await animate.all();
animate.ticker.destroy()
window.setTimeout(function () {
core.events._changeFloor_changing(info, callback); core.events._changeFloor_changing(info, callback);
}; core.clearMap(change)
}, 25)
var animate = window.setInterval( }
function () { changefloor()
if (modedata >= 416) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
cb();
} else {
core.clearUI();
core.clearMap("data");
core.canvas.data.drawImage(
move,
416 + modedata * v,
416 + modedata * h,
416,
416,
0,
0,
416,
416
);
let status = "leftFoot";
if (modedata > 208) {
status = "rightFoot";
}
const img = core.material.images.hero;
const heroIconArr = core.material.icons.hero;
const width = core.material.icons.hero.width || 32;
const height = core.material.icons.hero.height;
const heroIcon = heroIconArr[dir];
core.canvas.data.drawImage(
img,
(heroIcon[status] % 4) * width,
heroIcon.loc * height,
width,
height,
core.status.hero.loc.x * 32 -
core.bigmap.offsetX -
(modedata - (modedata * 32) / 416) * v,
core.status.hero.loc.y * 32 -
16 -
(modedata - (modedata * 32) / 416) * h,
width,
height
);
modedata += speed;
clearInterval(animate);
delete core.animateFrame.asyncId[animate];
_run();
}
},
core.status.replay.speed == 24 ?
1 :
10 / core.status.replay.speed
);
core.animateFrame.lastAsyncId = animate;
core.animateFrame.asyncId[animate] = cb;
};
_run();
return; return;
} }
} }
@ -19688,6 +19702,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
let now = 0; let now = 0;
let start = 0 let start = 0
let sounds = []
core.registerAnimationFrame( core.registerAnimationFrame(
"animationDrawable", "animationDrawable",
@ -19790,10 +19805,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
one.sound && one.sound &&
core.sounds[one.sound] && core.sounds[one.sound] &&
core.musicStatus.soundStatus; core.musicStatus.soundStatus;
if (farme >= one.startfarme && lisen && !one.start) { if (farme >= one.startfarme && lisen && !one.start && sounds.includes(farme)) {
one.start = true one.start = true
if (one.stopbefore) core.stopSound(); if (one.stopbefore) core.stopSound();
core.playSound(one.sound); core.playSound(one.sound);
sounds.includes(farme)
} }
}); });
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
@ -21429,6 +21445,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"start": 0, "start": 0,
"pause": false, "pause": false,
"pausetime": 0, "pausetime": 0,
'sounds': [],
"index": 0, "index": 0,
}); });
@ -21476,7 +21493,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
obj.animate, obj.animate,
core.status.heroCenter.px, core.status.heroCenter.px,
core.status.heroCenter.py, core.status.heroCenter.py,
obj.index obj.index,
obj.sounds
); );
} else { } else {
core.maps._drawAnimateFrame( core.maps._drawAnimateFrame(
@ -21484,7 +21502,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
obj.animate, obj.animate,
obj.centerX, obj.centerX,
obj.centerY, obj.centerY,
obj.index obj.index,
obj.sounds
); );
} }
}); });
@ -23648,7 +23667,34 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return; return;
}; };
control.prototype._doSL_replayLoad_afterGet = function (id, data) {
if (!data) {
core.playSound("操作失败");
return core.drawTip("无效的存档");
}
if (data.version != core.firstData.version) {
core.playSound("操作失败");
return core.drawTip("存档版本不匹配");
}
if (data.hero.flags.__events__ && data.guid != core.getGuid()) {
core.playSound("操作失败");
return core.drawTip("此存档可能存在风险,无法读档");
}
var route = core.subarray(core.status.route, core.decodeRoute(data.route));
if (route == null) {
core.playSound("操作失败");
return core.drawTip("无法从此存档回放录像");
}
core.closePanel()
core.loadData(data, function () {
core.removeFlag("__fromLoad__");
core.startReplay(route);
core.drawTip("回退到存档节点");
});
};
function saveLoadclick(x, y) { //点击画布(x,y)触发的效果 function saveLoadclick(x, y) { //点击画布(x,y)触发的效果
debugger
const makeBox = ([x, y], [w, h]) => { //创建点击检测区域 const makeBox = ([x, y], [w, h]) => { //创建点击检测区域
return [ return [
[x, y], [x, y],
@ -23796,47 +23842,44 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
choose = false choose = false
let a = Math.ceil((y - 224) / 100) let a = Math.ceil((y - 224) / 100)
let real_id = 9 * page + a let real_id = 9 * page + a
if (real_id == index) { if (core.status.event.data.mode === "fav") {
if (core.status.event.data.mode === "fav") { real_id = core.saves.favorite[9 * page + a - 1]
real_id = core.saves.favorite[a - 1] }
} if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") {
if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") { real_id = core.saves[core.status.event.data.mode][9 * page + a - 1]
real_id = core.saves[core.status.event.data.mode][a - 1] }
} if (10 * page + a == index) {
core.saveLoad.setId(real_id) core.saveLoad.setId(real_id)
core.doSL(real_id, core.status.event.id) core.doSL(real_id, core.status.event.id)
return return
} else { } 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.saveLoad.setId(real_id)
} }
core.ui._drawSLPanel(10 * page + a) core.ui._drawSLPanel(10 * page + a)
return; return;
} }
if (inRect(pos, save9box)) { if (inRect(pos, save9box)) {
choose = false choose = false
let real_id = 9 * page + 9 let real_id = 9 * page + 9
if (real_id == index) { if (core.status.event.data.mode === "fav") {
if (core.status.event.data.mode === "fav") { real_id = core.saves.favorite[9 * page + 8]
real_id = core.saves.favorite[9 * page + 8] }
} if (core.status.event.data.mode !== "fav" && core.status.event.data.mode !== "all") {
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]
real_id = core.saves[core.status.event.data.mode][9 * page + 8] }
} if (10 * page + 9 == index) {
core.saveLoad.setId(real_id) core.saveLoad.setId(real_id)
core.doSL(real_id, core.status.event.id) core.doSL(real_id, core.status.event.id)
return return
} else { } 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.saveLoad.setId(real_id)
} }
@ -23882,7 +23925,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.myprompt("请输入想要显示的存档名(长度不超过5字符)", null, function (value) { core.myprompt("请输入想要显示的存档名(长度不超过5字符)", null, function (value) {
if (value && value.length <= 5) { if (value && value.length <= 5) {
core.saves.favoriteName[real_id] = value; core.saves.favoriteName[real_id] = value;
core.setLocalStorage("_saveName", core.saves.favoriteName)
core.control._updateFavoriteSaves(); core.control._updateFavoriteSaves();
core.ui._drawSLPanel(10 * page + offset); core.ui._drawSLPanel(10 * page + offset);
} else if (value) { } else if (value) {
@ -23965,6 +24012,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.saves.favorite = core.saves.favorite.sort(function (a, b) { return a - b; }); // 保证有序 core.saves.favorite = core.saves.favorite.sort(function (a, b) { return a - b; }); // 保证有序
} }
core.control._updateFavoriteSaves() core.control._updateFavoriteSaves()
core.ui._drawSLPanel(index); core.ui._drawSLPanel(index);
return return
@ -24158,11 +24206,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
for (let i = 1; i < 9; i++) { for (let i = 1; i < 9; i++) {
core.setLocalStorage("class_" + i, core.saves["class_" + i]) core.setLocalStorage("class_" + i, core.saves["class_" + i])
} }
core.setLocalStorage("favoriteName", core.saves.favoriteName); core.setLocalStorage("favoriteName", core.saves.favoriteName);
}; };
////// 绘制存档/读档界面 ////// ////// 绘制存档/读档界面 //////
ui.prototype._drawSLPanel = function (index, refresh) { ui.prototype._drawSLPanel = function (index, refresh) {
core.control._updateFavoriteSaves()
core.control._loadClassSaves(); core.control._loadClassSaves();
core.control._loadFavoriteSaves(); core.control._loadFavoriteSaves();
@ -24460,8 +24509,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ui.prototype._drawSLPanel_loadSave = function (page, callback) { ui.prototype._drawSLPanel_loadSave = function (page, callback) {
var ids = [0]; var ids = [0];
for (var i = 1; i <= 10; ++i) { for (var i = 1; i <= 9; ++i) {
var id = 10 * page + i; var id = 9 * page + i;
if (core.status.event.data.mode == 'fav') if (core.status.event.data.mode == 'fav')
id = core.saves.favorite[id - 1]; // 因为favorite第一个不是自动存档 所以要偏移1 id = core.saves.favorite[id - 1]; // 因为favorite第一个不是自动存档 所以要偏移1
if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== "all") if (core.status.event.data.mode !== 'fav' && core.status.event.data.mode !== "all")
@ -25688,7 +25737,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
for (var i = 0; i < core.status.animateObjs.length; i++) { for (var i = 0; i < core.status.animateObjs.length; i++) {
var obj = core.status.animateObjs[i]; var obj = core.status.animateObjs[i];
if (obj.pause) obj.pausetime += frametime if (obj.pause) obj.pausetime += frametime
if (obj.start === 0) obj.start = core.animateFrame.animateTime if (obj.start === 0) {
obj.sounds = []
obj.start = core.animateFrame.animateTime
}
obj.index = Math.floor((core.animateFrame.animateTime - obj.start - obj.pausetime) / (1000 / 60)) obj.index = Math.floor((core.animateFrame.animateTime - obj.start - obj.pausetime) / (1000 / 60))
if (obj.reverse) obj.index = obj.animate.frames.length - obj.index if (obj.reverse) obj.index = obj.animate.frames.length - obj.index
if ((!obj.reverse && obj.index >= obj.animate.frames.length) || (obj.reverse && obj.index <= 0)) { if ((!obj.reverse && obj.index >= obj.animate.frames.length) || (obj.reverse && obj.index <= 0)) {
@ -25696,9 +25748,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (obj.reverse) { if (obj.reverse) {
obj.index = obj.animate.frames.length obj.index = obj.animate.frames.length
obj.start = core.animateFrame.animateTime obj.start = core.animateFrame.animateTime
obj.sounds = []
obj.pausetime = 0 obj.pausetime = 0
} else { } else {
obj.start = core.animateFrame.animateTime obj.start = core.animateFrame.animateTime
obj.sounds = []
obj.index = 0 obj.index = 0
obj.pausetime = 0 obj.pausetime = 0
} }
@ -25731,12 +25785,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const heroy = core.status.hero.loc.y * 32 + 32 + sy - core.material.icons.hero.height / 2; const heroy = core.status.hero.loc.y * 32 + 32 + sy - core.material.icons.hero.height / 2;
core.status.animateObjs.forEach(function (obj) { core.status.animateObjs.forEach(function (obj) {
if (obj.hero) { if (obj.hero) {
core.maps._drawAnimateFrame('animate', obj.animate, herox, heroy, obj.index); core.maps._drawAnimateFrame('animate', obj.animate, herox, heroy, obj.index, obj.sounds);
} else { } else {
core.maps._drawAnimateFrame('animate', obj.animate, tran.value[obj.id + obj.name + "x"], tran.value[obj.id + obj.name + "y"], obj.index); core.maps._drawAnimateFrame('animate', obj.animate, tran.value[obj.id + obj.name + "x"], tran.value[obj.id + obj.name + "y"], obj.index, obj.sounds);
} }
}); });
} }
@ -25760,12 +25815,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
centerX += core.bigmap.offsetX; centerX += core.bigmap.offsetX;
centerY += core.bigmap.offsetY; centerY += core.bigmap.offsetY;
} }
var id = setTimeout(null);
animate.se = animate.se || {}; animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se }; if (typeof animate.se == 'string') animate.se = { 1: animate.se };
tran.mode(linear()).time(1).absolute() tran.mode(linear()).time(1).absolute()
tran.value[id + name + "x"] = centerX tran.value[id + name + "x"] = centerX
tran.value[id + name + "y"] = centerY tran.value[id + name + "y"] = centerY
var id = setTimeout(null);
core.status.animateObjs.push({ core.status.animateObjs.push({
"name": name, "name": name,
"id": id, "id": id,
@ -25776,6 +25832,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"pause": false, "pause": false,
"pausetime": 0, "pausetime": 0,
"index": 0, "index": 0,
'sounds': [],
"callback": callback "callback": callback
}); });
@ -25815,6 +25872,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"loop": loop, "loop": loop,
"pausetime": 0, "pausetime": 0,
"index": 0, "index": 0,
'sounds': [],
"callback": callback "callback": callback
}) })
else core.status.animateObjs.push({ else core.status.animateObjs.push({
@ -25829,6 +25887,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"loop": loop, "loop": loop,
"pausetime": 0, "pausetime": 0,
"index": 0, "index": 0,
'sounds': [],
"callback": callback "callback": callback
}); });
@ -25862,6 +25921,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"pause": false, "pause": false,
"pausetime": 0, "pausetime": 0,
"index": 0, "index": 0,
'sounds': [],
"callback": callback "callback": callback
}); });
@ -25877,11 +25937,14 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
////// 绘制动画的某一帧 ////// ////// 绘制动画的某一帧 //////
maps.prototype._drawAnimateFrame = function (name, animate, centerX, centerY, index) { maps.prototype._drawAnimateFrame = function (name, animate, centerX, centerY, index, sounds) {
var ctx = core.getContextByName(name); var ctx = core.getContextByName(name);
if (!ctx) return; if (!ctx) return;
var frame = animate.frames[index % animate.frame]; var frame = animate.frames[index % animate.frame];
core.playSound((animate.se || {})[index % animate.frame + 1], (animate.pitch || {})[index % animate.frame + 1]); if (!sounds.includes(index)) {
core.playSound((animate.se || {})[index % animate.frame + 1], (animate.pitch || {})[index % animate.frame + 1]);
sounds.push(index)
}
var ratio = animate.ratio; var ratio = animate.ratio;
frame.forEach(function (t) { frame.forEach(function (t) {
var image = animate.images[t.index]; var image = animate.images[t.index];
@ -26033,6 +26096,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
reverse: reverse, reverse: reverse,
pausetime: 0, pausetime: 0,
farme: 0, farme: 0,
sounds: []
}; };
core.plugin.playing.add(data); core.plugin.playing.add(data);
@ -26085,10 +26149,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
one.farme = data.allFarme one.farme = data.allFarme
one.start = thistime one.start = thistime
one.pausetime = 0 one.pausetime = 0
one.sounds = []
} else { } else {
one.start = thistime one.start = thistime
one.farme = 0 one.farme = 0
one.pausetime = 0 one.pausetime = 0
one.sounds = []
} }
} }
} }
@ -26223,9 +26289,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
sound.sound && sound.sound &&
core.material.sounds[sound.sound] && core.material.sounds[sound.sound] &&
core.musicStatus.soundStatus; core.musicStatus.soundStatus;
if (one.farme == sound.startfarme && lisen) { if (one.farme == sound.startfarme && lisen && one.sounds.includes(one.farme)) {
if (sound.stopbefore) core.stopSound(); if (sound.stopbefore) core.stopSound();
core.playSound(sound.sound); core.playSound(sound.sound);
one.sounds.push(one.farme)
} }
}); });
@ -26233,5 +26300,26 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}); });
}); });
},
"任务系统": function () {
// 在此增加新插件
this.task = { //任务总表(键名和id后期改为"floorId+'.'+npc+'.'+Number"的格式,即“楼层名.npc名.任务序号”)
1: { id: 1, name: "寻找丢失的钱袋", text: "梅尔森的钱袋被小偷偷走了,去找到小偷并拿回梅尔森的钱袋", type: "物品" }
}
this.taskAccept = function (id) { //任务接取
let accept = core.getFlag("accept") ?? []; //正在进行任务
let success = core.getFlag("success") ?? []; //已提交任务
let nocontinue = false
accept.forEach(v => { if (v.id === id) nocontinue = ture })
success.forEach(v => { if (v.id === id) nocontinue = ture })
if (nocontinue) return //已接取或已完成该任务return
let task = this.task[id] //获取任务内容
switch (task.type) {
case "物品":
break;
}
}
} }
} }