Update YooAssets

pull/4/head
hevinci 2022-03-07 14:37:50 +08:00
parent 3d1c4fdc87
commit 51aeb8b563
1 changed files with 28 additions and 58 deletions

View File

@ -122,8 +122,8 @@ namespace YooAsset
if (_isInitialize == false) if (_isInitialize == false)
{ {
_isInitialize = true; _isInitialize = true;
UnityEngine.GameObject driver = new UnityEngine.GameObject("[YooAsset]"); UnityEngine.GameObject driverGo = new UnityEngine.GameObject("[YooAsset]");
var driverGo = driver.AddComponent<YooAssetDriver>().gameObject; driverGo.AddComponent<YooAssetDriver>();
UnityEngine.Object.DontDestroyOnLoad(driverGo); UnityEngine.Object.DontDestroyOnLoad(driverGo);
} }
else else
@ -222,33 +222,6 @@ namespace YooAsset
} }
/// <summary>
/// 更新资源系统
/// </summary>
internal static void InternalUpdate()
{
// 更新异步请求操作
OperationUpdater.Update();
// 更新下载管理系统
DownloadSystem.Update();
// 轮询更新资源系统
AssetSystem.Update();
// 自动释放零引用资源
if (_releaseCD > 0)
{
_releaseTimer += UnityEngine.Time.unscaledDeltaTime;
if (_releaseTimer >= _releaseCD)
{
_releaseTimer = 0f;
AssetSystem.UnloadUnusedAssets();
}
}
}
/// <summary> /// <summary>
/// 获取资源版本号 /// 获取资源版本号
/// </summary> /// </summary>
@ -278,35 +251,6 @@ namespace YooAsset
} }
} }
/// <summary>
/// 获取内置资源标记列表
/// </summary>
public static string[] GetManifestBuildinTags()
{
if (_playMode == EPlayMode.EditorPlayMode)
{
if (_editorPlayModeImpl == null)
throw new Exception("YooAsset is not initialized.");
return _editorPlayModeImpl.GetManifestBuildinTags();
}
else if (_playMode == EPlayMode.OfflinePlayMode)
{
if (_offlinePlayModeImpl == null)
throw new Exception("YooAsset is not initialized.");
return _offlinePlayModeImpl.GetManifestBuildinTags();
}
else if (_playMode == EPlayMode.HostPlayMode)
{
if (_hostPlayModeImpl == null)
throw new Exception("YooAsset is not initialized.");
return _hostPlayModeImpl.GetManifestBuildinTags();
}
else
{
throw new NotImplementedException();
}
}
/// <summary> /// <summary>
/// 获取资源包信息 /// 获取资源包信息
/// </summary> /// </summary>
@ -532,6 +476,32 @@ namespace YooAsset
#endregion #endregion
#region 内部方法 #region 内部方法
/// <summary>
/// 更新资源系统
/// </summary>
internal static void InternalUpdate()
{
// 更新异步请求操作
OperationUpdater.Update();
// 更新下载管理系统
DownloadSystem.Update();
// 轮询更新资源系统
AssetSystem.Update();
// 自动释放零引用资源
if (_releaseCD > 0)
{
_releaseTimer += UnityEngine.Time.unscaledDeltaTime;
if (_releaseTimer >= _releaseCD)
{
_releaseTimer = 0f;
AssetSystem.UnloadUnusedAssets();
}
}
}
/// <summary> /// <summary>
/// 定位地址转换为资源路径 /// 定位地址转换为资源路径
/// </summary> /// </summary>