/// <summary> /// 向对象池中添加一种预设类型 /// </summary> /// <param name="assetBundleName"></param> /// <param name="assetName"></param> /// <param name="prefabInfo"></param> public void PushPrefab(string assetBundleName, string assetName, PoolPrefabInfo prefabInfo = default(PoolPrefabInfo)) { if (HasPrefab(assetName)) { #if UNITY_EDITOR Debug.Log(string.Format("{0} 已经存在", assetName)); #endif return; } if (prefabInfo.Prefab == null) { prefabInfo.Prefab = GameModuleProxy.GetModule <ResourceManager>().LoadAsset <GameObject>(assetBundleName, assetName); if (prefabInfo.Prefab == null) { #if UNITY_EDITOR Debug.LogError("预设资源为null: " + assetName); #endif return; } _prefabs[assetName] = prefabInfo; _spawnPrefabs[assetName] = new List <GameObject>(); Initialization(assetName, prefabInfo); } }
IEnumerator Start() { DontDestroyOnLoad(gameObject); #region Modules StateMG = GameModuleProxy.GetModule <GameStateManager>(); EventMG = GameModuleProxy.GetModule <EventManager>(); ResourceMG = GameModuleProxy.GetModule <ResourceManager>(); HotfixMG = GameModuleProxy.GetModule <HotfixManager>(); WebRequestMG = GameModuleProxy.GetModule <WebRequestManager>(); UIMG = GameModuleProxy.GetModule <UIManager>(); #endregion #region Hotfix //是否使用热更的方式加载代码 HotfixMG.UseHotFix = UseHotFix; #endregion #region Resource ResourceMG.LocalPathType = LocalPathType; ResourceMG.ResUpdateType = ResUpdateType; ResourceMG.ResUpdatePath = ResUpdatePath; //添加对象池管理器 GameObject GameObjectPoolHelper = new GameObject("IGameObjectPoolHelper"); GameObjectPoolHelper.transform.SetParent(transform); ResourceMG.SetGameObjectPoolHelper(GameObjectPoolHelper.AddComponent <GameObjectPoolHelper>()); #endregion #region WebRequest GameObject webRequestHelper = new GameObject("IWebRequestHelper"); webRequestHelper.transform.SetParent(transform); GameObject webDownloadMonoHelper = new GameObject("IWebDownloadHelper"); webDownloadMonoHelper.transform.SetParent(transform); WebRequestMG.SetWebRequestHelper(webRequestHelper.AddComponent <WebRequestMonoHelper>()); WebRequestMG.SetWebDownloadHelper(webDownloadMonoHelper.AddComponent <WebDownloadMonoHelper>()); #endregion #region GameState 初始化状态,开启整个流程 Assembly = typeof(GameMain).Assembly; StateMG.CreateStateContext(Assembly); yield return(new WaitForEndOfFrame()); StateMG.StartFirstState(); #endregion }
public UIManager() { _event = GameModuleProxy.GetModule <EventManager>(); _resource = GameModuleProxy.GetModule <ResourceManager>(); }
public ResourceManager() { _event = GameModuleProxy.GetModule <EventManager>(); _sceneAsyncOperations = new Dictionary <string, AsyncOperation>(); }
public WebRequestManager() { _event = GameModuleProxy.GetModule <EventManager>(); _downloadtasks = new List <UnityWebRequestAsyncOperation>(); }