示例#1
0
 public virtual void DownLoad(string url)
 {
     if (this.LoadState == BundleLoadState.Prepared)
     {
         this.LoadState = BundleLoadState.Running;
     }
 }
示例#2
0
        void LoadNext()
        {
            if (requestList.Count < 1)
            {
                state       = BundleLoadState.Success;
                totalLength = 0;
                loadIndex   = 0;
                return;
            }
            BundleLoadInfo info = requestList[0];

            loadIndex++;
            state = BundleLoadState.InProgress;
            if (ZBundleManager.Instance.HasBundle(info.path))
            {
                if (info.completeFun != null)
                {
                    info.completeFun.Invoke(info.path, true);
                }
                RemoveLoadInfo(info.path);
                LoadNext();
            }
            else
            {
                if (info.IsWeb)
                {
                    StartCoroutine(LoadRemoteInspector(info));
                }
                else
                {
                    StartCoroutine(LoadLocalInspector(info));
                }
            }
        }
示例#3
0
 public void LoadBundles(BundleInfo[] list)
 {
     if (state == BundleLoadState.InProgress || list == null)
     {
         return;
     }
     ZLog.Log("LoadBundles ..................num = " + list.Length);
     state     = BundleLoadState.Failure;
     loadIndex = 0;
     requestList.Clear();
     for (int i = 0; i < list.Length; i++)
     {
         BundleInfo model = list[i];
         if (!HasLoadInfo(model.path))
         {
             BundleLoadInfo info = new BundleLoadInfo(model.path, model.type)
             {
                 id      = model.id,
                 downURL = model.url
             };
             requestList.Add(info);
         }
     }
     totalLength = requestList.Count;
     LoadNext();
 }
示例#4
0
 public virtual void Resume()
 {
     if (this.LoadState != BundleLoadState.Error && this.LoadState != BundleLoadState.Stopped &&
         this.LoadState != BundleLoadState.Finished)
     {
         this.LoadState = BundleLoadState.Running;
     }
 }
示例#5
0
 public virtual void Stop()
 {
     if (this.LoadState != BundleLoadState.Finished && this.LoadState != BundleLoadState.Error &&
         this.LoadState != BundleLoadState.Stopped)
     {
         this.LoadState = BundleLoadState.Stopped;
     }
 }
示例#6
0
 public virtual void Load(string name)
 {
     this.LoadResPath = name;
     if (this.LoadState == BundleLoadState.Prepared)
     {
         this.LoadState = BundleLoadState.Running;
     }
 }
 public void CopyData(BundleImportData data)
 {
     RootPath      = data.RootPath;
     FileNameMatch = data.FileNameMatch;
     Index         = data.Index;
     Type          = data.Type;
     LoadState     = data.LoadState;
     Publish       = data.Publish;
     LimitCount    = data.LimitCount;
     LimitKBSize   = data.LimitKBSize;
     PushDependice = data.PushDependice;
 }
示例#8
0
        protected BundlePkgInfo _SeekPkgInfo(string name)
        {
            BundlePkgInfo pkginfo = ResBundleMgr.mIns.BundleInformation.SeekInfo(name);

            if (pkginfo == null)
            {
                this.LoadState = BundleLoadState.Error;
                throw new FrameWorkException(string.Format("Not Found {0}", name), ExceptionType.Higher_Excetpion);
            }

            return(pkginfo);
        }
示例#9
0
 public virtual void RemoveToPool()
 {
     this._BundleMainObject  = null;
     this._BundleRef         = null;
     this.loadingpkg         = null;
     this.LoadResPath        = null;
     this.LoadState          = BundleLoadState.Prepared;
     this.onComplete         = null;
     this.LoaderInsObject    = null;
     this.PreParedGameObject = null;
     this._AsyncOpation      = null;
 }
示例#10
0
        protected IBundleRef LoadFullAssetToMem(BundlePkgInfo pkginfo)
        {
            IBundleRef bundle = null;

            if (ResBundleMgr.mIns.Cache.Contains(pkginfo))
            {
                bundle = ResBundleMgr.mIns.Cache.TryGetValue(pkginfo);
                return(bundle);
            }

#if UNITY_IOS || UNITY_IPHONE || UNITY_ANDROID
            if (GameApplication.isPlaying && MainLoop.getInstance().OpenABMode)
            {
                AssetBundle ab = null;
                using (gstring.Block())
                {
                    ab = this.LoadAssetBundle(BundlePathConvert.GetRunningPath(pkginfo.AbFileName));
                }

                if (ab == null)
                {
                    this.ThrowAssetMissing(this.LoadResPath);
                }

                bundle = ResBundleMgr.mIns.Cache.PushAsset(pkginfo, ab);
                return(bundle);
            }
            else
#endif
            {
                UnityEngine.Object target = AssetDatabaseLoad(pkginfo.EditorPath);
                if (target == null)
                {
                    if (BundleConfig.SAFE_MODE)
                    {
                        this.ThrowAssetMissing(pkginfo.BundleName);
                    }
                    else
                    {
                        this.LoadState = BundleLoadState.Error;
                        LogMgr.LogErrorFormat("Asset {0} Missing", pkginfo.BundleName);
                    }
                }
                else
                {
#if UNITY_EDITOR
                    bundle = ResBundleMgr.mIns.Cache.PushEditorAsset(pkginfo, target);
#endif
                }
                return(bundle);
            }
        }
示例#11
0
 protected void ThrowAssetMissing(string resname)
 {
     ResBundleMgr.mIns.Cache.RemoveLoading(resname);
     ResBundleMgr.mIns.Cache.RemoveLoading(this.LoadResPath);
     if (BundleConfig.SAFE_MODE)
     {
         throw new FrameWorkResMissingException(string.Format("Asset =》{0} Missing", resname));
     }
     else
     {
         this.LoadState = BundleLoadState.Error;
         LogMgr.LogErrorFormat("Asset =》{0} Missing", resname);
     }
 }
示例#12
0
        public static bool CreateNewBundle(string name, string parent, BundleType type, BundleLoadState loadState)
        {
            if (m_dataDict.ContainsKey(name))
            {
                return(false);
            }

            BundleData newBundle = new BundleData();

            newBundle.name      = name;
            newBundle.type      = type;
            newBundle.loadState = loadState;

            if (!string.IsNullOrEmpty(parent))
            {
                if (m_dataDict.ContainsKey(parent))
                {
                    return(false);
                }
                else
                {
                    m_dataDict[parent].children.Add(name);
                }

                newBundle.parent = parent;
            }

            m_dataDict.Add(name, newBundle);
            BMDataAccessor.Datas.Add(newBundle);

            BundleState newState = new BundleState();

            newState.bundleID = name;
            newState.version  = 1;
            m_stateDict.Add(name, newState);
            BMDataAccessor.States.Add(newState);

            return(true);
        }
示例#13
0
 protected void ThrowLogicError(string info = null)
 {
     ResBundleMgr.mIns.Cache.RemoveLoading(this.LoadResPath);
     this.LoadState = BundleLoadState.Error;
     throw new FrameWorkException(string.Format("{0} 逻辑异常", info), ExceptionType.Higher_Excetpion);
 }