平滑移动

This commit is contained in:
草莓 2024-12-07 23:13:31 +08:00
parent 0c4d2be0bf
commit 0a7625acf4
7 changed files with 345 additions and 25 deletions

View File

@ -1 +1 @@
N4IgZgNg9lBOCSATEAuEBZAKgZhAGhAAsBTWKVUASwFsBDAc2NSNKgDoAHAO3vxFq41aAFyYowtCAGdiBLrWpiQAHQCuATgBs2bGoCsARgAs6vhABuqAwUIc6AD1Trn6mxysAGLwTryHqAFprEF9aVA8CEQBrTwiQRGIwWJ8EpJQ46iguYgBPcIJie3d0goBHVUo7Yi5hVABtAF0CSlFqKQoQAGMsqWEBYXaUUAAjGBiUYMg8iYBfAmEYaQo5kGJyysHgGZXoTo7HFFcQac0CREpYYk7hSizmCETalcgGTZAW4moAEWI+yghUMJYKpZCBVDIAEK/ADuxGqABlKPRCLUUECQQQAPqYmTERDYqzYdTYPTqIwADj02CxmNgAnxmMJxNJFKpNlosGQExphA5iAAwlBoLACWhYPRhrQABSaIx4ABMej0eEpeAMAEo+NiPtQABKUGqixo0h60czEeFQTqi0BYDwdc6Xa63LjMWBIlF8A4GeUEE7bAjDGFwrgAQWEfU6US+IjCKC4qggEBp5koUg+DI6dsBwNBWFwaNzAfAQugsNgg2NIF6xA4g2p1b6N16lE6bwWfQgmBoYnJWhMRj0RjY8pcAHYh3KuqpYLBu4pUCTnGwp7Z8iBJRGHuvMtlpnFCsU4pvhA8Y3RGOuOFA01lzwwxAf7EDaPfLyUQlBzV8LldT9NlXeeguDgYgAGVRDrVB5V9RsOVRTQPFJNhsGLXlOWYABRWgpDyHxaCgoYVjIVRRGYeEkHoAANUNhlDeB6EwdBQ06ABNTB6OhUMAC0AGkOG40MwKkUMuAAKVDfkjFDHJWIARVDABeRS+HMSQQU2FZzQrF1mDUdRiGwRB9GGPQPDUMdaHUYyNA8eVzNUPRKSMfROg8MB9M0AwkgIegKi5EBNGGIxiGGRAx3JTEDFoIxaExIwwDHdRMXJRBsGGTEqT0eVEiMRBEDAMk+BuBcJjHbBRxJTQlTHCKZiAA=== N4IgZgNg9lBOCSATEAuEBZAKgZhAGhAAsBTWKVUASwFsBDAc2NSNKgDoAHAO3vxFq41aAFyYowtCAGdiBLrWpiQAHQCuATgBs2bGoCsARgAs6vhABuqAwUIc6AD1Trn6mxysAGLwTryHqAFprEF9aVA8CEQBrTwiQRGIwWJ8EpJQ46iguYgBPcIJie3d0goBHVUo7Yi5hVABtAF0CSlFqKQoQAGMsqWEBYXaUUAAjGBiUYMg8iYBfAmEYaQo5kGJyysHgGZXoTo7HFAB2AmnNAkRKWGJO4Uos5lhKekJalcgGTZAW4moAEWI+pQIKhhLBVLIQKoZAAhAEAd2I1QAMk8XiCwRCAPqYmTERDY1AADk0miMhz0RmMBGxsAE+MxRJJZIpVP4V1ogzqoD8SjUhwATJp+Xz+WADHw6BxORhMB4+FhcAQsOKlZh+fLMEYNXoQA05tyFLzVIdCcY+bRDpo1EKjHKfLQpfUZZpdfqQDzmGojMQPMN9J0jOr7Y6UHUZYcNYSNaZVQY7TKDOK9XgDYpPapvb7/YGJQ7pQBhWg0QhQNPJ1NGzN+1R6ANBkJ5p0AK0oqnoqgErqaRFosGQJRA2MIvcQ+ag0FgBLQV2Q1Mx32oAAlKDUp405xBiLRzMQkVBOlPQFg5UN4pdrrd7tPUbUCAcDPyTqhNNsCMN4YiuABBYR9TpRX4RDCFAuFUCAIDncxKCkb56Q6Y90XBVVcBQUFwVfcBx2gBFYE5btemIEMjAIXoRGg25Ok+BY+ggTAaDEflCQFYlDnJNg9HUQU9A8Y4ulUWBYDotMUCMPRDiMNh+RcaTpLcfIQGGERhE3eTMmyaY4kKYo4kU39N0AuhGHkjgoGgrIDIYMRNPsUFaAsoyB0yHdfnPG4IGmR8vnoLg4GIABlUQQzjEi+lgWojmwdRsEkjDhz7ZhcxDLYCDIVRRGYJF4AAJXoX4vwADS/YYvz8+hMHQL9YAAOWIAqAHEAFF6AAXj4cxJHBTYVh3XC7i4dN1GIbBEH0YZuPNdQRo0Dx+Q8fRCQpf0PDANQtAMJICHbSh+xATRhm9YZEBNTEDFoIxaExIwwEOdRMUJRBsGGTE9GwPR+USIxEEQMB1C1eZ6KsQ4dD0TQbqMQkPBBmYgA=

