mirror of https://github.com/tuyoogame/YooAsset
Update YooAssets
parent
9e19f776af
commit
44ac4ebb8f
|
@ -51,6 +51,11 @@ namespace YooAsset
|
||||||
/// 资源加载的最大数量
|
/// 资源加载的最大数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int AssetLoadingMaxNumber = int.MaxValue;
|
public int AssetLoadingMaxNumber = int.MaxValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异步操作系统每帧允许运行的最大时间切片(单位:毫秒)
|
||||||
|
/// </summary>
|
||||||
|
public long OperationSystemMaxTimeSlice = long.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -112,7 +117,7 @@ namespace YooAsset
|
||||||
public static InitializationOperation InitializeAsync(CreateParameters parameters)
|
public static InitializationOperation InitializeAsync(CreateParameters parameters)
|
||||||
{
|
{
|
||||||
if (parameters == null)
|
if (parameters == null)
|
||||||
throw new Exception($"YooAsset create parameters is invalid.");
|
throw new Exception($"YooAsset create parameters is null.");
|
||||||
|
|
||||||
#if !UNITY_EDITOR
|
#if !UNITY_EDITOR
|
||||||
if (parameters is EditorPlayModeParameters)
|
if (parameters is EditorPlayModeParameters)
|
||||||
|
@ -132,22 +137,24 @@ namespace YooAsset
|
||||||
throw new Exception("YooAsset is initialized yet.");
|
throw new Exception("YooAsset is initialized yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测创建参数
|
if (parameters.AssetLoadingMaxNumber < 1)
|
||||||
if (parameters.AssetLoadingMaxNumber < 3)
|
|
||||||
{
|
{
|
||||||
parameters.AssetLoadingMaxNumber = 3;
|
parameters.AssetLoadingMaxNumber = 1;
|
||||||
YooLogger.Warning($"{nameof(parameters.AssetLoadingMaxNumber)} minimum is 3");
|
YooLogger.Warning($"{nameof(parameters.AssetLoadingMaxNumber)} minimum value is 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建间隔计时器
|
if (parameters.OperationSystemMaxTimeSlice < 33)
|
||||||
if (parameters.AutoReleaseInterval > 0)
|
|
||||||
{
|
{
|
||||||
_releaseCD = parameters.AutoReleaseInterval;
|
parameters.OperationSystemMaxTimeSlice = 33;
|
||||||
|
YooLogger.Warning($"{nameof(parameters.OperationSystemMaxTimeSlice)} minimum value is 33 milliseconds");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(parameters.LocationRoot) == false)
|
if (string.IsNullOrEmpty(parameters.LocationRoot) == false)
|
||||||
_locationRoot = PathHelper.GetRegularPath(parameters.LocationRoot);
|
_locationRoot = PathHelper.GetRegularPath(parameters.LocationRoot);
|
||||||
|
|
||||||
|
if (parameters.AutoReleaseInterval > 0)
|
||||||
|
_releaseCD = parameters.AutoReleaseInterval;
|
||||||
|
|
||||||
// 运行模式
|
// 运行模式
|
||||||
if (parameters is EditorPlayModeParameters)
|
if (parameters is EditorPlayModeParameters)
|
||||||
_playMode = EPlayMode.EditorPlayMode;
|
_playMode = EPlayMode.EditorPlayMode;
|
||||||
|
@ -158,7 +165,10 @@ namespace YooAsset
|
||||||
else
|
else
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
||||||
// 初始化
|
// 初始化异步操作系统
|
||||||
|
OperationSystem.Initialize(parameters.OperationSystemMaxTimeSlice);
|
||||||
|
|
||||||
|
// 初始化资源系统
|
||||||
if (_playMode == EPlayMode.EditorPlayMode)
|
if (_playMode == EPlayMode.EditorPlayMode)
|
||||||
{
|
{
|
||||||
_editorPlayModeImpl = new EditorPlayModeImpl();
|
_editorPlayModeImpl = new EditorPlayModeImpl();
|
||||||
|
|
Loading…
Reference in New Issue