/** @format */ import {AudioManager} from './mgrs/AudioManager' import {EventManager} from './mgrs/EventManager' import {LocalStorageManager} from './mgrs/LocalStorageManager' import {PlatformManager} from './mgrs/PlatformManager' import {PrefabPoolManager} from './mgrs/PrefabPoolManager' import {ResourceManager} from './mgrs/ResourceManager' import {UIManager} from './mgrs/UIManager' import {NetManager} from './mgrs/NetManager' import {Log} from './utils/LogUtils' import {HttpManager} from './mgrs/HttpManager' import {GameData} from './data/GameData' import {MainData} from './data/MainData' import {UserData} from './data/UserData' import {I18nManager} from './mgrs/I18nManager' import {GoodsManager} from './mgrs/GoodsManager' import {DIS_ID, Language} from './enums/Enum' import {TimeManager} from './mgrs/TimeManager' import {GlobalManager} from './mgrs/GlobalManager' import {DataConfig} from './config/DataConfig' import {GameManager} from './mgrs/GameManager' import {ZumaData} from './data/ZumaData' export const Data = { game: new GameData(), main: new MainData(), user: new UserData(), zuma: new ZumaData(), init() { Data.game.init() Data.main.init() Data.user.init() }, reset() { Data.user.reset() Data.main.reset() Data.game.reset() }, } export const Mgr = { audio: new AudioManager(), // 音频管理器 event: new EventManager(), // 事件管理器 storage: new LocalStorageManager(), // 本地存储管理器 platform: new PlatformManager(), // 平台管理器 pool: new PrefabPoolManager(), // 节点池管理器 res: new ResourceManager(), // 资源管理器 ui: new UIManager(), // UI管理器 net: new NetManager(), // Net管理器 http: new HttpManager(), // HTTP管理器 i18n: new I18nManager(), // 多语言管理器 goods: new GoodsManager(), // 道具管理器 time: new TimeManager(), // 时间管理器 global: new GlobalManager(), // 全局管理器 game: new GameManager(), // 战斗管理器 async init() { cc.director.getCollisionManager().enabled = true // cc.director.getCollisionManager().enabledDebugDraw = true let isInit: boolean = true Mgr.platform.init() Mgr.net.init() isInit = isInit && (await Mgr.audio.init()) && (await Mgr.ui.init()) && (await Mgr.i18n.init(DataConfig[DIS_ID.language].data1)) if (!isInit) Log.warn('GameControl 框架初始化失败') return isInit }, reset() { Mgr.event.reset() Mgr.ui.closeAll() Mgr.time.reset() Mgr.goods.reset() Mgr.net.reset() Mgr.global.reset() }, } export class GameControl { public static async init() { Data.init() return await Mgr.init() } public static resetGame() { Mgr.net.stopReConnect() Data.reset() Mgr.reset() cc.director.loadScene('Main') } } CC_DEV && window && (window['Mgr'] = Mgr) CC_DEV && window && (window['Data'] = Data)