コード例 #1
0
 public void _InternalOnly_ChangeStateRequest()
 {
     if (this.wiState != WWWItem.StateWI.UNLOADED)
     {
         if (this.wiState != WWWItem.StateWI.DESTROIED)
         {
             this.retryRequested = false;
             this.wiState        = WWWItem.StateWI.REQUESTED;
             string text;
             if (string.IsNullOrEmpty(this.anotherURL))
             {
                 if (Option.usePatchDir && this.m_protocol == Protocol.HTTP && this.m_kItem != null)
                 {
                     string protocolRootPath = Option.GetProtocolRootPath(this.m_protocol);
                     string format           = string.Empty;
                     if (protocolRootPath[protocolRootPath.Length - 1] == '/')
                     {
                         if (this.assetPath[0] == '/')
                         {
                             format = "{0}{1}{2}";
                         }
                         else
                         {
                             format = "{0}{1}/{2}";
                         }
                     }
                     else if (this.assetPath[0] == '/')
                     {
                         format = "{0}/{1}{2}";
                     }
                     else
                     {
                         format = "{0}/{1}/{2}";
                     }
                     text = string.Format(format, protocolRootPath, this.m_kItem.VersionDir, this.assetPath);
                 }
                 else
                 {
                     text = Option.GetProtocolRootPath(this.m_protocol) + this.assetPath;
                 }
             }
             else
             {
                 text = this.anotherURL;
             }
             if (this.m_protocol == Protocol.HTTP && 0 < this.retryCnt)
             {
                 if (text.Contains("?r="))
                 {
                     text = string.Format("{0}{1}", text, this.retryCnt);
                 }
                 else
                 {
                     text = string.Format("{0}?r={1}{2}", text, (int)(UnityEngine.Random.value * 1000000f), this.retryCnt);
                 }
                 TsLog.Log("[TsBundle] TsBundle:Retry = \"{0}\"", new object[]
                 {
                     text
                 });
             }
             if (Option.EnableTrace)
             {
                 TsLog.Log("[TsBundle] www loading (AssetPath=\"{0}\", Stack=\"{1}\", Type={2}, Size={3:#,###,###,###}, UnloadReserved={4}, RefCount={5} ) {6}", new object[]
                 {
                     this.assetPath,
                     this.stackName,
                     this.itemType,
                     (this.m_kItem != null) ? this.m_kItem.nFileSize : 0,
                     this.DebugUnloadReserved,
                     this.refCnt,
                     (this.m_kItem != null) ? ((!TsCaching.IsVersionCached(text, this.m_kItem.nVersion, this.m_kItem.bUseCustomCache)) ? "<<will download>>" : "<<Cached>>") : "<<not listed>>"
                 });
             }
             if (string.IsNullOrEmpty(this.anotherURL))
             {
                 UsingAssetRecorder.RecordFile(this.assetPath);
             }
             this._ReleaseLoadedAsset();
             if (this.useLoadFromCacheOrDownload)
             {
                 if (!this.inUndefinedStack)
                 {
                     this.m_www = Holder.CancelPreDownload(this.assetPath);
                 }
                 if (this.m_www == null)
                 {
                     this.m_www = TsCaching.LoadFromCacheOrDownload(text, this.m_kItem.nVersion, (long)this.m_kItem.nFileSize, this.m_kItem.bUseCustomCache, this);
                 }
                 if (!this.isCacheHit)
                 {
                     Holder.DbgAddWWWItemStat(this.assetPath, this.m_kItem.nFileSize);
                     if (0 < this.m_kItem.nFileSize && WWWItem.OnIncreaseSizeOfDownload != null)
                     {
                         WWWItem.OnIncreaseSizeOfDownload(this.m_kItem.nFileSize);
                     }
                 }
             }
             else
             {
                 Holder.DbgAddWWWItemStat(this.assetPath, 0);
                 this.m_www = new WWW(text);
             }
             this.retryCnt++;
             return;
         }
     }
     try
     {
         if (Option.EnableTrace)
         {
             TsLog.Log("[TsBundle] cannot request download, already unloaded bundle (AssetPath=\"{0}\", Stack=\"{1}\", Type={2}, SIze={3:#,###,###,###})\n\rCallStack={4}", new object[]
             {
                 this.assetPath,
                 this.stackName,
                 this.itemType,
                 (this.m_kItem != null) ? this.m_kItem.nFileSize : 0,
                 this.RequestCallStack
             });
         }
     }
     catch (Exception arg)
     {
         TsLog.Log("[TsBundle] " + arg, new object[0]);
     }
 }