public IABManifestLoader()
        {
            assetManifeset  = null;
            manifesetLoader = null;
            loadState       = 0;

            manifestPath = null;


            //file:///E:/BaiduYunDownload/Assets/Assets/StreamingAssets/AssetBundles/Windows/Windows
            manifestPath = IPathTools.GetAssetBundleFilePath(IPathTools.GetRuntimeFolder());


            if (!IFileTools.IsExistFile(manifestPath))
            {
                isUsingWWW   = true;
                manifestPath = IPathTools.GetAssetBundleWWWStreamPath(IPathTools.GetRuntimeFolder());
            }

            Debuger.Log("manifestPath ===" + manifestPath);

            Debuger.Log("manifestPath 222===" + isUsingWWW.ToString());
            // manifestPath = "C:/Users/yujie/AppData/LocalLow/JFYD/Fish/AssetBundles/Android/Android";
            //  manifestPath =  Application.persistentDataPath + "/AssetBundles/Android/Android";
            //  Debug.Log("manifestPath =111=" + manifestPath);
        }
Esempio n. 2
0
        private void  RecvOneAll(byte[] recvByte, int realLength)
        {
            IFileTools.MemCpy(allRecData, recvByte, curRecLength, realLength);
            curRecLength += realLength;

            RecvOneMsgOver();
        }
Esempio n. 3
0
        private void RecvLarger(byte[] recvByte, int realLength)
        {
            int tmpLength = allDataLengh - curRecLength;

            IFileTools.MemCpy(allRecData, recvByte, curRecLength, tmpLength);
            curRecLength += tmpLength;
            RecvOneMsgOver();

            int remainLenth = realLength - tmpLength;

            byte[] remainByte = new byte[remainLenth];

            //   Debug.Log("recvByte larger =="+ recvByte.Length);

            //Debug.Log("recvByte larger tmpLength ==" + tmpLength);


            //Debug.Log("recvByte larger tmpLength 2222==" + remainLenth);


            //Debug.Log("remainByte  444444==" + remainByte.Length);

            IFileTools.MemCpy(remainByte, 0, recvByte, tmpLength, remainLenth);

            RecevByte(remainByte, remainLenth);
        }
Esempio n. 4
0
        private void RecvHead(byte[] recByte, int reallength)
        {
            // if (curRecLength < headByte.Length) //小于头长度
            //    {
            int tmpReal = headByte.Length - curRecLength;


            int tmpLength = curRecLength + reallength;

            if (tmpLength < headByte.Length)     //比头小
            {
                //  Debug.Log("small  head");
                IFileTools.MemCpy(headByte, recByte, curRecLength, reallength);
                curRecLength += tmpReal;
            }
            else
            {
                //  Debug.Log("big head");

                IFileTools.MemCpy(headByte, recByte, curRecLength, tmpReal);
                curRecLength += tmpReal;



                allDataLengh = IFileTools.ByteToInt(headByte) + headLength;
                allRecData   = new byte[allDataLengh];


                //头考入
                IFileTools.MemCpy(allRecData, 0, headByte, 0, headByte.Length);


                // 剩下的 在放入
                int tmpRemain = reallength - tmpReal;
                if (tmpRemain > 0)
                {
                    byte[] tmpBytes = new byte[tmpRemain];

                    IFileTools.MemCpy(tmpBytes, 0, recByte, tmpReal, tmpRemain);


                    RecevByte(tmpBytes, tmpRemain);
                }
                else
                {
                    RecvOneMsgOver();
                }
            }

            //     }
            //else// 大于等于头长度
            //{
            //    //IFileTools.MemCpy(headByte, recByte, 0, headByte.Length);
            //    //curRecLength += headByte.Length;



            //    //allDataLengh = IFileTools.ByteToInt(headByte) + headLength;

            //    //Debug.Log("Big   allDataLengh =="+ allDataLengh);
            //    //allRecData = new byte[allDataLengh];



            //    ////头考入
            //    //IFileTools.MemCpy(allRecData, 0, headByte, 0, headByte.Length);



            //    //// 剩下的 在放入
            //    //int tmpRemain = reallength -  headByte.Length;
            //    //if (tmpRemain > 0)
            //    //{
            //    //    byte[] tmpBytes = new byte[tmpRemain];
            //    //    IFileTools.MemCpy(tmpBytes, 0, recByte, headByte.Length, tmpRemain);
            //    //    RecevByte(tmpBytes, tmpRemain);
            //    //}



            //}
        }
Esempio n. 5
0
 private void RecvSmall(byte[] recvByte, int realLength)
 {
     IFileTools.MemCpy(allRecData, recvByte, curRecLength, realLength);
     curRecLength += realLength;
 }
Esempio n. 6
0
        /// <summary>
        /// 加载公共资源
        /// </summary>

        /// <summary>
        /// 开始载入,在Unity3d环境中用StartCoroutine()来开始一个资源的载入
        ///
        /// commonResourcesPath ==file:///E:/SVN/3DFish/Project/Fish/Assets/StreamingAssets/AssetBundles/Windows/scenceone/prefeb.ld
        /// </summary>
        /// <returns></returns>
        public IEnumerator CommonLoad()
        {
            commonResourcesDone = 0;



            string bundlePath = IPathTools.GetAssetBundleFilePath(bundleName);

            //  Debuger.Log("bundlePath =="+ bundlePath);
            //判断persistent是否存在
            if (!IFileTools.IsExistFile(bundlePath))
            {
                bundlePath = IPathTools.GetAssetBundleWWWStreamPath(bundleName);

                WWW bundle = WWW.LoadFromCacheOrDownload(bundlePath, FrameTools.VersionId);

                yield return(bundle);



                if (!string.IsNullOrEmpty(bundle.error))
                {
                    Debuger.Log(bundle.error);

                    //  yield break;
                }
                else
                {
                    // Debug.Log("manifestPath =777777=" + bundle.progress);

                    commonResourcesDone = 1.0f;


                    commonRes = new ResIndexers(bundle.assetBundle);

                    //    Debug.Log("commonResourcesPath load finish= 2222=" + tmpRequest.assetBundle);


                    this.loadFinish(bundleName);
                    loadPorgress(bundleName, commonResourcesDone);
                }
            }
            else
            {
                AssetBundleCreateRequest tmpRequest = AssetBundle.LoadFromFileAsync(bundlePath);

                yield return(tmpRequest);



                if (tmpRequest.assetBundle != null)
                {
                    commonResourcesDone = 1.0f;
                    //  Debug.Log("commonResourcesPath load finish= 2222=" + bundleName);



                    commonRes = new ResIndexers(tmpRequest.assetBundle);

                    //    Debug.Log("commonResourcesPath load finish= 2222=" + tmpRequest.assetBundle);


                    this.loadFinish(bundleName);
                    loadPorgress(bundleName, commonResourcesDone);
                }
                else
                {
                    Debuger.LogError(" bundleName is not finish ==" + bundleName);

                    //  yield break;
                }
            }
        }