Example #1
0
 public void LoadResource(Action <IResourceNode> callback, Action <HttpResp.ErrorType, string> failCallback = null)
 {
     HttpService.GetDownloadURL(fileName.ToLower(), crc, downloadUrl =>
     {
         if (resType.Equals(ResType.AssetBundle))
         {
             HttpService.GetRemoteAB(downloadUrl, (ab) =>
             {
                 res    = ab;
                 loaded = true;
                 callback(this);
             }, (eType, eInfo) => {
                 if (failCallback != null)
                 {
                     failCallback(HttpResp.ErrorType.LogicError, "file read error");
                 }
             });
         }
         else
         {
             HttpService.GetRemoteRaw(downloadUrl, filebins =>
             {
                 res         = filebins;
                 this.loaded = true;
                 callback(this);
             }, (resp) =>
             {
                 if (failCallback != null)
                 {
                     failCallback(HttpResp.ErrorType.LogicError, "file read error");
                 }
             });
         }
     }, (errorType, errorInfo) =>
     {
         if (failCallback != null)
         {
             failCallback(HttpResp.ErrorType.LogicError, errorInfo);
         }
     });
 }