mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 23:29:27 +08:00
更新热重载服务
This commit is contained in:
parent
a61952034a
commit
9b5b212828
26
package.json
26
package.json
@ -18,20 +18,20 @@
|
|||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
"ant-design-vue": "^3.2.20",
|
"ant-design-vue": "^3.2.20",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"chart.js": "^4.3.0",
|
"chart.js": "^4.3.2",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"lz-string": "^1.5.0",
|
"lz-string": "^1.5.0",
|
||||||
"mutate-animate": "^1.1.3",
|
"mutate-animate": "^1.2.3",
|
||||||
"three": "^0.149.0",
|
"three": "^0.149.0",
|
||||||
"vue": "^3.3.4"
|
"vue": "^3.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.22.5",
|
"@babel/cli": "^7.22.9",
|
||||||
"@babel/core": "^7.22.5",
|
"@babel/core": "^7.22.9",
|
||||||
"@babel/preset-env": "^7.22.5",
|
"@babel/preset-env": "^7.22.9",
|
||||||
"@rollup/plugin-babel": "^6.0.3",
|
"@rollup/plugin-babel": "^6.0.3",
|
||||||
"@rollup/plugin-commonjs": "^25.0.2",
|
"@rollup/plugin-commonjs": "^25.0.3",
|
||||||
"@rollup/plugin-node-resolve": "^15.1.0",
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
||||||
"@rollup/plugin-replace": "^5.0.2",
|
"@rollup/plugin-replace": "^5.0.2",
|
||||||
"@rollup/plugin-terser": "^0.4.3",
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
@ -39,10 +39,10 @@
|
|||||||
"@types/babel__core": "^7.20.1",
|
"@types/babel__core": "^7.20.1",
|
||||||
"@types/fontmin": "^0.9.0",
|
"@types/fontmin": "^0.9.0",
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/lodash-es": "^4.17.7",
|
"@types/lodash-es": "^4.17.8",
|
||||||
"@types/node": "^18.16.19",
|
"@types/node": "^18.17.1",
|
||||||
"@types/ws": "^8.5.5",
|
"@types/ws": "^8.5.5",
|
||||||
"@vitejs/plugin-legacy": "^4.0.5",
|
"@vitejs/plugin-legacy": "^4.1.1",
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@vitejs/plugin-vue": "^4.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
@ -51,13 +51,13 @@
|
|||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
"rollup": "^3.26.0",
|
"rollup": "^3.26.3",
|
||||||
"terser": "^5.18.2",
|
"terser": "^5.19.2",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"unplugin-vue-components": "^0.22.12",
|
"unplugin-vue-components": "^0.22.12",
|
||||||
"vite": "^4.3.9",
|
"vite": "^4.4.7",
|
||||||
"vue-tsc": "^1.8.3",
|
"vue-tsc": "^1.8.8",
|
||||||
"ws": "^8.13.0"
|
"ws": "^8.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
1311
pnpm-lock.yaml
1311
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -287,16 +287,7 @@ control.prototype._animationFrame_animate = function (timestamp) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
control.prototype._animationFrame_heroMoving = function (timestamp) {
|
control.prototype._animationFrame_heroMoving = function (timestamp) {
|
||||||
if (core.status.heroMoving <= 0) return;
|
// Deprecated. See src/plugin/game/heroFourFrames.js
|
||||||
// 换腿
|
|
||||||
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
|
|
||||||
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
|
|
||||||
core.animateFrame.moveTime = timestamp;
|
|
||||||
}
|
|
||||||
core.drawHero(
|
|
||||||
core.animateFrame.leftLeg ? 'leftFoot' : 'rightFoot',
|
|
||||||
4 * core.status.heroMoving
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
control.prototype._animationFrame_weather = function (timestamp) {
|
control.prototype._animationFrame_weather = function (timestamp) {
|
||||||
|
@ -1024,9 +1024,9 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) {
|
|||||||
}
|
}
|
||||||
// 是否存在阻激夹域伤害
|
// 是否存在阻激夹域伤害
|
||||||
// todo: 不使用 core.status.checkBlock
|
// todo: 不使用 core.status.checkBlock
|
||||||
if (core.status.checkBlock.damage[index]) return false;
|
// if (core.status.checkBlock.damage[index]) return false;
|
||||||
if (core.status.checkBlock.repulse[index]) return false;
|
// if (core.status.checkBlock.repulse[index]) return false;
|
||||||
if (core.status.checkBlock.mockery[index]) return false;
|
// if (core.status.checkBlock.mockery[index]) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -1123,8 +1123,8 @@ maps.prototype._automaticRoute_deepAdd = function (x, y, blocks) {
|
|||||||
}
|
}
|
||||||
// 绕过存在伤害的地方
|
// 绕过存在伤害的地方
|
||||||
// todo: 不使用 core.status.checkBlock
|
// todo: 不使用 core.status.checkBlock
|
||||||
deepAdd += (core.status.checkBlock.damage[x + ',' + y] || 0) * 100;
|
// deepAdd += (core.status.checkBlock.damage[x + ',' + y] || 0) * 100;
|
||||||
deepAdd += core.status.checkBlock.mockery[`${x},${y}`] ? 1000 : 0;
|
// deepAdd += core.status.checkBlock.mockery[`${x},${y}`] ? 1000 : 0;
|
||||||
return deepAdd;
|
return deepAdd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3301,7 +3301,6 @@ ui.prototype._drawViewMaps = function (index, x, y) {
|
|||||||
this.clearUI();
|
this.clearUI();
|
||||||
if (index == null) return this._drawViewMaps_drawHint();
|
if (index == null) return this._drawViewMaps_drawHint();
|
||||||
core.animateFrame.tip = null;
|
core.animateFrame.tip = null;
|
||||||
// todo: 不使用 core.status.checkBlock
|
|
||||||
var data = this._drawViewMaps_buildData(index, x, y);
|
var data = this._drawViewMaps_buildData(index, x, y);
|
||||||
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
|
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
|
||||||
core.drawThumbnail(data.floorId, null, {
|
core.drawThumbnail(data.floorId, null, {
|
||||||
|
@ -1368,8 +1368,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
core.statusBar.hard.setAttribute('_style', hardColor);
|
core.statusBar.hard.setAttribute('_style', hardColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新阻激夹域的伤害值
|
|
||||||
core.updateCheckBlock();
|
|
||||||
// 更新全地图显伤
|
// 更新全地图显伤
|
||||||
core.updateDamage();
|
core.updateDamage();
|
||||||
|
|
||||||
@ -1845,8 +1843,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
|||||||
|
|
||||||
// 判定能否瞬移到该点
|
// 判定能否瞬移到该点
|
||||||
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
|
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
|
||||||
// todo: 删除这个判断
|
|
||||||
if (core.status.checkBlock.haveHunt) return false;
|
|
||||||
if (ignoreSteps >= 0) {
|
if (ignoreSteps >= 0) {
|
||||||
core.clearMap('hero');
|
core.clearMap('hero');
|
||||||
// 获得勇士最后的朝向
|
// 获得勇士最后的朝向
|
||||||
|
@ -569,15 +569,10 @@ function setupSocket(socket: WebSocket) {
|
|||||||
watchProject();
|
watchProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startWsServer(port: number = 8080) {
|
async function startWsServer(http: Server) {
|
||||||
const tryNext = () => {
|
|
||||||
return new Promise<WebSocketServer>(res => {
|
return new Promise<WebSocketServer>(res => {
|
||||||
const server = new WebSocketServer({
|
const server = new WebSocketServer({
|
||||||
port: port++
|
server: http
|
||||||
});
|
|
||||||
|
|
||||||
server.on('error', async () => {
|
|
||||||
res(await tryNext());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('connection', socket => {
|
server.on('connection', socket => {
|
||||||
@ -585,8 +580,6 @@ async function startWsServer(port: number = 8080) {
|
|||||||
res(server);
|
res(server);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
|
||||||
return tryNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(async function () {
|
(async function () {
|
||||||
@ -596,8 +589,8 @@ async function startWsServer(port: number = 8080) {
|
|||||||
console.log(`游戏地址:http://localhost:5173/games/${config.name}/`);
|
console.log(`游戏地址:http://localhost:5173/games/${config.name}/`);
|
||||||
|
|
||||||
// 2. 启动样板http服务
|
// 2. 启动样板http服务
|
||||||
await startHttpServer();
|
const server = await startHttpServer(3000);
|
||||||
|
|
||||||
// 3. 启动样板ws热重载服务
|
// 3. 启动样板ws热重载服务
|
||||||
await startWsServer();
|
await startWsServer(server);
|
||||||
})();
|
})();
|
||||||
|
@ -117,7 +117,8 @@ maps.prototype._loadFloor_doNotCopy = function () {
|
|||||||
'afterBattle',
|
'afterBattle',
|
||||||
'afterGetItem',
|
'afterGetItem',
|
||||||
'afterOpenDoor',
|
'afterOpenDoor',
|
||||||
'cannotMove'
|
'cannotMove',
|
||||||
|
'enemy'
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
////// 绘制背景和前景层 //////
|
////// 绘制背景和前景层 //////
|
||||||
|
@ -159,7 +159,7 @@ export {};
|
|||||||
console.log(`Data hot reload: ${data}`);
|
console.log(`Data hot reload: ${data}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ws = new WebSocket('ws://127.0.0.1:8080');
|
const ws = new WebSocket('ws://127.0.0.1:3000');
|
||||||
ws.addEventListener('open', () => {
|
ws.addEventListener('open', () => {
|
||||||
console.log(`Web socket connect successfully`);
|
console.log(`Web socket connect successfully`);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export {};
|
import { ensureFloorDamage } from './damage';
|
||||||
|
|
||||||
core.control.updateDamage = function (floorId = core.status.floorId, ctx) {
|
core.control.updateDamage = function (floorId = core.status.floorId, ctx) {
|
||||||
if (!floorId || core.status.gameOver || main.mode !== 'play') return;
|
if (!floorId || core.status.gameOver || main.mode !== 'play') return;
|
||||||
@ -16,7 +16,7 @@ core.control.updateDamage = function (floorId = core.status.floorId, ctx) {
|
|||||||
if (width * height > core.bigmap.threshold) return;
|
if (width * height > core.bigmap.threshold) return;
|
||||||
}
|
}
|
||||||
// 计算伤害
|
// 计算伤害
|
||||||
core.plugin.damage.ensureFloorDamage(floorId);
|
ensureFloorDamage(floorId);
|
||||||
|
|
||||||
floor.enemy.calDamage(true, onMap);
|
floor.enemy.calDamage(true, onMap);
|
||||||
floor.enemy.calMapDamage();
|
floor.enemy.calMapDamage();
|
||||||
|
@ -8,7 +8,7 @@ control.prototype.checkBlock = function (forceMockery) {
|
|||||||
var x = core.getHeroLoc('x'),
|
var x = core.getHeroLoc('x'),
|
||||||
y = core.getHeroLoc('y'),
|
y = core.getHeroLoc('y'),
|
||||||
loc = x + ',' + y;
|
loc = x + ',' + y;
|
||||||
var damage = core.status.checkBlock.damage[loc];
|
var damage = 0;
|
||||||
if (damage) {
|
if (damage) {
|
||||||
if (!main.replayChecking)
|
if (!main.replayChecking)
|
||||||
core.addPop(
|
core.addPop(
|
||||||
@ -33,8 +33,8 @@ control.prototype.checkBlock = function (forceMockery) {
|
|||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
// this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
||||||
checkMockery(loc, forceMockery);
|
// checkMockery(loc, forceMockery);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,9 +147,9 @@ control.prototype.moveHero = function (direction, callback) {
|
|||||||
|
|
||||||
const nx = core.nextX();
|
const nx = core.nextX();
|
||||||
const ny = core.nextY();
|
const ny = core.nextY();
|
||||||
if (core.status.checkBlock.mockery[`${nx},${ny}`]) {
|
// if (core.status.checkBlock.mockery[`${nx},${ny}`]) {
|
||||||
core.autosave();
|
// core.autosave();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (callback) return this.moveAction(callback);
|
if (callback) return this.moveAction(callback);
|
||||||
this._moveHero_moving();
|
this._moveHero_moving();
|
||||||
|
@ -154,6 +154,7 @@ export function boundary(arr: any, key?: any) {
|
|||||||
return [min, max];
|
return [min, max];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface GamePluginUtils {
|
interface GamePluginUtils {
|
||||||
ofDir: typeof ofDir;
|
ofDir: typeof ofDir;
|
||||||
|
6
src/types/core.d.ts
vendored
6
src/types/core.d.ts
vendored
@ -238,7 +238,7 @@ interface AnimateFrame {
|
|||||||
/**
|
/**
|
||||||
* 勇士移动的时候上一次的换腿时间
|
* 勇士移动的时候上一次的换腿时间
|
||||||
*/
|
*/
|
||||||
readonly moveTime: number;
|
moveTime: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@ -249,7 +249,7 @@ interface AnimateFrame {
|
|||||||
/**
|
/**
|
||||||
* 当前是否在左腿上,使用了四帧插件时无效
|
* 当前是否在左腿上,使用了四帧插件时无效
|
||||||
*/
|
*/
|
||||||
readonly leftLeg: boolean;
|
leftLeg: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前天气信息
|
* 当前天气信息
|
||||||
@ -965,7 +965,7 @@ interface Core extends Pick<Main, CoreDataFromMain> {
|
|||||||
/**
|
/**
|
||||||
* 大地图信息
|
* 大地图信息
|
||||||
*/
|
*/
|
||||||
readonly bigmap: Readonly<CoreBigmap>;
|
readonly bigmap: CoreBigmap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存档信息
|
* 存档信息
|
||||||
|
@ -53,11 +53,6 @@ import { noClosePanel } from '../plugin/uiController';
|
|||||||
const floorId =
|
const floorId =
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
||||||
// 清除浏览地图时的光环缓存
|
|
||||||
if (floorId !== core.status.floorId && core.status.checkBlock) {
|
|
||||||
// @ts-ignore
|
|
||||||
core.status.checkBlock.cache = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const enemy = core.getCurrentEnemys(floorId);
|
const enemy = core.getCurrentEnemys(floorId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user