View File

@ -951,6 +951,8 @@ action
| removeMouse_s | removeMouse_s
| drawWarning_s | drawWarning_s
| addPop_s | addPop_s
| playStereo_s
| moveStereo_s
| pass_s | pass_s
; ;
@ -1829,16 +1831,16 @@ return code;
*/; */;
drawWarning_s drawWarning_s
: '警告坐标x' PosString 'y' PosString '警告内容' EvalString? Newline : '警告坐标x' PosString 'y' PosString '警告内容' EvalString? '副标题' EvalString? '不播放音效' Bool? Newline
/* drawWarning_s /* drawWarning_s
tooltip : drawWarning: 绘制warning警告并拉进镜头 tooltip : drawWarning: 绘制warning警告并拉进镜头,本事件为异步事件,下一事件将在3100ms后执行
helpUrl : /_docs/#/instruction helpUrl : /_docs/#/instruction
default : [0, 0,"这里是提示内容"] default : [0, 0,"这里是提示内容","绿色史莱姆",false]
colour : this.soundColor colour : this.soundColor
selectPoint : ["PosString_0", "PosString_1"] selectPoint : ["PosString_0", "PosString_1"]
var code = '{"type": "drawWarning", "x": '+PosString_0+', "y": '+PosString_1+', "text": "'+EvalString_0+'"},\n'; var code = '{"type": "drawWarning", "x": '+PosString_0+', "y": '+PosString_1+', "text": "'+EvalString_0+'", "text2": "'+EvalString_1+'", "warning": '+Bool_0+'},\n';
return code; return code;
*/; */;
@ -2667,6 +2669,39 @@ var code = '{"type": "playSound", "name": "'+EvalString_0+'"'+Bool_0+IntString_0
return code; return code;
*/; */;
playStereo_s
: '播放音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? Newline
/* playStereo_s
tooltip : playSound: 播放音效(立体音)
helpUrl : /_docs/#/instruction
default : ["item.mp3",1,1,true]
colour : this.imageColor
allSounds : ['EvalString_0']
material : ["./project/sounds/", "EvalString_0"]
var code = '{"type": "playStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+'},\n';
return code;
*/;
moveStereo_s
: '播放渐变音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? BGNL? Newline
'左声道目标音量' Int '右声道目标音量' Int '渐变时长'Int Newline
/* moveStereo_s
tooltip : playSound: 播放渐变音效(立体音)
helpUrl : /_docs/#/instruction
default : ["item.mp3",1,1,true,10,10,1000]
colour : this.imageColor
allSounds : ['EvalString_0']
material : ["./project/sounds/", "EvalString_0"]
var code = '{"type": "moveStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+', "leftTo": '+Int_2+', "rightTo": '+Int_3+', "time": '+Int_4+'},\n';
return code;
*/;
playSound_1_s playSound_1_s
: '播放系统音效' NameMap_List '停止之前音效' Bool? '音调' IntString? '等待播放完毕' Bool? Newline : '播放系统音效' NameMap_List '停止之前音效' Bool? '音调' IntString? '等待播放完毕' Bool? Newline

