mirror of
https://github.com/motajs/template.git
synced 2026-10-16 10:30:18 +08:00
33 lines
884 B
TypeScript
33 lines
884 B
TypeScript
import { ICoreState } from '@user/data-state';
|
|
import { IShopManager, IShopPlugin, IShopState, IShopSystem } from './types';
|
|
import { ShopManager } from './manager';
|
|
import { ShopState } from './state';
|
|
import { ShopSystem } from './system';
|
|
|
|
export class ShopPlugin implements IShopPlugin {
|
|
id: string = 'shop-plugin';
|
|
dependencies: string[] = [];
|
|
|
|
shop!: IShopSystem;
|
|
manager!: IShopManager;
|
|
|
|
/** 数据端主对象 */
|
|
private state!: ICoreState;
|
|
|
|
createShopState(id: string): IShopState {
|
|
return new ShopState(id, this.state);
|
|
}
|
|
|
|
awake(state: ICoreState): void {
|
|
this.state = state;
|
|
this.shop = new ShopSystem(state);
|
|
this.manager = new ShopManager(state);
|
|
|
|
state.addSaveableContent('@plugin/shop', this.manager);
|
|
}
|
|
|
|
async initialize(): Promise<void> {}
|
|
|
|
async afterLoad(): Promise<void> {}
|
|
}
|