mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-10 23:44:31 +08:00
feat: 新的渲染系统
This commit is contained in:
1 parent
af38d2e47e
commit
2f8fbd375c
34 files changed
+1173
-179
No files matched your search
+15
-4
@@ -1,5 +1,5 @@
|
||||
import { EmitableEvent, EventEmitter } from '../core/common/eventEmitter';
|
||||
import { DamageEnemy } from './enemy/damage';
|
||||
import type { DamageEnemy } from './enemy/damage';
|
||||
|
||||
// ----- 加载事件
|
||||
interface GameLoadEvent extends EmitableEvent {
|
||||
@@ -75,25 +75,36 @@ class GameLoading extends EventEmitter<GameLoadEvent> {
|
||||
export const loading = new GameLoading();
|
||||
|
||||
export interface GameEvent extends EmitableEvent {
|
||||
/** Emitted in events.prototype.resetGame. */
|
||||
/** Emitted in libs/events.js resetGame. */
|
||||
reset: () => void;
|
||||
/** Emitted in src/App.vue setup. */
|
||||
mounted: () => void;
|
||||
/** Emitted in plugin/ui.js */
|
||||
/** Emitted in plugin/game/ui.ts updateStatusBar_update */
|
||||
statusBarUpdate: () => void;
|
||||
/** Emitted in core/index.ts */
|
||||
renderLoaded: () => void;
|
||||
// /** Emitted in libs/events.js */
|
||||
/** Emitted in libs/events.js getItem */
|
||||
afterGetItem: (
|
||||
itemId: AllIdsOf<'items'>,
|
||||
x: number,
|
||||
y: number,
|
||||
isGentleClick: boolean
|
||||
) => void;
|
||||
/** Emitted in libs/events.js _openDoor_animate */
|
||||
afterOpenDoor: (doorId: AllIdsOf<'animates'>, x: number, y: number) => void;
|
||||
/** Emitted in project/functions.js afterChangeFloor */
|
||||
afterChangeFloor: (floorId: FloorIds) => void;
|
||||
/** Emitted in project/functions.js moveOneStep */
|
||||
moveOneStep: (x: number, y: number, floorId: FloorIds) => void;
|
||||
/** Emitted in src/game/enemy/battle.ts afterBattle */
|
||||
afterBattle: (enemy: DamageEnemy, x?: number, y?: number) => void;
|
||||
/** Emitted in libs/events.js changingFloor */
|
||||
changingFloor: (floorId: FloorIds, heroLoc: Loc) => void;
|
||||
drawHero: (
|
||||
status?: Exclude<keyof MaterialIcon['hero']['down'], 'loc'>,
|
||||
offset?: number,
|
||||
frame?: number
|
||||
) => void;
|
||||
}
|
||||
|
||||
export const hook = new EventEmitter<GameEvent>();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { has } from '@/plugin/game/utils';
|
||||
import { loading } from '../game';
|
||||
|
||||
export namespace BluePalace {
|
||||
type DoorConvertInfo = [id: AllIds, x: number, y: number];
|
||||
|
||||
// ---------- 黄蓝门转换
|
||||
|
||||
function drawDoors(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
convert: DoorConvertInfo[],
|
||||
@@ -75,4 +78,30 @@ export namespace BluePalace {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 传送门部分
|
||||
|
||||
interface Portal {
|
||||
fx: number;
|
||||
fy: number;
|
||||
dir: Dir;
|
||||
tx: number;
|
||||
ty: number;
|
||||
toDir: Dir;
|
||||
}
|
||||
|
||||
export const portals: Partial<Record<FloorIds, Portal[]>> = {
|
||||
MT75: [
|
||||
{ fx: 7, fy: 7, dir: 'left', tx: 9, ty: 9, toDir: 'down' },
|
||||
{ fx: 5, fy: 11, dir: 'right', tx: 7, ty: 9, toDir: 'up' },
|
||||
{ fx: 4, fy: 6, dir: 'right', tx: 9, ty: 4, toDir: 'up' },
|
||||
{ fx: 5, fy: 9, dir: 'right', tx: 3, ty: 7, toDir: 'up' },
|
||||
{ fx: 7, fy: 5, dir: 'right', tx: 4, ty: 9, toDir: 'up' }
|
||||
]
|
||||
};
|
||||
loading.once('coreInit', initPortals);
|
||||
|
||||
function initPortals() {
|
||||
// 主要是复写勇士绘制以及传送判定,还有自动寻路
|
||||
}
|
||||
}
|
||||
+12
-2
@@ -25,13 +25,16 @@ import type * as damage from './enemy/damage';
|
||||
import type { Logger } from '@/core/common/logger';
|
||||
import type { Danmaku } from '@/core/main/custom/danmaku';
|
||||
import type * as misc from './mechanism/misc';
|
||||
import type { MotaCanvas2D } from '@/core/fx/canvas2d';
|
||||
import type * as portal from '@/core/fx/portal';
|
||||
import type { HeroRenderer } from '@/core/render/hero';
|
||||
|
||||
interface ClassInterface {
|
||||
// 渲染进程与游戏进程通用
|
||||
EventEmitter: typeof EventEmitter;
|
||||
IndexedEventEmitter: typeof IndexedEventEmitter;
|
||||
Disposable: typeof Disposable;
|
||||
// 定义于渲染进程,录像中会进行polyfill,但是不执行任何内容
|
||||
// 定义于渲染进程
|
||||
GameStorage: typeof GameStorage;
|
||||
MotaSetting: typeof MotaSetting;
|
||||
SettingDisplayer: typeof SettingDisplayer;
|
||||
@@ -45,12 +48,13 @@ interface ClassInterface {
|
||||
SoundEffect: typeof SoundEffect;
|
||||
SoundController: typeof SoundController;
|
||||
BgmController: typeof BgmController;
|
||||
MotaCanvas2D: typeof MotaCanvas2D;
|
||||
Danmaku: typeof Danmaku;
|
||||
// todo: 放到插件 ShaderEffect: typeof ShaderEffect;
|
||||
// 定义于游戏进程,渲染进程依然可用
|
||||
Range: typeof Range;
|
||||
EnemyCollection: typeof EnemyCollection;
|
||||
DamageEnemy: typeof DamageEnemy;
|
||||
Danmaku: typeof Danmaku;
|
||||
}
|
||||
|
||||
type _IBattle = typeof battle;
|
||||
@@ -90,6 +94,12 @@ interface ModuleInterface {
|
||||
Mechanism: {
|
||||
BluePalace: typeof misc.BluePalace;
|
||||
};
|
||||
Effect: {
|
||||
Portal: typeof portal;
|
||||
};
|
||||
Render: {
|
||||
heroRender: HeroRenderer;
|
||||
};
|
||||
}
|
||||
|
||||
interface SystemInterfaceMap {
|
||||
|
||||
Reference in new issue
Block a user