/// <summary> /// 场景加载完成 /// </summary> static void OnLoadSceneComplete(ResBase res) { if (SceneDesc.current == null) { return; } if (null != _sceneDesc) { Debug.LogErrorFormat("Load scene {0} repeat!", _sceneName); DestroyScene(); } _sceneDesc = SceneDesc.current; ResManager.InitGrass(_sceneDesc.prefabs); if (null != _sceneDesc) { for (int i = 0; i < _sceneDesc.trees.Length; ++i) { var tree = ObjectPool.New <SceneTree>(); tree.Init(_sceneDesc.trees[i]); _trees.Add(tree); } // ResCollection _resCollection = ObjectPool.New <ResCollection>(); _resCollection.Init(_sceneDesc.resCollection); _resCollection.LoadRes(); } }
/// <summary> /// 添加资源 /// </summary> static public void AddRes(ResBase res) { _dictResources.Add(res.url, res); if (res.refCount <= 0) { _unusedResources.Add(res); } }
/// <summary> /// 创建 /// </summary> public static ResRef Create(ResBase res, ResLoadCompleteDelegate onComplete, IResDesc resDesc) { ResRef r = new ResRef(res, onComplete, resDesc); if (null != r._res) { r._res.IncRef(); } return(r); }
private ResRef(ResBase res, ResLoadCompleteDelegate onComplete, IResDesc resDesc) { _res = res; _onComplete = onComplete; _resDesc = resDesc; }