chore: 调整部分错误

This commit is contained in:
AncTe committed 2026-10-04 15:44:52 +08:00
1 parent 75a39ad573
commit ce459d9e2d
5 files changed
+10 -67

No files matched your search

@@ -2,4 +2,3 @@ export * from './autotile';
export * from './builder';
export * from './manager';
export * from './types';
export * from './utils';
@@ -35,6 +35,7 @@ interface ITilesetCache {
}
export class TextureManager implements ITextureManager {
readonly tiles: ITileStore;
readonly autotile: IAutotileProcessor;
readonly textures: ITextureStore = new TextureStore();
@@ -83,10 +84,10 @@ export class TextureManager implements ITextureManager {
constructor(
readonly state: ICoreState,
readonly tiles: ITileStore,
readonly tilesetReserve: number,
readonly tilesetUnit: number
) {
this.tiles = state.tileStore;
this.autotile = new AutotileProcessor(state);
this.assetBuilder = new AssetBuilder(this, state);
this.assetBuilder.pipe(this.assetStore);
@@ -1,53 +0,0 @@
import { ITexture } from '@motajs/render';
import { BlockCls } from './types';
/**
* @deprecated 后续理应不需要此接口
*/
export function getClsByString(cls: Cls): BlockCls {
switch (cls) {
case 'terrains':
return BlockCls.Terrains;
case 'animates':
return BlockCls.Animates;
case 'autotile':
return BlockCls.Autotile;
case 'enemys':
return BlockCls.Enemys;
case 'items':
return BlockCls.Items;
case 'npcs':
return BlockCls.Npcs;
case 'npc48':
return BlockCls.Npc48;
case 'enemy48':
return BlockCls.Enemy48;
case 'tileset':
return BlockCls.Tileset;
default:
return BlockCls.Unknown;
}
}
/**
* @deprecated 后续应对存储结构进行重构,每个 tile 都可以自定义帧数
*/
export function getTextureFrame(cls: BlockCls, texture: ITexture) {
switch (cls) {
case BlockCls.Animates:
case BlockCls.Enemy48:
case BlockCls.Npc48:
return 4;
case BlockCls.Autotile:
return texture.width === 384 ? 4 : 1;
case BlockCls.Enemys:
case BlockCls.Npcs:
return 2;
case BlockCls.Items:
case BlockCls.Terrains:
case BlockCls.Tileset:
return 1;
case BlockCls.Unknown:
return 0;
}
}