Esempio n. 1
0
    //场景资源预加载
    public void PreloadSceneAsset(string sceneName, ref PreloadResult preloadResult)
    {
        this.preloadSceneResult = preloadResult;

        //获取预加载的场景数据(现在木有,先不处理)
        List <string> preLoadGOList = null;

        if (preLoadGOList != null && preLoadGOList.Count > 0)
        {
            this.preloadSceneResult.TotalCount += preLoadGOList.Count;
        }

        if (this.preloadSceneResult.TotalCount > 0)
        {
            //资源加载并生成相应预设
            if (preLoadGOList != null)
            {
                IResourceMgr resMgr = GameKernel.Get <IResourceMgr>();
                foreach (string item in preLoadGOList)
                {
                    AssetBundleParams abp = new AssetBundleParams(item, typeof(GameObject));
                    resMgr.LoadNormalObjAsync(abp);
                }
            }
        }
        else
        {
            this.preloadSceneResult = null;
        }
    }