Exemplo n.º 1
0
        /// <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();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 加载资源
 /// </summary>
 /// <param name="recursion"></param>
 public void LoadRes(bool recursion = false)
 {
     // 加载资源
     if (!_resLoaded)
     {
         _resLoaded = true;
         if (_tree.data.Index == SceneTreeIndex.Grass)
         {
             _resCollection.LoadGrass(_idxPrefab);
         }
         else
         {
             _resCollection.LoadRes();
         }
     }
 }