public void DestroyManager() { HTTPManager.OnQuit(); CloseAllSocket(); Instance = null; }
void Awake() { if (Instance == null) { Instance = this; gameObject.name = "HFGlobal"; DontDestroyOnLoad(gameObject); Clear(); //添加游戏工厂 gameObject.AddComponent <GameFactory>(); //负责提供路径 gameObject.AddComponent <PathManager>(); //资源加载 resourcesManager = GameFactory.Create <HFResourceManager>("ResourcesManager", true); resourcesManager.InitWithRootPath(PathManager.Instance.PersistentDataAssetBundlesPath, PathManager.Instance.StreamingAssetsAssetBundlesPath, "AssetBundles"); //添加游戏运行环境 + 配置文件 gameObject.AddComponent <GameEnvironment>(); //2通知中心 notificationCenter = GameFactory.Create <NotificationCenter>("NotificationCenter", true); //3网络 socketManager = GameFactory.Create <HFSocketManager>("SocketManager", true); //4声音 audioManager = GameFactory.Create <AudioManager>("AudioManager", true); //5UI uiManager = GameFactory.Create <UIManager>("UIManager", true); //6图片下载 webImageManager = GameFactory.Create <WebImageManager>("WebImageManager", true); //7游戏设置控制器 inputManager = GameFactory.Create <InputManager>("InputManager", true); //8对象池 poolManager = GameFactory.Create <ObjectPoolManager>("ObjectPoolManager", true); //9热更新入口 appDomainManager = GameFactory.Create <AppDomainManager>("AppDomainManager", true); //添加游戏循环者 gameObject.AddComponent <GameLooper>(); //添加时间控制者 gameObject.AddComponent <GameTimer>(); //添加状态检查者 gameObject.AddComponent <GameStateChecker>(); //工具箱 gameObject.AddComponent <GameUtils>(); //添加状态检查者 gameObject.AddComponent <GameFlowController>(); //游戏开始 gameObject.AddComponent <GameStart>(); } else { Destroy(gameObject); } }
public void Awake() { Instance = this; }