Beispiel #1
0
 public IAssetPackage GetAssetPackage(HashName packageName)
 {
     IAssetPackage result = null;
     if (this.cachePackage.TryGetValue(packageName.GetId(), out result))
     {
         return result;
     }
     result = this.CreatePackage(packageName);
     return result;
 }
Beispiel #2
0
 public static WWW ReadNetFile(string path, bool isCache, ResourceTool.FinishReadNotify notify)
 {
     WWW wWW = null;
     HashName hashName = new HashName(path);
     if (ResourceTool.msCache.TryGetValue(hashName.GetId(), out wWW))
     {
         notify(true, wWW);
         return wWW;
     }
     ResourceTool.DownloadCommand item = default(ResourceTool.DownloadCommand);
     item.resource = new WWW(path);
     item.isCache = isCache;
     item.notify = notify;
     ResourceTool.msDownloadCommands.Add(item);
     return item.resource;
 }
Beispiel #3
0
        public static void Tick()
        {
            foreach (ResourceTool.DownloadCommand current in ResourceTool.msDownloadCommands)
            {
                if (current.resource.isDone)
                {
                    Debug.Log(current.resource.url + "resource finished =" + current.resource.error);
                    ResourceTool.msDownloadCommands.Remove(current);
                    if (current.resource.error == null)
                    {
                        HashName hashName = new HashName(current.resource.url);
                        if (current.isCache && !ResourceTool.msCache.ContainsKey(hashName.GetId()))
                        {
                            ResourceTool.msCache.Add(hashName.GetId(), current.resource);
                        }
                        Debug.Log(string.Concat(new object[]
						{
							"finish read ",
							current.resource.url,
							" ",
							Time.time
						}));
                        current.notify(true, current.resource);
                    }
                    else
                    {
                        Debug.LogWarning(current.resource.error);
                        current.notify(false, current.resource);
                    }
                    break;
                }
            }
        }
Beispiel #4
0
 public bool HasPackage(HashName packageName)
 {
     return this.cachePackage.ContainsKey(packageName.GetId());
 }
Beispiel #5
0
 public void SynchroVersion(HashName assetName)
 {
     if (this.mLocalVersion.ContainsKey(assetName.GetId()))
     {
         this.mLocalVersion[assetName.GetId()] = this.mOuterVersion[assetName.GetId()];
         return;
     }
     this.mLocalVersion.Add(assetName.GetId(), this.mOuterVersion[assetName.GetId()]);
 }
Beispiel #6
0
 public bool IsOuterVersion(HashName assetName)
 {
     return this.mOuterVersion != null && (!this.mLocalVersion.ContainsKey(assetName.GetId()) || this.mOuterVersion[assetName.GetId()] != this.mLocalVersion[assetName.GetId()]);
 }