View File

@ -706,6 +706,14 @@ ActionParser.prototype.parseAction = function() {
data.loc[0],data.loc[1],data.which,data.floorId||'',data.args||"",this.next]); data.loc[0],data.loc[1],data.which,data.floorId||'',data.args||"",this.next]);
} }
break; break;
case "playStereo":
this.next = MotaActionBlocks['playStereo_s'].xmlText([
data.name, data.left, data.right, data.split||true,this.next]);
break
case "moveStereo":
this.next = MotaActionBlocks['moveStereo_s'].xmlText([
data.name, data.left, data.right, data.split||true,data.leftTo, data.rightTo, data.time,this.next]);
break
case "playSound": case "playSound":
var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];}); var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];});
if (knownItems.indexOf(data.name) >= 0) { if (knownItems.indexOf(data.name) >= 0) {
@ -983,7 +991,7 @@ ActionParser.prototype.parseAction = function() {
case "drawWarning": case "drawWarning":
this.next = MotaActionBlocks['drawWarning_s'].xmlText([ this.next = MotaActionBlocks['drawWarning_s'].xmlText([
data.x,data.y,data?.text,this.next]); data.x,data.y,data?.text,data?.text2,data?.warning,this.next]);
break; break;
case "changeMouse": case "changeMouse":

File diff suppressed because one or more lines are too long

View File

@ -258,7 +258,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"title": "秽翼的尤斯蒂娅", "title": "秽翼的尤斯蒂娅",
"name": "Eustia", "name": "Eustia",
"version": "鸽子窝造塔小队", "version": "鸽子窝造塔小队",
"floorId": "jiuguan", "floorId": "MT0",
"hero": { "hero": {
"image": "hero.png", "image": "hero.png",
"animate": false, "animate": false,
@ -281,8 +281,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
}, },
"loc": { "loc": {
"direction": "up", "direction": "up",
"x": 4, "x": 7,
"y": 9 "y": 8
}, },
"flags": { "flags": {
"itemDetail": true, "itemDetail": true,

View File

@ -23,8 +23,39 @@ main.floors.jiuguan=
{ {
"type": "drawWarning", "type": "drawWarning",
"x": 9, "x": 9,
"y": 4, "y": 5,
"text": "本区域领袖" "text": "本区域领袖",
"text2": "绿色史莱姆",
"warning": false
},
{
"type": "playStereo",
"name": "item.mp3",
"left": 1,
"right": 6,
"split": true
},
{
"type": "move",
"loc": [
9,
5
],
"time": 500,
"keep": true,
"steps": [
"up:1"
]
},
{
"type": "moveStereo",
"name": "jingbao.mp3",
"left": 4,
"right": 10,
"split": true,
"leftTo": 10,
"rightTo": 4,
"time": 2000
} }
] ]
}, },
@ -42,7 +73,7 @@ main.floors.jiuguan=
[ 0, 0, 0, 0,333,20212,20213,20214,20215,40064,30030, 0, 0], [ 0, 0, 0, 0,333,20212,20213,20214,20215,40064,30030, 0, 0],
[ 0, 0, 0, 0,334,20220,20221,20222,20223,40072,40074,10173, 0], [ 0, 0, 0, 0,334,20220,20221,20222,20223,40072,40074,10173, 0],
[ 0, 0, 0, 0,342,340,340,340,339, 0, 0, 0, 0], [ 0, 0, 0, 0,342,340,340,340,339, 0, 0, 0, 0],
[ 0, 0, 0, 0,336,337,337,337,338, 0,30070,10292, 0], [ 0, 0, 0, 0,336,337,337,337,338,201,30070,10292, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10292, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10292, 0],
[ 0, 0, 0, 0, 0, 0,40054, 0, 0,40054,40054,20110, 0], [ 0, 0, 0, 0, 0, 0,40054, 0, 0,40054,40054,20110, 0],
[ 0,40054,80004,40054, 0, 0,40040,40042, 0,40040,40042, 0, 0], [ 0,40054,80004,40054, 0, 0,40040,40042, 0,40040,40042, 0, 0],

View File

@ -17,7 +17,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.doAction() core.doAction()
}) })
core.registerEvent("drawWarning", function (data) { core.registerEvent("drawWarning", function (data) {
core.drawWarning(data.x, data.y, data?.text) core.drawWarning(data.x, data.y, data?.text, data?.text2, data?.warning)
setTimeout(() => core.doAction(), 3100)
})
core.registerEvent("playStereo", function (data) {
core.playStereo(data.name, data.left, data.right, data.split)
core.doAction()
})
core.registerEvent("moveStereo", function (data) {
const id = core.playStereo(data.name, data.left, data.right, data.split)
core.moveStereo(id, data.leftTo, data.rightTo, data.time)
core.doAction() core.doAction()
}) })
} }
@ -2506,19 +2515,32 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
return; return;
} }
const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3]) const mapBox = makeBox([MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_TOP_VERTICAL], [350, 350])
if (inRect(pos, mapBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
return;
}
/*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3])
if (inRect(pos, equipBox)) { if (inRect(pos, equipBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return; if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true) core.openEquipbox(true)
return; return;
} }*/
} else { } else {
const equipBox = makeBox([EQUIP_BLOCK_LEFT, EQUIP_BLOCK_TOP], [130, 95]) const mapBox = makeBox([MAP_BLOCK_LEFT, MAP_BLOCK_TOP], [350, 350])
if (inRect(pos, equipBox)) { if (inRect(pos, mapBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return; if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true) core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
return; return;
} }
/*
const equipBox = makeBox([EQUIP_BLOCK_LEFT, EQUIP_BLOCK_TOP], [130, 95])
if (inRect(pos, equipBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true)
return;
}*/
const itemBox = makeBox([ITEM_BOX_LEFT, ITEM_BOX_TOP], [31 * 4 * 3, 30 * 6 * 3]); const itemBox = makeBox([ITEM_BOX_LEFT, ITEM_BOX_TOP], [31 * 4 * 3, 30 * 6 * 3]);
if (inRect(pos, itemBox)) { if (inRect(pos, itemBox)) {
const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [31 * 3, 30 * 3]); const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [31 * 3, 30 * 3]);
@ -7245,6 +7267,8 @@ core.plugin.animate = {
MotaActionBlocks['scaleImage_s'].xmlText(), MotaActionBlocks['scaleImage_s'].xmlText(),
MotaActionBlocks['showGif_s'].xmlText(), MotaActionBlocks['showGif_s'].xmlText(),
MotaActionBlocks['playBgm_s'].xmlText(), MotaActionBlocks['playBgm_s'].xmlText(),
MotaActionBlocks['playStereo_s'].xmlText(),
MotaActionBlocks['moveStereo_s'].xmlText(),
MotaActionBlocks['pauseBgm_s'].xmlText(), MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(), MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(), MotaActionBlocks['loadBgm_s'].xmlText(),
@ -8079,7 +8103,7 @@ core.plugin.animate = {
core.fillRect(ctx, sx, sy, sw, sh, '#000') core.fillRect(ctx, sx, sy, sw, sh, '#000')
core.strokeRect(ctx, sx, sy, sw, sh, '#fff', 5) core.strokeRect(ctx, sx, sy, sw, sh, '#fff', 5)
core.setTextAlign('outerUI', 'center') core.setTextAlign('outerUI', 'center')
core.fillText(ctx, core.status.maps[center].areas, sx + sw / 2, sy - 20, '#FFFFFF', 'bold 42px Verdana') core.fillText(ctx, core.status.maps[center].areas, sx + sw * 3 / 8, sy - 10, '#FFFFFF', 'bold 42px Verdana')
const locs = info.locs const locs = info.locs
for (const id in locs) { for (const id in locs) {
const loc = locs[id]; const loc = locs[id];
@ -9205,14 +9229,14 @@ core.plugin.animate = {
* @param {number} y 纵坐标 * @param {number} y 纵坐标
* @param {string} text 显示的文字 * @param {string} text 显示的文字
*/ */
this.drawWarning = function (x, y, text) { this.drawWarning = function (x, y, text, text2, warning) {
if (timeout) return; if (timeout) return;
x = x || 6; x = x ?? 6;
y = y || 6; y = y ?? 6;
text = text || 'boss'; text = text || 'boss';
text += '</br>'; text += '</br>';
for (var i = 0; i < 10; i++) text += ' '; for (var i = 0; i < 10; i++) text += ' ';
if (core.material.enemys?.[core.getBlock(x, y)?.event?.id]?.name) text += core.material.enemys?.[core.getBlock(x, y)?.event?.id]?.name; text += text2;
// 生成文字 // 生成文字
var elements = document.querySelectorAll('.gameCanvas'); var elements = document.querySelectorAll('.gameCanvas');
var t = document.createElement('p'); var t = document.createElement('p');
@ -9238,7 +9262,7 @@ core.plugin.animate = {
v.style.transform = 'scale(2)translate(' + px + '%, ' + py + '%)'; v.style.transform = 'scale(2)translate(' + px + '%, ' + py + '%)';
} }
}); });
core.playSound(defaultSound); if (!warning) core.playSound(defaultSound);
// 拉回镜头 // 拉回镜头
timeout = setTimeout(function () { timeout = setTimeout(function () {
timeout = setTimeout(function () { timeout = setTimeout(function () {
@ -9252,5 +9276,227 @@ core.plugin.animate = {
}); });
}, 1600); }, 1600);
} }
},
"立体声音效": function () {
// 在此增加新插件
// 音效双声道播放
var can = true;
if (!AudioContext) {
console.warn('该浏览器不支持AudioContext无法播放立体声');
can = false
}
if (can) var ac = new AudioContext();
var datas = {};
/** 播放立体声 参考https://developer.mozilla.org/zh-CN/docs/Web/API/BaseAudioContext/createChannelSplitter
* @param {number} name 音效名
* @param {number} left 左声道音量默认为1
* @param {number} right 右声道音量默认为1
* @param {boolean} split 音效为双声道请填true为单声道请填false或不填
* @returns 该音效的唯一id
*/
this.playStereo = function (name, left, right, split) {
if (!can) return core.playSound(name);
var sound = core.getMappedName(name);
if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return;
if (!core.status.stereo) core.status.stereo = {};
var buffer = core.material.sounds[sound];
var source = ac.createBufferSource();
source.buffer = buffer;
var splitter = ac.createChannelSplitter(2);
source.connect(splitter);
var merger = ac.createChannelMerger(2);
/*
gain(L)
/ \
source ---- splitter merger ---- destination
\ /
gain(R)
*/
var L = ac.createGain();
var R = ac.createGain();
L.gain.value = left * core.musicStatus.userVolume;
R.gain.value = right * core.musicStatus.userVolume;
splitter.connect(L, 0, 0);
if (!split) splitter.connect(R, 0, 0);
else splitter.connect(R, 1, 0);
var id = setTimeout(null);
core.status.stereo[id] = { source: source, L: L, R: R };
L.connect(merger, 0, 0);
R.connect(merger, 0, 1);
var dest = ac.destination;
source.onended = function () {
delete datas[id];
source = void 0;
}
merger.connect(dest);
source.start(0);
return id;
}
/**
* @param {number} id 为playStereo返回的id
* @param {number} left 要渐变到的左声道音量
* @param {number} right 要渐变到的右声道音量
* @param {number} time 渐变时间
*/
this.moveStereo = function (id, left, right, time) {
if (!can) return;
if (main.mode != 'play' || !core.musicStatus.soundStatus) return;
var stereo = core.status.stereo[id];
datas[id] = {
time: time,
curr: 0,
dL: (left - stereo.L.gain.value) / time * 10 * core.musicStatus.userVolume,
dR: (right - stereo.R.gain.value) / time * 10 * core.musicStatus.userVolume
};
var interval = setInterval(function () {
var data = datas[id];
if (!data) return clearInterval(interval);
data.curr += 10;
if (data.curr >= data.time) {
clearInterval(interval);
datas[id] = void 0;
}
stereo.L.gain.value += data.dL;
stereo.R.gain.value += data.dR;
}, 10);
}
},
"滑动转场": function () {
// 在此增加新插件
const defaultChange = {
left: 'leftPortal', // 左箭头
up: 'upPortal', // 上箭头
right: 'rightPortal', // 右箭头
down: 'downPortal', // 下箭头
upFloor: 'upFloor', // 上楼
downFloor: 'downFloor' // 下楼
};
const dirData = {
up: [-1, 0],
down: [1, 0],
left: [0, -1],
right: [0, 1],
upFloor: [0, 0],
downFloor: [0, 0]
}
let allChangeEntries = Object.entries(defaultChange)
const move = document.createElement('canvas');
const speed = 12;
let modedata = 0;
move.width = 1248;
move.height = 1248;
const ctx = move.getContext("2d");
events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback) {
let block = core.getBlock(hero.loc.x, hero.loc.y)
var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time);
if (info == null) {
if (callback) callback();
return;
}
floorId = info.floorId;
info.locked = core.status.lockControl;
core.dom.floorNameLabel.innerText = core.status.maps[floorId].title;
core.lockControl();
core.stopAutomaticRoute();
core.clearContinueAutomaticRoute();
core.status.replay.animate = true;
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = 'tmp';
this._changeFloor_beforeChange(info, block, callback);
}
events.prototype._changeFloor_beforeChange = function (info, block, callback) {
this._changeFloor_playSound();
if (block && block?.event) {
const dirEntries = allChangeEntries.find(v => v[1] === block.event.id);
if (block?.event?.trigger === 'changeFloor' && dirEntries) {
const toFloorId = block.event.data.floorId;
const dir = dirEntries[0];
const data = core.ui._drawViewMaps_buildData(core.floorIds.indexOf(core.status.floorId))
const dataTo = core.ui._drawViewMaps_buildData(core.floorIds.indexOf(toFloorId))
const v = dirData[dir][1], // 水平数值
h = dirData[dir][0]; //竖直数值
ctx.clearRect(0, 0, 1248, 1248)
core.drawThumbnail(core.status.floorId, null, { damage: data.damage, ctx: ctx, x: 416, y: 416, size: 1, all: data.all })
if (dir !== "upFloor" && dir !== "downFloor") {
core.drawThumbnail(toFloorId, null, { damage: dataTo.damage, ctx: ctx, x: 416 + 416 * v, y: 416 + 416 * h, size: 1, all: dataTo.all })
var _run = function () {
var cb = function () {
modedata = 0
core.clearUI();
core.clearMap('data')
core.events._changeFloor_changing(info, callback)
}
var animate = window.setInterval(function () {
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
}
}
}
// 需要 setTimeout 执行,不然会出错
window.setTimeout(function () {
if (info.time == 0)
core.events._changeFloor_changing(info, callback);
else
core.showWithAnimate(core.dom.floorMsgGroup, info.time / 2, function () {
core.events._changeFloor_changing(info, callback);
});
}, 25)
}
} }
} }