mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 17:16:08 +08:00
Deploying to gh-pages from @ ae3d62211e
🚀
This commit is contained in:
parent
13f055451d
commit
9fe9888e13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
System.register(["./antdv-legacy.3cade0c8.js"],(function(n,t){"use strict";var r;return{setters:[n=>{r=n.c}],execute:function(){var t=n("l",{exports:{}});
|
||||
System.register(["./antdv-legacy.2d3c718f.js"],(function(n,t){"use strict";var r;return{setters:[n=>{r=n.c}],execute:function(){var t=n("l",{exports:{}});
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
@ -1,4 +1,4 @@
|
||||
import{c as jt}from"./antdv.e0a750df.js";var el={exports:{}};/**
|
||||
import{c as jt}from"./antdv.a0bb80c4.js";var el={exports:{}};/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
index.html
10
index.html
@ -18,10 +18,10 @@
|
||||
<meta name="x5-fullscreen" content="true">
|
||||
<meta name="x5-page-mode" content="app">
|
||||
<link id="mota-css" type='text/css' href='/HumanBreak/styles.css' rel='stylesheet'>
|
||||
<script type="module" crossorigin src="/HumanBreak/assets/index.f676ab33.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/HumanBreak/assets/antdv.e0a750df.js">
|
||||
<link rel="modulepreload" crossorigin href="/HumanBreak/assets/common.f94eef39.js">
|
||||
<link rel="stylesheet" href="/HumanBreak/assets/index.adf5d801.css">
|
||||
<script type="module" crossorigin src="/HumanBreak/assets/index.59e08278.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/HumanBreak/assets/antdv.a0bb80c4.js">
|
||||
<link rel="modulepreload" crossorigin href="/HumanBreak/assets/common.59ee6536.js">
|
||||
<link rel="stylesheet" href="/HumanBreak/assets/index.53f9fd9e.css">
|
||||
<script type="module">try{import.meta.url;import("_").catch(()=>1);}catch(e){}window.__vite_is_modern_browser=true;</script>
|
||||
<script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy build because dynamic import or import.meta.url is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
|
||||
</head>
|
||||
@ -215,7 +215,7 @@
|
||||
|
||||
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
|
||||
<script nomodule crossorigin id="vite-legacy-polyfill" src="/HumanBreak/assets/polyfills-legacy.852057b5.js"></script>
|
||||
<script nomodule crossorigin id="vite-legacy-entry" data-src="/HumanBreak/assets/index-legacy.0af9b0fa.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
<script nomodule crossorigin id="vite-legacy-entry" data-src="/HumanBreak/assets/index-legacy.ecf4e54e.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -19,6 +19,7 @@ control.prototype._init = function () {
|
||||
this.weathers = {};
|
||||
this.resizes = [];
|
||||
this.noAutoEvents = true;
|
||||
this.updateNextFrame = false;
|
||||
// --- 注册系统的animationFrame
|
||||
this.registerAnimationFrame(
|
||||
'totalTime',
|
||||
@ -3862,16 +3863,23 @@ control.prototype.clearStatusBar = function () {
|
||||
|
||||
////// 更新状态栏 //////
|
||||
control.prototype.updateStatusBar = function (doNotCheckAutoEvents, immediate) {
|
||||
if (!core.isPlaying()) return;
|
||||
if (immediate) {
|
||||
return this.updateStatusBar_update();
|
||||
}
|
||||
if (!doNotCheckAutoEvents) this.noAutoEvents = false;
|
||||
if (core.isReplaying()) return this.updateStatusBar_update();
|
||||
requestAnimationFrame(this.updateStatusBar_update);
|
||||
if (!core.control.updateNextFrame) {
|
||||
core.control.updateNextFrame = true;
|
||||
requestAnimationFrame(this.updateStatusBar_update);
|
||||
}
|
||||
};
|
||||
|
||||
control.prototype.updateStatusBar_update = function () {
|
||||
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
|
||||
core.control.updateNextFrame = false;
|
||||
if (!core.isPlaying() || core.hasFlag('__statistics__')) {
|
||||
return;
|
||||
}
|
||||
core.control.controldata.updateStatusBar();
|
||||
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||
core.control._updateStatusBar_setToolboxIcon();
|
||||
|
24
libs/maps.js
24
libs/maps.js
@ -3186,13 +3186,13 @@ maps.prototype.removeBlock = function (x, y, floorId) {
|
||||
if (!floorId) return false;
|
||||
|
||||
core.extractBlocks(floorId);
|
||||
for (var i in core.status.maps[floorId].blocks) {
|
||||
var block = core.status.maps[floorId].blocks[i];
|
||||
if (block.x == x && block.y == y) {
|
||||
this.removeBlockByIndex(i, floorId);
|
||||
this._removeBlockFromMap(floorId, block);
|
||||
return true;
|
||||
}
|
||||
const blocks = core.status.maps[floorId].blocks;
|
||||
const i = blocks.findIndex(v => v.x === x && v.y === y);
|
||||
if (i !== -1) {
|
||||
const block = blocks[i];
|
||||
this.removeBlockByIndex(i, floorId);
|
||||
this._removeBlockFromMap(floorId, block);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
@ -3295,7 +3295,7 @@ maps.prototype._triggerFloorImage = function (type, loc, floorId, callback) {
|
||||
};
|
||||
|
||||
////// 改变图块 //////
|
||||
maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
maps.prototype.setBlock = function (number, x, y, floorId, noredraw) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId || number == null || x == null || y == null) return;
|
||||
if (
|
||||
@ -3334,7 +3334,7 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
// 有任何一个是autotile直接重绘地图
|
||||
if (
|
||||
(originEvent != null && originEvent.cls == 'autotile') ||
|
||||
block.event.cls == 'autotile'
|
||||
(block.event.cls == 'autotile' && !noredraw)
|
||||
) {
|
||||
core.redrawMap();
|
||||
} else {
|
||||
@ -3346,8 +3346,10 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
});
|
||||
}
|
||||
if (!block.disable) {
|
||||
core.drawBlock(block);
|
||||
core.addGlobalAnimate(block);
|
||||
if (!noredraw) {
|
||||
core.drawBlock(block);
|
||||
core.addGlobalAnimate(block);
|
||||
}
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
7
main.js
7
main.js
@ -279,12 +279,7 @@ main.prototype.init = function (mode, callback) {
|
||||
main.core.resize();
|
||||
// 自动放缩最大化
|
||||
if (core.getLocalStorage('autoScale') == null) {
|
||||
if (
|
||||
!data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags
|
||||
.autoScale
|
||||
)
|
||||
core.setLocalStorage('autoScale', false);
|
||||
else core.setLocalStorage('autoScale', true);
|
||||
core.setLocalStorage('autoScale', true);
|
||||
}
|
||||
if (
|
||||
core.getLocalStorage('autoScale') &&
|
||||
|
@ -139,6 +139,12 @@ main.floors.tower1=
|
||||
],
|
||||
"time": 500
|
||||
}
|
||||
],
|
||||
"13,1": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\nconsole.trace()\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"afterBattle": {},
|
||||
@ -220,14 +226,14 @@ main.floors.tower1=
|
||||
"0,7": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
18,
|
||||
24,
|
||||
58
|
||||
]
|
||||
},
|
||||
"14,7": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
6,
|
||||
12,
|
||||
58
|
||||
]
|
||||
},
|
||||
|
@ -72,7 +72,7 @@ main.floors.tower2=
|
||||
"7,14": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
12,
|
||||
18,
|
||||
42
|
||||
]
|
||||
},
|
||||
|
@ -1,74 +1,86 @@
|
||||
main.floors.tower4 = {
|
||||
floorId: 'tower4',
|
||||
title: '智慧之塔',
|
||||
name: '4',
|
||||
width: 15,
|
||||
height: 15,
|
||||
canFlyTo: true,
|
||||
canFlyFrom: true,
|
||||
canUseQuickShop: true,
|
||||
cannotViewMap: false,
|
||||
images: [],
|
||||
ratio: 2,
|
||||
defaultGround: 'T526',
|
||||
bgm: 'tower.mp3',
|
||||
firstArrive: [],
|
||||
eachArrive: [],
|
||||
parallelDo: '',
|
||||
events: {},
|
||||
afterBattle: {},
|
||||
afterGetItem: {},
|
||||
afterOpenDoor: {},
|
||||
autoEvent: {},
|
||||
cannotMove: {},
|
||||
map: [
|
||||
[
|
||||
527, 527, 527, 527, 527, 527, 527, 543, 527, 527, 527, 527, 527,
|
||||
527, 527
|
||||
],
|
||||
[527, 31, 31, 536, 0, 528, 0, 547, 0, 31, 0, 544, 0, 381, 527],
|
||||
[527, 31, 31, 528, 28, 492, 29, 528, 528, 0, 28, 528, 0, 528, 527],
|
||||
[527, 528, 528, 528, 0, 528, 28, 34, 492, 492, 528, 528, 547, 0, 527],
|
||||
[527, 381, 0, 550, 0, 528, 528, 528, 528, 0, 31, 528, 0, 528, 527],
|
||||
[527, 0, 528, 0, 528, 528, 31, 0, 536, 27, 0, 556, 381, 378, 527],
|
||||
[527, 0, 528, 27, 0, 544, 0, 403, 0, 528, 528, 0, 528, 528, 527],
|
||||
[
|
||||
527, 550, 528, 528, 528, 528, 492, 528, 550, 528, 34, 381, 556, 376,
|
||||
527
|
||||
],
|
||||
[527, 0, 0, 31, 492, 88, 403, 528, 31, 528, 27, 32, 528, 0, 527],
|
||||
[527, 528, 528, 0, 528, 403, 34, 547, 0, 492, 492, 528, 528, 556, 527],
|
||||
[527, 0, 528, 546, 528, 528, 546, 528, 528, 528, 0, 28, 0, 0, 527],
|
||||
[527, 0, 544, 32, 0, 536, 32, 528, 32, 0, 536, 528, 528, 556, 527],
|
||||
[527, 27, 492, 0, 27, 528, 27, 492, 0, 528, 528, 528, 0, 0, 527],
|
||||
[527, 31, 528, 32, 0, 528, 32, 546, 0, 494, 87, 381, 28, 0, 527],
|
||||
[
|
||||
527, 527, 527, 527, 527, 527, 527, 540, 527, 527, 527, 527, 527,
|
||||
527, 527
|
||||
]
|
||||
],
|
||||
beforeBattle: {},
|
||||
bgmap: [],
|
||||
fgmap: [],
|
||||
bg2map: [],
|
||||
fg2map: [],
|
||||
cannotMoveIn: {},
|
||||
changeFloor: {
|
||||
'5,8': {
|
||||
floorId: 'tower3',
|
||||
loc: [5, 8]
|
||||
main.floors.tower4=
|
||||
{
|
||||
"floorId": "tower4",
|
||||
"title": "智慧之塔",
|
||||
"name": "4",
|
||||
"width": 15,
|
||||
"height": 15,
|
||||
"canFlyTo": true,
|
||||
"canFlyFrom": true,
|
||||
"canUseQuickShop": true,
|
||||
"cannotViewMap": false,
|
||||
"images": [],
|
||||
"ratio": 2,
|
||||
"defaultGround": "T526",
|
||||
"bgm": "tower.mp3",
|
||||
"firstArrive": [],
|
||||
"eachArrive": [],
|
||||
"parallelDo": "",
|
||||
"events": {},
|
||||
"afterBattle": {},
|
||||
"afterGetItem": {},
|
||||
"afterOpenDoor": {},
|
||||
"autoEvent": {},
|
||||
"cannotMove": {},
|
||||
"map": [
|
||||
[527,527,527,527,527,527,527,543,527,527,527,527,527,527,527],
|
||||
[527, 31, 31,536, 0,528, 0,547, 0, 31, 0,544, 0,381,527],
|
||||
[527, 31, 31,528, 28,492, 29,528,528, 0, 28,528, 0,528,527],
|
||||
[527,528,528,528, 0,528, 28, 34,492,492,528,528,547, 0,527],
|
||||
[527,381, 0,550, 0,528,528,528,528, 0, 31,528, 0,528,527],
|
||||
[527, 0,528, 0,528,528, 31, 0,536, 27, 0,556,381,378,527],
|
||||
[527, 0,528, 27, 0,544, 0,403, 0,528,528, 0,528,528,527],
|
||||
[527,550,528,528,528,528,492,528,550,528, 34,381,556,376,527],
|
||||
[527, 0, 0, 31,492, 88,403,528, 31,528, 27, 32,528, 0,527],
|
||||
[527,528,528, 0,528,403, 34,547, 0,492,492,528,528,556,527],
|
||||
[527, 0,528,546,528,528,546,528,528,528, 0, 28, 0, 0,527],
|
||||
[527, 0,544, 32, 0,536, 32,528, 32, 0,536,528,528,556,527],
|
||||
[527, 27,492, 0, 27,528, 27,492, 0,528,528,528, 0, 0,527],
|
||||
[527, 31,528, 32, 0,528, 32,546, 0,494, 87,381, 28, 0,527],
|
||||
[527,527,527,527,527,527,527,540,527,527,527,527,527,527,527]
|
||||
],
|
||||
"beforeBattle": {},
|
||||
"bgmap": [
|
||||
|
||||
],
|
||||
"fgmap": [
|
||||
|
||||
],
|
||||
"bg2map": [
|
||||
|
||||
],
|
||||
"fg2map": [
|
||||
|
||||
],
|
||||
"cannotMoveIn": {},
|
||||
"changeFloor": {
|
||||
"5,8": {
|
||||
"floorId": "tower3",
|
||||
"loc": [
|
||||
5,
|
||||
8
|
||||
]
|
||||
},
|
||||
'7,0': {
|
||||
floorId: 'tower6',
|
||||
loc: [1, 15]
|
||||
"7,0": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
7,
|
||||
15
|
||||
]
|
||||
},
|
||||
'7,14': {
|
||||
floorId: 'tower6',
|
||||
loc: [12, 15]
|
||||
"7,14": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
18,
|
||||
15
|
||||
]
|
||||
},
|
||||
'10,13': {
|
||||
floorId: 'tower5',
|
||||
loc: [10, 13]
|
||||
"10,13": {
|
||||
"floorId": "tower5",
|
||||
"loc": [
|
||||
10,
|
||||
13
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
@ -79,7 +79,7 @@ main.floors.tower5=
|
||||
"14,7": {
|
||||
"floorId": "tower6",
|
||||
"loc": [
|
||||
18,
|
||||
24,
|
||||
2
|
||||
]
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -148,9 +148,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
heroLoc.direction = core.turnDirection(heroLoc.direction);
|
||||
core.status.hero.loc = heroLoc;
|
||||
// tower6
|
||||
if (floorId == 'tower6') {
|
||||
core.relocateLoopMap(floorId, heroLoc);
|
||||
}
|
||||
// if (floorId == 'tower6') {
|
||||
// core.relocateLoopMap(floorId, heroLoc);
|
||||
// }
|
||||
// 检查重生怪并重置
|
||||
if (!fromLoad) {
|
||||
core.extractBlocks(floorId);
|
||||
@ -174,11 +174,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
|
||||
// ---------- 重绘新地图;这一步将会设置core.status.floorId ---------- //
|
||||
core.drawMap(floorId);
|
||||
if (floorId == 'tower6') core.backgroundImage('tower6.jpeg');
|
||||
else {
|
||||
core.deleteCanvas('bImage');
|
||||
core.deleteCanvas('eImage');
|
||||
}
|
||||
|
||||
// 切换楼层BGM
|
||||
if (core.status.maps[floorId].bgm) {
|
||||
@ -186,9 +181,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
if (bgm instanceof Array) bgm = bgm[0];
|
||||
if (!core.hasFlag('__bgm__')) core.playBgm(bgm);
|
||||
}
|
||||
// if (flags.chase && fromLoad) {
|
||||
// core.startChase();
|
||||
// }
|
||||
// 更改画面色调
|
||||
var color = core.getFlag('__color__', null);
|
||||
if (!color && core.status.maps[floorId].color)
|
||||
@ -200,8 +192,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
'curtain',
|
||||
0,
|
||||
0,
|
||||
core.__PIXELS__,
|
||||
core.__PIXELS__,
|
||||
core._PX_,
|
||||
core._PY_,
|
||||
core.arrayToRGBA(color)
|
||||
);
|
||||
// 更改天气
|
||||
@ -1773,6 +1765,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
);
|
||||
}
|
||||
|
||||
core.checkLoopMap();
|
||||
|
||||
// 追猎
|
||||
if (core.status.checkBlock.haveHunt) {
|
||||
var x = core.status.hero.loc.x,
|
||||
|
@ -3684,6 +3684,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
};
|
||||
|
||||
control.prototype.updateStatusBar_update = function () {
|
||||
core.control.updateNextFrame = false;
|
||||
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
|
||||
core.control.controldata.updateStatusBar();
|
||||
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||
@ -4028,5 +4029,255 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
this.loadSkillTree = function (data) {
|
||||
levels = data ?? [];
|
||||
};
|
||||
},
|
||||
loopMap: function () {
|
||||
const list = (this.loopMapList = ['tower6']);
|
||||
|
||||
/**
|
||||
* 设置循环地图的偏移量
|
||||
* @param {number} offset 横向偏移量
|
||||
* @param {FloorIds} floorId
|
||||
*/
|
||||
this.setLoopMap = function (offset, floorId) {
|
||||
const floor = core.status.maps[floorId];
|
||||
if (offset < 9) {
|
||||
moveMap(floor.width - 17, floorId);
|
||||
}
|
||||
if (offset > floor.width - 9) {
|
||||
moveMap(17 - floor.width, floorId);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 当勇士移动时自动设置循环地图
|
||||
* @param {FloorIds} floorId
|
||||
*/
|
||||
this.autoSetLoopMap = function (floorId) {
|
||||
this.setLoopMap(core.status.hero.loc.x, floorId);
|
||||
};
|
||||
|
||||
this.checkLoopMap = function () {
|
||||
if (isLoopMap(core.status.floorId)) {
|
||||
this.autoSetLoopMap(core.status.floorId);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 滑动数组
|
||||
* @param {any[]} arr
|
||||
* @param {number} delta
|
||||
*/
|
||||
this.slide = function (arr, delta) {
|
||||
if (delta === 0) return arr;
|
||||
if (delta > 0) {
|
||||
arr.unshift(...arr.splice(arr.length - delta, delta));
|
||||
return arr;
|
||||
}
|
||||
if (delta < 0) {
|
||||
arr.push(...arr.splice(0, -delta));
|
||||
return arr;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 移动地图
|
||||
* @param {number} delta
|
||||
* @param {FloorIds} floorId
|
||||
*/
|
||||
function moveMap(delta, floorId) {
|
||||
core.extractBlocks(floorId);
|
||||
const floor = core.status.maps[floorId];
|
||||
core.setHeroLoc('x', core.status.hero.loc.x + delta);
|
||||
flags[`loop_${floorId}`] += delta;
|
||||
flags[`loop_${floorId}`] %= floor.width;
|
||||
const origin = floor.blocks.slice();
|
||||
for (let i = 0; i < origin.length; i++) {
|
||||
core.removeBlockByIndex(0, floorId);
|
||||
core.removeGlobalAnimate(origin[i].x, origin[i].y);
|
||||
}
|
||||
origin.forEach(v => {
|
||||
let to = v.x + delta;
|
||||
if (to >= floor.width) to -= floor.width;
|
||||
if (to < 0) to += floor.width;
|
||||
core.setBlock(v.id, to, v.y, floorId, true);
|
||||
core.setMapBlockDisabled(floorId, to, v.y, false);
|
||||
});
|
||||
core.drawMap();
|
||||
core.drawHero();
|
||||
}
|
||||
|
||||
function isLoopMap(floorId) {
|
||||
return list.includes(floorId);
|
||||
}
|
||||
|
||||
events.prototype._sys_changeFloor = function (data, callback) {
|
||||
data = data.event.data;
|
||||
let heroLoc = {};
|
||||
if (isLoopMap(data.floorId)) {
|
||||
const floor = core.status.maps[data.floorId];
|
||||
flags[`loop_${data.floorId}`] ??= 0;
|
||||
let tx = data.loc[0] + flags[`loop_${data.floorId}`];
|
||||
tx %= floor.width;
|
||||
if (tx < 0) tx += floor.width;
|
||||
console.log(data.loc[0], tx);
|
||||
heroLoc = {
|
||||
x: tx,
|
||||
y: data.loc[1]
|
||||
};
|
||||
} else if (data.loc) heroLoc = { x: data.loc[0], y: data.loc[1] };
|
||||
if (data.direction) heroLoc.direction = data.direction;
|
||||
if (core.status.event.id != 'action') core.status.event.id = null;
|
||||
core.changeFloor(
|
||||
data.floorId,
|
||||
data.stair,
|
||||
heroLoc,
|
||||
data.time,
|
||||
function () {
|
||||
core.replay();
|
||||
if (callback) callback();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
events.prototype.trigger = function (x, y, callback) {
|
||||
var _executeCallback = function () {
|
||||
// 因为trigger之后还有可能触发其他同步脚本(比如阻激夹域检测)
|
||||
// 所以这里强制callback被异步触发
|
||||
if (callback) {
|
||||
setTimeout(callback, 1); // +1是为了录像检测系统
|
||||
}
|
||||
return;
|
||||
};
|
||||
if (core.status.gameOver) return _executeCallback();
|
||||
if (core.status.event.id == 'action') {
|
||||
core.insertAction(
|
||||
{
|
||||
type: 'function',
|
||||
function:
|
||||
'function () { core.events._trigger_inAction(' +
|
||||
x +
|
||||
',' +
|
||||
y +
|
||||
'); }',
|
||||
async: true
|
||||
},
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
true
|
||||
);
|
||||
return _executeCallback();
|
||||
}
|
||||
if (core.status.event.id) return _executeCallback();
|
||||
|
||||
let block = core.getBlock(x, y);
|
||||
const id = core.status.floorId;
|
||||
const loop = isLoopMap(id);
|
||||
if (loop) {
|
||||
if (block && block.event.trigger === 'changeFloor') {
|
||||
delete block.event.trigger;
|
||||
core.maps._addInfo(block);
|
||||
} else {
|
||||
const floor = core.status.maps[id];
|
||||
let tx = x - flags[`loop_${id}`];
|
||||
tx %= floor.width;
|
||||
if (tx < 0) tx += floor.width;
|
||||
const c = core.floors[id].changeFloor[`${tx},${y}`];
|
||||
if (c) {
|
||||
const b = { event: {}, x: tx, y };
|
||||
b.event.data = c;
|
||||
b.event.trigger = 'changeFloor';
|
||||
block = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (block == null) return _executeCallback();
|
||||
|
||||
// 执行该点的脚本
|
||||
if (block.event.script) {
|
||||
core.clearRouteFolding();
|
||||
try {
|
||||
eval(block.event.script);
|
||||
} catch (ee) {
|
||||
console.error(ee);
|
||||
}
|
||||
}
|
||||
|
||||
// 碰触事件
|
||||
if (block.event.event) {
|
||||
core.clearRouteFolding();
|
||||
core.insertAction(block.event.event, block.x, block.y);
|
||||
// 不再执行该点的系统事件
|
||||
return _executeCallback();
|
||||
}
|
||||
|
||||
if (block.event.trigger && block.event.trigger != 'null') {
|
||||
var noPass = block.event.noPass,
|
||||
trigger = block.event.trigger;
|
||||
if (noPass) core.clearAutomaticRouteNode(x, y);
|
||||
|
||||
// 转换楼层能否穿透
|
||||
if (
|
||||
trigger == 'changeFloor' &&
|
||||
!noPass &&
|
||||
this._trigger_ignoreChangeFloor(block) &&
|
||||
!loop
|
||||
)
|
||||
return _executeCallback();
|
||||
core.status.automaticRoute.moveDirectly = false;
|
||||
this.doSystemEvent(trigger, block);
|
||||
}
|
||||
return _executeCallback();
|
||||
};
|
||||
|
||||
maps.prototype._getBgFgMapArray = function (name, floorId, noCache) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return [];
|
||||
var width = core.floors[floorId].width;
|
||||
var height = core.floors[floorId].height;
|
||||
|
||||
if (!noCache && core.status[name + 'maps'][floorId])
|
||||
return core.status[name + 'maps'][floorId];
|
||||
|
||||
var arr =
|
||||
main.mode == 'editor' &&
|
||||
!(window.editor && editor.uievent && editor.uievent.isOpen)
|
||||
? core.cloneArray(editor[name + 'map'])
|
||||
: null;
|
||||
if (arr == null)
|
||||
arr = core.cloneArray(core.floors[floorId][name + 'map'] || []);
|
||||
|
||||
if (isLoopMap(floorId) && window.flags) {
|
||||
flags[`loop_${floorId}`] ??= 0;
|
||||
arr.forEach(v => {
|
||||
core.slide(v, flags[`loop_${floorId}`] % width);
|
||||
});
|
||||
}
|
||||
|
||||
for (var y = 0; y < height; ++y) {
|
||||
if (arr[y] == null) arr[y] = Array(width).fill(0);
|
||||
}
|
||||
(core.getFlag('__' + name + 'v__', {})[floorId] || []).forEach(
|
||||
function (one) {
|
||||
arr[one[1]][one[0]] = one[2] || 0;
|
||||
}
|
||||
);
|
||||
(core.getFlag('__' + name + 'd__', {})[floorId] || []).forEach(
|
||||
function (one) {
|
||||
arr[one[1]][one[0]] = 0;
|
||||
}
|
||||
);
|
||||
if (main.mode == 'editor') {
|
||||
for (var x = 0; x < width; x++) {
|
||||
for (var y = 0; y < height; y++) {
|
||||
arr[y][x] = arr[y][x].idnum || arr[y][x] || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (core.status[name + 'maps'])
|
||||
core.status[name + 'maps'][floorId] = arr;
|
||||
return arr;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user