mirror of https://github.com/tuyoogame/YooAsset
Compare commits
No commits in common. "fcc729a0bfb2371726886610b1ca3b2395aa6497" and "daf2133535e23c86f620eede433ac7fb882baccc" have entirely different histories.
fcc729a0bf
...
daf2133535
|
@ -2,41 +2,12 @@
|
||||||
|
|
||||||
All notable changes to this package will be documented in this file.
|
All notable changes to this package will be documented in this file.
|
||||||
|
|
||||||
## [2.3.4-preview] - 2025-03-08
|
|
||||||
|
|
||||||
### Improvements
|
|
||||||
|
|
||||||
- YooAsset支持了版本宏定义。
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
YOO_ASSET_2
|
|
||||||
YOO_ASSET_2_3
|
|
||||||
YOO_ASSET_2_3_OR_NEWER
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- (#389) 修复了禁用域重载(Reload Domain)的情况下,再次启动游戏报错的问题。
|
|
||||||
- (#496) 修复了文件系统参数RESUME_DOWNLOAD_MINMUM_SIZE传入int值会导致异常的错误。
|
|
||||||
- (#498) 修复了v2.3版本尝试加载安卓包内的原生资源包失败的问题。
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- 新增了YooAssets.GetAllPackages()方法
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
/// <summary>
|
|
||||||
/// 获取所有资源包裹
|
|
||||||
/// </summary>
|
|
||||||
public static List<ResourcePackage> GetAllPackages()
|
|
||||||
```
|
|
||||||
|
|
||||||
## [2.3.3-preview] - 2025-03-06
|
## [2.3.3-preview] - 2025-03-06
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
- 新增了异步操作任务调试器,AssetBundleDebugger窗口-->OperationView视图模式
|
- 新增了异步操作任务调试器,AssetBundleDebugger窗口-->OperationView视图模式
|
||||||
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅降低编辑器下启动游戏的时间。
|
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅增加编辑器下开始游戏时间。
|
||||||
- 单元测试用例增加加密解密测试用例。
|
- 单元测试用例增加加密解密测试用例。
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: fab3cd742c11be2479b07f5d447a78c9
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,109 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
[InitializeOnLoad]
|
|
||||||
public class MacrosProcessor : AssetPostprocessor
|
|
||||||
{
|
|
||||||
static MacrosProcessor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// YooAsset版本宏定义
|
|
||||||
/// </summary>
|
|
||||||
private static readonly List<string> YooAssetMacros = new List<string>()
|
|
||||||
{
|
|
||||||
"YOO_ASSET_2",
|
|
||||||
"YOO_ASSET_2_3",
|
|
||||||
"YOO_ASSET_2_3_OR_NEWER",
|
|
||||||
};
|
|
||||||
|
|
||||||
static string OnGeneratedCSProject(string path, string content)
|
|
||||||
{
|
|
||||||
XmlDocument xmlDoc = new XmlDocument();
|
|
||||||
xmlDoc.LoadXml(content);
|
|
||||||
|
|
||||||
if (IsCSProjectReferenced(xmlDoc.DocumentElement) == false)
|
|
||||||
return content;
|
|
||||||
|
|
||||||
if (ProcessDefineConstants(xmlDoc.DocumentElement) == false)
|
|
||||||
return content;
|
|
||||||
|
|
||||||
// 将修改后的XML结构重新输出为文本
|
|
||||||
var stringWriter = new StringWriter();
|
|
||||||
var writerSettings = new XmlWriterSettings();
|
|
||||||
writerSettings.Indent = true;
|
|
||||||
var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
|
|
||||||
xmlDoc.WriteTo(xmlWriter);
|
|
||||||
xmlWriter.Flush();
|
|
||||||
return stringWriter.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 处理宏定义
|
|
||||||
/// </summary>
|
|
||||||
private static bool ProcessDefineConstants(XmlElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool processed = false;
|
|
||||||
foreach (XmlNode node in element.ChildNodes)
|
|
||||||
{
|
|
||||||
if (node.Name != "PropertyGroup")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
foreach (XmlNode childNode in node.ChildNodes)
|
|
||||||
{
|
|
||||||
if (childNode.Name != "DefineConstants")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string[] defines = childNode.InnerText.Split(';');
|
|
||||||
HashSet<string> hashSets = new HashSet<string>(defines);
|
|
||||||
foreach (string yooMacro in YooAssetMacros)
|
|
||||||
{
|
|
||||||
string tmpMacro = yooMacro.Trim();
|
|
||||||
if (hashSets.Contains(tmpMacro) == false)
|
|
||||||
hashSets.Add(tmpMacro);
|
|
||||||
}
|
|
||||||
childNode.InnerText = string.Join(";", hashSets.ToArray());
|
|
||||||
processed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return processed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 检测工程是否引用了YooAsset
|
|
||||||
/// </summary>
|
|
||||||
private static bool IsCSProjectReferenced(XmlElement element)
|
|
||||||
{
|
|
||||||
if (element == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
foreach (XmlNode node in element.ChildNodes)
|
|
||||||
{
|
|
||||||
if (node.Name != "ItemGroup")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
foreach (XmlNode childNode in node.ChildNodes)
|
|
||||||
{
|
|
||||||
if (childNode.Name != "Reference" && childNode.Name != "ProjectReference")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string include = childNode.Attributes["Include"].Value;
|
|
||||||
if (include.Contains("YooAsset"))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 88d5a41d078a82e40b82265ed4c3631a
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 569f60ef80f74a642bac91eca0b20a2b
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -7,15 +7,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class RemoteDebuggerInRuntime : MonoBehaviour
|
internal class RemoteDebuggerInRuntime : MonoBehaviour
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_sampleOnce = false;
|
|
||||||
_autoSample = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static bool _sampleOnce = false;
|
private static bool _sampleOnce = false;
|
||||||
private static bool _autoSample = false;
|
private static bool _autoSample = false;
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class RemoteEditorConnection
|
internal class RemoteEditorConnection
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static RemoteEditorConnection _instance;
|
private static RemoteEditorConnection _instance;
|
||||||
public static RemoteEditorConnection Instance
|
public static RemoteEditorConnection Instance
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,14 +8,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class RemotePlayerConnection
|
internal class RemotePlayerConnection
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static RemotePlayerConnection _instance;
|
private static RemotePlayerConnection _instance;
|
||||||
public static RemotePlayerConnection Instance
|
public static RemotePlayerConnection Instance
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
@ -10,14 +9,6 @@ namespace YooAsset
|
||||||
|
|
||||||
internal class DownloadSystemHelper
|
internal class DownloadSystemHelper
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
UnityWebRequestCreater = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
|
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
|
||||||
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
|
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,14 +6,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class WebRequestCounter
|
internal class WebRequestCounter
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_requestFailedRecorder.Clear();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 记录网络请求失败事件的次数
|
/// 记录网络请求失败事件的次数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -239,11 +239,6 @@ namespace YooAsset
|
||||||
if (Exists(bundle) == false)
|
if (Exists(bundle) == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
|
||||||
YooLogger.Error($"Android platform not support read buildin bundle file data !");
|
|
||||||
return null;
|
|
||||||
#else
|
|
||||||
if (bundle.Encrypted)
|
if (bundle.Encrypted)
|
||||||
{
|
{
|
||||||
if (DecryptionServices == null)
|
if (DecryptionServices == null)
|
||||||
|
@ -266,7 +261,6 @@ namespace YooAsset
|
||||||
string filePath = GetBuildinFileLoadPath(bundle);
|
string filePath = GetBuildinFileLoadPath(bundle);
|
||||||
return FileUtility.ReadAllBytes(filePath);
|
return FileUtility.ReadAllBytes(filePath);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
public virtual string ReadBundleFileText(PackageBundle bundle)
|
public virtual string ReadBundleFileText(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -276,11 +270,6 @@ namespace YooAsset
|
||||||
if (Exists(bundle) == false)
|
if (Exists(bundle) == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
|
||||||
YooLogger.Error($"Android platform not support read buildin bundle file text !");
|
|
||||||
return null;
|
|
||||||
#else
|
|
||||||
if (bundle.Encrypted)
|
if (bundle.Encrypted)
|
||||||
{
|
{
|
||||||
if (DecryptionServices == null)
|
if (DecryptionServices == null)
|
||||||
|
@ -303,7 +292,6 @@ namespace YooAsset
|
||||||
string filePath = GetBuildinFileLoadPath(bundle);
|
string filePath = GetBuildinFileLoadPath(bundle);
|
||||||
return FileUtility.ReadAllText(filePath);
|
return FileUtility.ReadAllText(filePath);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 内部方法
|
#region 内部方法
|
||||||
|
|
|
@ -176,12 +176,6 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.LoadBuildinRawBundle)
|
if (_steps == ESteps.LoadBuildinRawBundle)
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID
|
|
||||||
//TODO : 安卓平台内置文件属于APK压缩包内的文件。
|
|
||||||
_steps = ESteps.Done;
|
|
||||||
Result = new RawBundleResult(_fileSystem, _bundle);
|
|
||||||
Status = EOperationStatus.Succeed;
|
|
||||||
#else
|
|
||||||
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
|
@ -196,7 +190,6 @@ namespace YooAsset
|
||||||
Error = $"Can not found buildin raw bundle file : {filePath}";
|
Error = $"Can not found buildin raw bundle file : {filePath}";
|
||||||
YooLogger.Error(Error);
|
YooLogger.Error(Error);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal override void InternalWaitForAsyncComplete()
|
internal override void InternalWaitForAsyncComplete()
|
||||||
|
|
|
@ -6,14 +6,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class OperationSystem
|
internal class OperationSystem
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
DestroyAll();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static readonly List<AsyncOperationBase> _operations = new List<AsyncOperationBase>(1000);
|
private static readonly List<AsyncOperationBase> _operations = new List<AsyncOperationBase>(1000);
|
||||||
private static readonly List<AsyncOperationBase> _newList = new List<AsyncOperationBase>(1000);
|
private static readonly List<AsyncOperationBase> _newList = new List<AsyncOperationBase>(1000);
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal static class HandleFactory
|
|
||||||
{
|
|
||||||
private static readonly Dictionary<Type, Func<ProviderOperation, HandleBase>> _handleFactory = new Dictionary<Type, Func<ProviderOperation, HandleBase>>()
|
|
||||||
{
|
|
||||||
{ typeof(AssetHandle), op => new AssetHandle(op) },
|
|
||||||
{ typeof(SceneHandle), op => new SceneHandle(op) },
|
|
||||||
{ typeof(SubAssetsHandle), op => new SubAssetsHandle(op) },
|
|
||||||
{ typeof(AllAssetsHandle), op => new AllAssetsHandle(op) },
|
|
||||||
{ typeof(RawFileHandle), op => new RawFileHandle(op) }
|
|
||||||
};
|
|
||||||
|
|
||||||
public static HandleBase CreateHandle(ProviderOperation operation, Type type)
|
|
||||||
{
|
|
||||||
if (_handleFactory.TryGetValue(type, out var factory) == false)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException($"Handle type {type.FullName} is not supported.");
|
|
||||||
}
|
|
||||||
return factory(operation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 4d6ef91e069948c48b7ca60be4c218ee
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
@ -69,8 +69,8 @@ namespace YooAsset
|
||||||
|
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
private readonly LoadBundleFileOperation _mainBundleLoader;
|
private readonly LoadBundleFileOperation _mainBundleLoader;
|
||||||
private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>(10);
|
private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>();
|
||||||
private readonly HashSet<HandleBase> _handles = new HashSet<HandleBase>();
|
private readonly List<HandleBase> _handles = new List<HandleBase>();
|
||||||
|
|
||||||
|
|
||||||
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
|
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
|
||||||
|
@ -220,7 +220,20 @@ namespace YooAsset
|
||||||
// 引用计数增加
|
// 引用计数增加
|
||||||
RefCount++;
|
RefCount++;
|
||||||
|
|
||||||
HandleBase handle = HandleFactory.CreateHandle(this, typeof(T));
|
HandleBase handle;
|
||||||
|
if (typeof(T) == typeof(AssetHandle))
|
||||||
|
handle = new AssetHandle(this);
|
||||||
|
else if (typeof(T) == typeof(SceneHandle))
|
||||||
|
handle = new SceneHandle(this);
|
||||||
|
else if (typeof(T) == typeof(SubAssetsHandle))
|
||||||
|
handle = new SubAssetsHandle(this);
|
||||||
|
else if (typeof(T) == typeof(AllAssetsHandle))
|
||||||
|
handle = new AllAssetsHandle(this);
|
||||||
|
else if (typeof(T) == typeof(RawFileHandle))
|
||||||
|
handle = new RawFileHandle(this);
|
||||||
|
else
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
|
||||||
_handles.Add(handle);
|
_handles.Add(handle);
|
||||||
return handle as T;
|
return handle as T;
|
||||||
}
|
}
|
||||||
|
@ -245,9 +258,9 @@ namespace YooAsset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ReleaseAllHandles()
|
public void ReleaseAllHandles()
|
||||||
{
|
{
|
||||||
List<HandleBase> tempers = _handles.ToList();
|
for (int i = _handles.Count - 1; i >= 0; i--)
|
||||||
foreach (var handle in tempers)
|
|
||||||
{
|
{
|
||||||
|
var handle = _handles[i];
|
||||||
handle.Release();
|
handle.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,7 +276,7 @@ namespace YooAsset
|
||||||
|
|
||||||
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
|
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
|
||||||
// 注意:回调方法如果发生异常,会阻断列表里的后续回调方法!
|
// 注意:回调方法如果发生异常,会阻断列表里的后续回调方法!
|
||||||
List<HandleBase> tempers = _handles.ToList();
|
List<HandleBase> tempers = new List<HandleBase>(_handles);
|
||||||
foreach (var hande in tempers)
|
foreach (var hande in tempers)
|
||||||
{
|
{
|
||||||
if (hande.IsValid)
|
if (hande.IsValid)
|
||||||
|
|
|
@ -5,14 +5,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
public static class YooAssetSettingsData
|
public static class YooAssetSettingsData
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_setting = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static YooAssetSettings _setting = null;
|
private static YooAssetSettings _setting = null;
|
||||||
internal static YooAssetSettings Setting
|
internal static YooAssetSettings Setting
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,22 +9,6 @@
|
||||||
"precompiledReferences": [],
|
"precompiledReferences": [],
|
||||||
"autoReferenced": true,
|
"autoReferenced": true,
|
||||||
"defineConstraints": [],
|
"defineConstraints": [],
|
||||||
"versionDefines": [
|
"versionDefines": [],
|
||||||
{
|
|
||||||
"name": "com.tuyoogame.yooasset",
|
|
||||||
"expression": "",
|
|
||||||
"define": "YOO_ASSET_2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "com.tuyoogame.yooasset",
|
|
||||||
"expression": "2.3",
|
|
||||||
"define": "YOO_ASSET_2_3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "com.tuyoogame.yooasset",
|
|
||||||
"expression": "2.3",
|
|
||||||
"define": "YOO_ASSET_2_3_OR_NEWER"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"noEngineReferences": false
|
"noEngineReferences": false
|
||||||
}
|
}
|
|
@ -2,23 +2,12 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public static partial class YooAssets
|
public static partial class YooAssets
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
_isInitialize = false;
|
|
||||||
_packages.Clear();
|
|
||||||
_defaultPackage = null;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static bool _isInitialize = false;
|
private static bool _isInitialize = false;
|
||||||
private static GameObject _driver = null;
|
private static GameObject _driver = null;
|
||||||
private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>();
|
private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>();
|
||||||
|
@ -88,9 +77,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建资源包裹
|
/// 创建资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageName">包裹名称</param>
|
/// <param name="packageName">资源包名称</param>
|
||||||
public static ResourcePackage CreatePackage(string packageName)
|
public static ResourcePackage CreatePackage(string packageName)
|
||||||
{
|
{
|
||||||
CheckException(packageName);
|
CheckException(packageName);
|
||||||
|
@ -104,9 +93,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取资源包裹
|
/// 获取资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageName">包裹名称</param>
|
/// <param name="packageName">资源包名称</param>
|
||||||
public static ResourcePackage GetPackage(string packageName)
|
public static ResourcePackage GetPackage(string packageName)
|
||||||
{
|
{
|
||||||
CheckException(packageName);
|
CheckException(packageName);
|
||||||
|
@ -117,9 +106,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试获取资源包裹
|
/// 尝试获取资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageName">包裹名称</param>
|
/// <param name="packageName">资源包名称</param>
|
||||||
public static ResourcePackage TryGetPackage(string packageName)
|
public static ResourcePackage TryGetPackage(string packageName)
|
||||||
{
|
{
|
||||||
CheckException(packageName);
|
CheckException(packageName);
|
||||||
|
@ -127,17 +116,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有资源包裹
|
/// 移除资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<ResourcePackage> GetAllPackages()
|
/// <param name="packageName">资源包名称</param>
|
||||||
{
|
|
||||||
return _packages.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 移除资源包裹
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="packageName">包裹名称</param>
|
|
||||||
public static bool RemovePackage(string packageName)
|
public static bool RemovePackage(string packageName)
|
||||||
{
|
{
|
||||||
CheckException(packageName);
|
CheckException(packageName);
|
||||||
|
@ -149,9 +130,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除资源包裹
|
/// 移除资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="package">包裹实例对象</param>
|
/// <param name="package">资源包实例对象</param>
|
||||||
public static bool RemovePackage(ResourcePackage package)
|
public static bool RemovePackage(ResourcePackage package)
|
||||||
{
|
{
|
||||||
CheckException(package);
|
CheckException(package);
|
||||||
|
@ -168,9 +149,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测资源包裹是否存在
|
/// 检测资源包是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packageName">包裹名称</param>
|
/// <param name="packageName">资源包名称</param>
|
||||||
public static bool ContainsPackage(string packageName)
|
public static bool ContainsPackage(string packageName)
|
||||||
{
|
{
|
||||||
CheckException(packageName);
|
CheckException(packageName);
|
||||||
|
|
|
@ -5,14 +5,6 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
internal class YooAssetsDriver : MonoBehaviour
|
internal class YooAssetsDriver : MonoBehaviour
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
|
||||||
private static void OnRuntimeInitialize()
|
|
||||||
{
|
|
||||||
LastestUpdateFrame = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static int LastestUpdateFrame = 0;
|
private static int LastestUpdateFrame = 0;
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "com.tuyoogame.yooasset",
|
"name": "com.tuyoogame.yooasset",
|
||||||
"displayName": "YooAsset",
|
"displayName": "YooAsset",
|
||||||
"version": "2.3.4-preview",
|
"version": "2.3.3-preview",
|
||||||
"unity": "2019.4",
|
"unity": "2019.4",
|
||||||
"description": "unity3d resources management system.",
|
"description": "unity3d resources management system.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
Loading…
Reference in New Issue