/// 注意单例类的构造函数必须是private的,这样才能确保类只有一个对象,不让外部类实例化该类 private GameMainProgram() { // 构造 resourcesMgr = new ResourcesMgr(this); fileMgr = new FileMgr(this); dataBaseMgr = new DataBaseMgr(this); gameDataMgr = new GameDataMgr(this); languageMgr = new LanguageMgr(this); playerMgr = new PlayerMgr(this); enemyMgr = new EnemyMgr(this); uiManager = new UIManager(this); uiMaskMgr = new UIMaskMgr(this); eventMgr = new EventMgr(this); courseMgr = new CourseMgr(this); }
//初始化核心数据,加载“UI窗体路径”到集合中。 public override void Initialize() { uiMaskMgr = gameMain.uiMaskMgr; //初始化加载(根UI窗体)Canvas预设 InitRootCanvasLoading(); //得到UI根节点、全屏节点、固定节点、弹出节点 if (CanvasGO != null) { _TraCanvasTransfrom = CanvasGO.transform; } else { _TraCanvasTransfrom = GameObject.FindGameObjectWithTag(Common.SYS_TAG_CANVAS).transform; Debug.LogError("加载Canvas失败"); } _TraNormal = UnityHelper.FindTheChildNode(_TraCanvasTransfrom.gameObject, Common.SYS_NORMAL_NODE); _TraFixed = UnityHelper.FindTheChildNode(_TraCanvasTransfrom.gameObject, Common.SYS_FIXED_NODE); _TraPopUp = UnityHelper.FindTheChildNode(_TraCanvasTransfrom.gameObject, Common.SYS_POPUP_NODE); UICamera = UnityHelper.FindTheChildNode(_TraCanvasTransfrom.gameObject, "UICamera").GetComponent <Camera>(); }
/// 注意单例类的构造函数必须是private的,这样才能确保类只有一个对象,不让外部类实例化该类 private GameMainProgram() { // 构造 resourcesMgr = new ResourcesMgr(this); fileMgr = new FileMgr(this); dataBaseMgr = new DataBaseMgr(this); gameDataMgr = new GameDataMgr(this); languageMgr = new LanguageMgr(this); playerMgr = new PlayerMgr(this); enemyMgr = new EnemyMgr(this); npcMgr = new NpcMgr(this); uiManager = new UIManager(this); uiMaskMgr = new UIMaskMgr(this); eventMgr = new EventMgr(this); courseMgr = new CourseMgr(this); audioMgr = new AudioMgr(this); dialogMgr = new DialogMgr(this); sqlMgr = new SqlMgr(this); threadMgr = new ThreadMgr(this); }