import { _EJsonRes } from "./Engine/Data/CommonDataType"; import Engine from "./Engine/Engine"; import EventManager from "./Engine/Event/EventManager"; import JsonResources from "./Engine/Resources/JsonResources"; import { _EGameFlow } from "./Game/GameFlowTree/Data/GameFlowConfig"; import GameFlowTree from "./Game/GameFlowTree/GameFlowTree"; import DataManager from "./Game/Data/DataManager"; import { ConstObject, _EGameJsonRes } from "./Game/Data/GameDataType"; import GameEventName from "./Game/Event/GameEventName"; import UnitManager from "./Game/Unit/UnitManager"; import InitLoadView from "./Game/View/InitLoadView/InitLoadView"; import Tool from "./Engine/Tool/Tool"; import SDKManager from "./Game/SDK/SDKManager"; const {ccclass, property} = cc._decorator; /** * 启动类 - 逻辑层 */ @ccclass export default class Helloworld extends cc.Component { start () { Tool.isLog = false; ConstObject.IsEnableTouch = false; cc.assetManager.loadBundle("res/cocos", (err: Error, cocos: cc.AssetManager.Bundle) => { cc.assetManager.loadBundle("res/fgui", (err: Error, fgui: cc.AssetManager.Bundle) => { // 首次加载必要的配置表 let res: Array = [ _EJsonRes.Game, _EJsonRes.View, _EJsonRes.GameFlowTree, _EGameJsonRes.UserData, ]; JsonResources.loadJsonResources(ConstObject.ResPath, res, 0, 0, () => { new Engine((engine: Engine) => { // 获取用户数据 EventManager.onEvent(GameEventName.UserData.UserData_ReadUserData, this, (gameFlow: _EGameFlow) => { // 创建游戏流程树 new GameFlowTree(this.node, JsonResources.getResources(_EJsonRes.GameFlowTree)); // 进入初始加载页 let map: Object = (fgui as any)._config.paths._map; let initLoadView: Array = []; for (let index in map) { if (index.includes(InitLoadView.resPath) == true) { initLoadView.push(index); } } fgui.load(initLoadView, (error: Error, assets: cc.Asset[]) => { EventManager.sendEventByTargetID(GameEventName.Behavior.Behavior_EnterBehavior, ConstObject.GameFlowTreeID, gameFlow); }); }); // 创建全局管理器 engine.managers.push(new UnitManager()); engine.managers.push(new SDKManager()); engine.managers.push(new DataManager()); }); }); }); }); } }