public IAssetPackage GetAssetPackage(HashName packageName) { IAssetPackage result = null; if (this.cachePackage.TryGetValue(packageName.GetId(), out result)) { return result; } result = this.CreatePackage(packageName); return result; }
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; }
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; } } }
public bool HasPackage(HashName packageName) { return this.cachePackage.ContainsKey(packageName.GetId()); }
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()]); }
public bool IsOuterVersion(HashName assetName) { return this.mOuterVersion != null && (!this.mLocalVersion.ContainsKey(assetName.GetId()) || this.mOuterVersion[assetName.GetId()] != this.mLocalVersion[assetName.GetId()]); }