mirror of
https://github.com/motajs/template.git
synced 2026-11-02 15:04:30 +08:00
reafactor: 目录结构修改
This commit is contained in:
1 parent
63e1a01fab
commit
6c1acb990e
17 files changed
+35
-131
No files matched your search
@@ -1,12 +1,13 @@
|
||||
import { ICoreState, IGameDataState, IStateSaveData } from './types';
|
||||
import { ICoreState, IStateSaveData } from './types';
|
||||
import { IHeroState, HeroState } from './hero';
|
||||
import { ILayerState, LayerState } from './map';
|
||||
import { IRoleFaceBinder, RoleFaceBinder } from './common';
|
||||
import { GameDataState } from './data';
|
||||
import {
|
||||
DamageSystem,
|
||||
EnemyContext,
|
||||
EnemyManager,
|
||||
IEnemyContext,
|
||||
IEnemyManager,
|
||||
MapDamage
|
||||
} from '@user/data-base';
|
||||
import { IEnemyAttributes } from './enemy/types';
|
||||
@@ -15,16 +16,19 @@ import {
|
||||
GuardAuraConverter,
|
||||
MainEnemyFinalEffect,
|
||||
MainMapDamageConverter,
|
||||
MainMapDamageReducer
|
||||
MainMapDamageReducer,
|
||||
registerSpecials
|
||||
} from './enemy';
|
||||
import { TILE_HEIGHT, TILE_WIDTH } from './shared';
|
||||
|
||||
export class CoreState implements ICoreState {
|
||||
readonly layer: ILayerState;
|
||||
readonly hero: IHeroState;
|
||||
readonly roleFace: IRoleFaceBinder;
|
||||
readonly data: IGameDataState;
|
||||
readonly idNumberMap: Map<string, number>;
|
||||
readonly numberIdMap: Map<number, string>;
|
||||
|
||||
readonly enemyManager: IEnemyManager<IEnemyAttributes>;
|
||||
readonly enemyContext: IEnemyContext<IEnemyAttributes>;
|
||||
|
||||
constructor() {
|
||||
@@ -33,8 +37,10 @@ export class CoreState implements ICoreState {
|
||||
this.roleFace = new RoleFaceBinder();
|
||||
this.idNumberMap = new Map();
|
||||
this.numberIdMap = new Map();
|
||||
this.data = new GameDataState();
|
||||
|
||||
// 怪物管理器初始化
|
||||
this.enemyManager = new EnemyManager();
|
||||
registerSpecials(this.enemyManager);
|
||||
// 怪物上下文初始化
|
||||
const enemyContext = new EnemyContext<IEnemyAttributes>();
|
||||
const damageSystem = new DamageSystem(enemyContext);
|
||||
@@ -46,7 +52,7 @@ export class CoreState implements ICoreState {
|
||||
enemyContext.registerAuraConverter(new CommonAuraConverter());
|
||||
enemyContext.registerAuraConverter(new GuardAuraConverter());
|
||||
enemyContext.registerFinalEffect(new MainEnemyFinalEffect());
|
||||
enemyContext.resize(core._WIDTH_, core._HEIGHT_);
|
||||
enemyContext.resize(TILE_WIDTH, TILE_HEIGHT);
|
||||
this.enemyContext = enemyContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { EnemyManager, IEnemyManager } from '@user/data-base';
|
||||
import { IEnemyAttributes } from './enemy/types';
|
||||
import { IGameDataState } from './types';
|
||||
import { registerSpecials } from './enemy';
|
||||
|
||||
export class GameDataState implements IGameDataState {
|
||||
readonly enemyManager: IEnemyManager<IEnemyAttributes>;
|
||||
|
||||
constructor() {
|
||||
this.enemyManager = new EnemyManager<IEnemyAttributes>();
|
||||
registerSpecials(this.enemyManager);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
IManhattanRangeParam,
|
||||
IRange,
|
||||
IRectRangeParam,
|
||||
ITileLocator,
|
||||
ManhattanRange,
|
||||
RectRange
|
||||
} from '@motajs/common';
|
||||
@@ -17,7 +18,6 @@ import {
|
||||
IEnemy
|
||||
} from '@user/data-base';
|
||||
import { IHaloValue } from './special';
|
||||
import { ITileLocator } from '@user/types';
|
||||
import { IEnemyAttributes } from './types';
|
||||
|
||||
const FULL_RANGE = new FullRange();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IEnemy, IEnemyFinalEffect } from '@user/data-base';
|
||||
import { IEnemyAttributes } from './types';
|
||||
import { ITileLocator } from '@user/types';
|
||||
import { ITileLocator } from '@motajs/common';
|
||||
|
||||
const HERO_STATUS_PLACEHOLDER = {
|
||||
atk: 0,
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
IRectRangeParam,
|
||||
ManhattanRange,
|
||||
RayRange,
|
||||
RectRange
|
||||
RectRange,
|
||||
ITileLocator
|
||||
} from '@motajs/common';
|
||||
import { ITileLocator } from '@user/types';
|
||||
import { IReadonlyEnemy, ISpecial } from '@user/data-base';
|
||||
import {
|
||||
IEnemyContext,
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
/** 每个地图的默认宽度 */
|
||||
export const TILE_WIDTH = 13;
|
||||
/** 每个地图的默认高度 */
|
||||
export const TILE_HEIGHT = 13;
|
||||
|
||||
/** 默认的勇士图片 */
|
||||
export const DEFAULT_HERO_IMAGE: ImageIds = 'hero.png';
|
||||
@@ -21,13 +21,13 @@ export interface ICoreState {
|
||||
readonly hero: IHeroState;
|
||||
/** 朝向绑定 */
|
||||
readonly roleFace: IRoleFaceBinder;
|
||||
/** 游戏数据状态 */
|
||||
readonly data: IGameDataState;
|
||||
/** id 到图块数字的映射 */
|
||||
readonly idNumberMap: Map<string, number>;
|
||||
/** 图块数字到 id 的映射 */
|
||||
readonly numberIdMap: Map<number, string>;
|
||||
|
||||
/** 怪物管理器 */
|
||||
readonly enemyManager: IEnemyManager<IEnemyAttributes>;
|
||||
/** 怪物上下文 */
|
||||
readonly enemyContext: IEnemyContext<IEnemyAttributes>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user