Beispiel #1
0
    public void PreloadSyncAndAsyncAssets(uint sceneId, ref PreloadResult preloadResult)
    {
        preloadSyncAndAsyncAssetsResult = preloadResult;
        IResBinData iResBinData = GameKernel.GetDataCenter().GetResBinData();

        //预加载场景资源
    }
Beispiel #2
0
    public void LoadScene(uint fromSceneId, uint sceneId, bool showLoading = true, uint taskPreloadSceneId = 0, string loadingTips = "")
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        //Network.NetChnlDebug.Instance.Debug();
        // Network.NetChnlDebug.Instance.Clear();
#endif
        //Messenger.Broadcast<uint>(MSG_DEFINE.MSG_SCENE_LOAD_START, sceneId);
        if (mIsLoading == true)
        {
            StopCurrent();
        }

        mIsLoading = true;
        mSceneId   = sceneId;
        mTaskNeedPreloadSceneId = taskPreloadSceneId;

        //如果有需要,可以加载场景相关配置(TO DO)
        mSceneConfig      = GameKernel.GetDataCenter().GetResBinData().GetSceneConfByID(sceneId);
        mCurrentSceneName = mSceneConfig.name;

        if (mSceneConfig != null)
        {
            mCurrentScene = mSceneConfig.sceneName;
        }

        ConnectProcess(showLoading, loadingTips);
        StartProcess();    //数据齐全 开始进程
    }
Beispiel #3
0
    private void Init()
    {
        DirtyConfArray dirtyArray = GameKernel.GetDataCenter().GetResBinData().GetDirtyConfigArray();

        for (int i = 0; i < dirtyArray.items.Count; ++i)
        {
            if (dirtyArray.items[i].DirtyWord != string.Empty)
            {
                this.AddKey(dirtyArray.items[i].DirtyWord);
            }
        }
    }
Beispiel #4
0
    //预加载普通资源
    public void PreloadAsyncAssets(uint sceneId, ref PreloadResult preloadResult)
    {
        //初始化系统
        preloadAsyncAssetsResult = preloadResult;

        IResBinData iResBinData = GameKernel.GetDataCenter().GetResBinData();

        //预加载及预热资源
        List <string> preLoadObjList          = null;
        List <string> PreloadAndPrehotObjList = null;

        if (preLoadObjList != null && preLoadObjList.Count > 0)
        {
            preloadAsyncAssetsResult.TotalCount += preLoadObjList.Count;
        }
        if (PreloadAndPrehotObjList != null && PreloadAndPrehotObjList.Count > 0)
        {
            preloadAsyncAssetsResult.TotalCount += PreloadAndPrehotObjList.Count;
        }

        if (preloadAsyncAssetsResult.TotalCount > 0)
        {
            IResourceMgr resMgr = GameKernel.Get <IResourceMgr>();

            /*if (preLoadObjList != null)
             * {
             *  foreach (string item in preLoadObjList)
             *  {
             *      AssetBundleParams abp =
             *          AssetBundleParamFactory.Create(item);
             *      resMgr.LoadSceneResidentMemoryObjAsync(abp, preloadObjCallBack);
             *  }
             * }
             * if (PreloadAndPrehotObjList != null)
             * {
             *  foreach (string item in PreloadAndPrehotObjList)
             *  {
             *      AssetBundleParams abp = AssetBundleParamFactory.Create(item);
             *      abp.IsPreloadMainAsset = true;
             *
             *      ResLogger.Log("Prelaod " + abp.path + " " + abp.type);
             *
             *      resMgr.LoadSceneResidentMemoryObjAsync(abp, preloadObjCallBack);
             *  }
             * }
             *
             * for (int i = 0; i < diffPreloads.Count; i++)
             * {
             *  if (!string.IsNullOrEmpty(diffPreloads[i]))
             *  {
             *      AssetBundleParams abp = AssetBundleParamFactory.Create(diffPreloads[i]);
             *      abp.IsPreloadMainAsset = true;
             *
             *      ResLogger.Log("Diff Prelaod " + abp.path + " " + abp.type);
             *
             *      resMgr.LoadResidentMemoryObjAsync(abp, preloadObjCallBack);
             *  }
             * }*/
        }
        else
        {
            preloadAsyncAssetsResult = null;
        }
    }