mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-14 19:40:47 +00:00
Compare commits
12 Commits
2.3.3-prev
...
2.3.4-prev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcc729a0bf | ||
|
|
d10e54248b | ||
|
|
b84800a905 | ||
|
|
8ccd7e552c | ||
|
|
772ba484eb | ||
|
|
cdbedee705 | ||
|
|
10cce48e71 | ||
|
|
13e8410d80 | ||
|
|
6f07faf4da | ||
|
|
e3228d406e | ||
|
|
daf2133535 | ||
|
|
9bcbc10862 |
@@ -2,12 +2,41 @@
|
||||
|
||||
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
|
||||
|
||||
### Improvements
|
||||
|
||||
- 新增了异步操作任务调试器,AssetBundleDebugger窗口-->OperationView视图模式
|
||||
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅增加编辑器下开始游戏时间。
|
||||
- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅降低编辑器下启动游戏的时间。
|
||||
- 单元测试用例增加加密解密测试用例。
|
||||
|
||||
### Fixed
|
||||
|
||||
8
Assets/YooAsset/Editor/Assembly.meta
Normal file
8
Assets/YooAsset/Editor/Assembly.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fab3cd742c11be2479b07f5d447a78c9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
109
Assets/YooAsset/Editor/Assembly/MacrosProcessor.cs
Normal file
109
Assets/YooAsset/Editor/Assembly/MacrosProcessor.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/YooAsset/Editor/Assembly/MacrosProcessor.cs.meta
Normal file
11
Assets/YooAsset/Editor/Assembly/MacrosProcessor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88d5a41d078a82e40b82265ed4c3631a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/YooAsset/Runtime/Assembly.meta
Normal file
8
Assets/YooAsset/Runtime/Assembly.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 569f60ef80f74a642bac91eca0b20a2b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,6 +7,15 @@ namespace YooAsset
|
||||
{
|
||||
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 _autoSample = false;
|
||||
|
||||
|
||||
@@ -8,6 +8,14 @@ namespace YooAsset
|
||||
{
|
||||
internal class RemoteEditorConnection
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
_instance = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
private static RemoteEditorConnection _instance;
|
||||
public static RemoteEditorConnection Instance
|
||||
{
|
||||
|
||||
@@ -8,6 +8,14 @@ namespace YooAsset
|
||||
{
|
||||
internal class RemotePlayerConnection
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
_instance = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
private static RemotePlayerConnection _instance;
|
||||
public static RemotePlayerConnection Instance
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
@@ -9,6 +10,14 @@ namespace YooAsset
|
||||
|
||||
internal class DownloadSystemHelper
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
UnityWebRequestCreater = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
|
||||
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,14 @@ namespace YooAsset
|
||||
{
|
||||
internal class WebRequestCounter
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
_requestFailedRecorder.Clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 记录网络请求失败事件的次数
|
||||
/// </summary>
|
||||
|
||||
@@ -147,15 +147,15 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
|
||||
{
|
||||
AppendFileExtension = (bool)value;
|
||||
AppendFileExtension = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DISABLE_CATALOG_FILE)
|
||||
{
|
||||
DisableCatalogFile = (bool)value;
|
||||
DisableCatalogFile = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST)
|
||||
{
|
||||
CopyBuildinPackageManifest = (bool)value;
|
||||
CopyBuildinPackageManifest = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT)
|
||||
{
|
||||
@@ -239,6 +239,11 @@ namespace YooAsset
|
||||
if (Exists(bundle) == false)
|
||||
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 (DecryptionServices == null)
|
||||
@@ -261,6 +266,7 @@ namespace YooAsset
|
||||
string filePath = GetBuildinFileLoadPath(bundle);
|
||||
return FileUtility.ReadAllBytes(filePath);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public virtual string ReadBundleFileText(PackageBundle bundle)
|
||||
{
|
||||
@@ -270,6 +276,11 @@ namespace YooAsset
|
||||
if (Exists(bundle) == false)
|
||||
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 (DecryptionServices == null)
|
||||
@@ -292,6 +303,7 @@ namespace YooAsset
|
||||
string filePath = GetBuildinFileLoadPath(bundle);
|
||||
return FileUtility.ReadAllText(filePath);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#region 内部方法
|
||||
|
||||
@@ -176,6 +176,12 @@ namespace YooAsset
|
||||
|
||||
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);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
@@ -190,6 +196,7 @@ namespace YooAsset
|
||||
Error = $"Can not found buildin raw bundle file : {filePath}";
|
||||
YooLogger.Error(Error);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
internal override void InternalWaitForAsyncComplete()
|
||||
|
||||
@@ -190,19 +190,19 @@ namespace YooAsset
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
|
||||
{
|
||||
AppendFileExtension = (bool)value;
|
||||
AppendFileExtension = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY)
|
||||
{
|
||||
DownloadMaxConcurrency = (int)value;
|
||||
DownloadMaxConcurrency = Convert.ToInt32(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_REQUEST_PER_FRAME)
|
||||
{
|
||||
DownloadMaxRequestPerFrame = (int)value;
|
||||
DownloadMaxRequestPerFrame = Convert.ToInt32(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_MINMUM_SIZE)
|
||||
{
|
||||
ResumeDownloadMinimumSize = (long)value;
|
||||
ResumeDownloadMinimumSize = Convert.ToInt64(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_RESPONSE_CODES)
|
||||
{
|
||||
|
||||
@@ -94,11 +94,11 @@ namespace YooAsset
|
||||
{
|
||||
if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MIN_FRAME)
|
||||
{
|
||||
_asyncSimulateMinFrame = (int)value;
|
||||
_asyncSimulateMinFrame = Convert.ToInt32(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MAX_FRAME)
|
||||
{
|
||||
_asyncSimulateMaxFrame = (int)value;
|
||||
_asyncSimulateMaxFrame = Convert.ToInt32(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace YooAsset
|
||||
{
|
||||
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
|
||||
{
|
||||
DisableUnityWebCache = (bool)value;
|
||||
DisableUnityWebCache = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.REMOTE_SERVICES)
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace YooAsset
|
||||
{
|
||||
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
|
||||
{
|
||||
DisableUnityWebCache = (bool)value;
|
||||
DisableUnityWebCache = Convert.ToBoolean(value);
|
||||
}
|
||||
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,14 @@ namespace YooAsset
|
||||
{
|
||||
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> _newList = new List<AsyncOperationBase>(1000);
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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.Generic;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
@@ -69,8 +69,8 @@ namespace YooAsset
|
||||
|
||||
private ESteps _steps = ESteps.None;
|
||||
private readonly LoadBundleFileOperation _mainBundleLoader;
|
||||
private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>();
|
||||
private readonly List<HandleBase> _handles = new List<HandleBase>();
|
||||
private readonly List<LoadBundleFileOperation> _bundleLoaders = new List<LoadBundleFileOperation>(10);
|
||||
private readonly HashSet<HandleBase> _handles = new HashSet<HandleBase>();
|
||||
|
||||
|
||||
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
|
||||
@@ -220,20 +220,7 @@ namespace YooAsset
|
||||
// 引用计数增加
|
||||
RefCount++;
|
||||
|
||||
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();
|
||||
|
||||
HandleBase handle = HandleFactory.CreateHandle(this, typeof(T));
|
||||
_handles.Add(handle);
|
||||
return handle as T;
|
||||
}
|
||||
@@ -258,9 +245,9 @@ namespace YooAsset
|
||||
/// </summary>
|
||||
public void ReleaseAllHandles()
|
||||
{
|
||||
for (int i = _handles.Count - 1; i >= 0; i--)
|
||||
List<HandleBase> tempers = _handles.ToList();
|
||||
foreach (var handle in tempers)
|
||||
{
|
||||
var handle = _handles[i];
|
||||
handle.Release();
|
||||
}
|
||||
}
|
||||
@@ -276,7 +263,7 @@ namespace YooAsset
|
||||
|
||||
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
|
||||
// 注意:回调方法如果发生异常,会阻断列表里的后续回调方法!
|
||||
List<HandleBase> tempers = new List<HandleBase>(_handles);
|
||||
List<HandleBase> tempers = _handles.ToList();
|
||||
foreach (var hande in tempers)
|
||||
{
|
||||
if (hande.IsValid)
|
||||
|
||||
@@ -5,6 +5,14 @@ namespace YooAsset
|
||||
{
|
||||
public static class YooAssetSettingsData
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
_setting = null;
|
||||
}
|
||||
#endif
|
||||
|
||||
private static YooAssetSettings _setting = null;
|
||||
internal static YooAssetSettings Setting
|
||||
{
|
||||
|
||||
@@ -9,6 +9,22 @@
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"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
|
||||
}
|
||||
@@ -2,12 +2,23 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
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 GameObject _driver = null;
|
||||
private static readonly List<ResourcePackage> _packages = new List<ResourcePackage>();
|
||||
@@ -77,9 +88,9 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建资源包
|
||||
/// 创建资源包裹
|
||||
/// </summary>
|
||||
/// <param name="packageName">资源包名称</param>
|
||||
/// <param name="packageName">包裹名称</param>
|
||||
public static ResourcePackage CreatePackage(string packageName)
|
||||
{
|
||||
CheckException(packageName);
|
||||
@@ -93,9 +104,9 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源包
|
||||
/// 获取资源包裹
|
||||
/// </summary>
|
||||
/// <param name="packageName">资源包名称</param>
|
||||
/// <param name="packageName">包裹名称</param>
|
||||
public static ResourcePackage GetPackage(string packageName)
|
||||
{
|
||||
CheckException(packageName);
|
||||
@@ -106,9 +117,9 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试获取资源包
|
||||
/// 尝试获取资源包裹
|
||||
/// </summary>
|
||||
/// <param name="packageName">资源包名称</param>
|
||||
/// <param name="packageName">包裹名称</param>
|
||||
public static ResourcePackage TryGetPackage(string packageName)
|
||||
{
|
||||
CheckException(packageName);
|
||||
@@ -116,9 +127,17 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除资源包
|
||||
/// 获取所有资源包裹
|
||||
/// </summary>
|
||||
/// <param name="packageName">资源包名称</param>
|
||||
public static List<ResourcePackage> GetAllPackages()
|
||||
{
|
||||
return _packages.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除资源包裹
|
||||
/// </summary>
|
||||
/// <param name="packageName">包裹名称</param>
|
||||
public static bool RemovePackage(string packageName)
|
||||
{
|
||||
CheckException(packageName);
|
||||
@@ -130,9 +149,9 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除资源包
|
||||
/// 移除资源包裹
|
||||
/// </summary>
|
||||
/// <param name="package">资源包实例对象</param>
|
||||
/// <param name="package">包裹实例对象</param>
|
||||
public static bool RemovePackage(ResourcePackage package)
|
||||
{
|
||||
CheckException(package);
|
||||
@@ -149,9 +168,9 @@ namespace YooAsset
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测资源包是否存在
|
||||
/// 检测资源包裹是否存在
|
||||
/// </summary>
|
||||
/// <param name="packageName">资源包名称</param>
|
||||
/// <param name="packageName">包裹名称</param>
|
||||
public static bool ContainsPackage(string packageName)
|
||||
{
|
||||
CheckException(packageName);
|
||||
|
||||
@@ -5,6 +5,14 @@ namespace YooAsset
|
||||
{
|
||||
internal class YooAssetsDriver : MonoBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void OnRuntimeInitialize()
|
||||
{
|
||||
LastestUpdateFrame = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
private static int LastestUpdateFrame = 0;
|
||||
|
||||
void Update()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.tuyoogame.yooasset",
|
||||
"displayName": "YooAsset",
|
||||
"version": "2.3.3-preview",
|
||||
"version": "2.3.4-preview",
|
||||
"unity": "2019.4",
|
||||
"description": "unity3d resources management system.",
|
||||
"author": {
|
||||
|
||||
Reference in New Issue
Block a user