diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs index aed9c9c..659d734 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs @@ -18,6 +18,13 @@ namespace AxibugEmuOnline.Client GetCacheData(url, TextureCacheDirPath, callback); } + /// ÒƳýÎļþ»º´æ + public void ClearCaches() + { + if (Directory.Exists(CacheDirPath)) + Directory.Delete(CacheDirPath, true); + } + IEnumerator DownloadFromURL(string url, string path, Action callback) { var request = UnityWebRequest.Get($"{AppAxibugEmuOnline.httpAPI.DownSite}/{url}"); @@ -39,6 +46,7 @@ namespace AxibugEmuOnline.Client if (cachesInMemory.TryGetValue(url, out var cacheObj) && cacheObj is T obj) { callback.Invoke(obj, url); + return; } var fileName = $"{url.GetHashCode()}"; diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs index ebc5a6d..6703fad 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs @@ -1,6 +1,8 @@ using AxibugEmuOnline.Client.ClientCore; +using Codice.Client.Common; using System; using System.Collections.Generic; +using System.IO; using static AxibugEmuOnline.Client.HttpAPI; namespace AxibugEmuOnline.Client @@ -36,6 +38,20 @@ namespace AxibugEmuOnline.Client return romFile; } + /// 清除所有下载的Rom文件 + public void ClearRomFile() + { + var path = $"{AppAxibugEmuOnline.PersistentDataPath}/RemoteRoms/{m_platform}"; + if (Directory.Exists(path)) Directory.Delete(path, true); + } + + /// 移除一个已下载的Rom + public void RemoveOneRomFile(RomFile romFile) + { + if (romFile.RomReady) + File.Delete(romFile.LocalFilePath); + } + /// /// 获得所有Rom文件 /// diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs index 808e9bb..051c015 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs @@ -2,8 +2,6 @@ using AxibugEmuOnline.Client.UI; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace AxibugEmuOnline.Client