fix: 编辑器报错 & 设置勇士朝向

This commit is contained in:
unanmed 2024-09-27 15:13:54 +08:00
parent 80f154694a
commit ac8a61558e
6 changed files with 28 additions and 2 deletions

View File

@ -36,6 +36,7 @@
"@babel/preset-env": "^7.25.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-terser": "^0.4.4",

View File

@ -67,6 +67,9 @@ devDependencies:
'@rollup/plugin-commonjs':
specifier: ^25.0.8
version: 25.0.8(rollup@3.29.4)
'@rollup/plugin-json':
specifier: ^6.1.0
version: 6.1.0(rollup@3.29.4)
'@rollup/plugin-node-resolve':
specifier: ^15.2.3
version: 15.2.3(rollup@3.29.4)
@ -2527,6 +2530,19 @@ packages:
rollup: 3.29.4
dev: true
/@rollup/plugin-json@6.1.0(rollup@3.29.4):
resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
dependencies:
'@rollup/pluginutils': 5.1.0(rollup@3.29.4)
rollup: 3.29.4
dev: true
/@rollup/plugin-node-resolve@15.2.3(rollup@3.29.4):
resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==}
engines: {node: '>=14.0.0'}

View File

@ -16,6 +16,7 @@ import EventEmitter from 'events';
import { WebSocket, WebSocketServer } from 'ws';
import chokidar from 'chokidar';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
const base = './public';
@ -151,7 +152,8 @@ async function getEsmFile(
plugins: [
typescript({ sourceMap: true }),
nodeResolve(),
commonjs()
commonjs(),
json()
],
onwarn() {}
});

View File

@ -1,5 +1,5 @@
import { debounce } from 'lodash-es';
import logInfo from '@/data/logger.json';
import logInfo from '../../data/logger.json';
// todo: 使用格式化输出?

View File

@ -65,6 +65,10 @@ export function init() {
return moveSteps;
}
function setHeroDirection(dir: Dir) {
if (!heroMover.moving) heroMover.moveDir = dir;
}
/**
*
*/
@ -164,6 +168,7 @@ export function init() {
}
if (name === 'direction') {
adapters['hero-adapter']?.sync('turn', value);
setHeroDirection(value as Dir);
} else if (name === 'x') {
adapters['hero-adapter']?.sync('setHeroLoc', value);
} else {

2
src/types/ui.d.ts vendored
View File

@ -799,11 +799,13 @@ interface Ui {
drawBook(index: number): void;
/**
* @deprecated
*
*/
drawFly(page: number): void;
/**
* @deprecated
*
*/
getToolboxItems<T extends Exclude<ItemCls, 'items'>>(cls: T): ItemIdOf<T>[];