update runtime code

重构了OperationSystem的机制。从列表模式修改为链模式
This commit is contained in:
何冠峰
2025-02-25 12:18:16 +08:00
parent 400c2ccefe
commit c758aa81ff
72 changed files with 385 additions and 260 deletions
@@ -43,8 +43,6 @@ namespace YooAsset
/// </summary>
public static void Update()
{
_frameTime = _watch.ElapsedMilliseconds;
// 添加新增的异步操作
if (_newList.Count > 0)
{
@@ -67,6 +65,7 @@ namespace YooAsset
}
// 更新进行中的异步操作
_frameTime = _watch.ElapsedMilliseconds;
for (int i = 0; i < _operations.Count; i++)
{
if (IsBusy)
@@ -76,11 +75,7 @@ namespace YooAsset
if (operation.IsFinish)
continue;
if (operation.IsDone == false)
operation.InternalUpdate();
if (operation.IsDone)
operation.SetFinish();
operation.UpdateOperation();
}
// 移除已经完成的异步操作
@@ -114,7 +109,7 @@ namespace YooAsset
{
if (operation.PackageName == packageName)
{
operation.SetAbort();
operation.AbortOperation();
}
}
@@ -123,7 +118,7 @@ namespace YooAsset
{
if (operation.PackageName == packageName)
{
operation.SetAbort();
operation.AbortOperation();
}
}
}
@@ -135,7 +130,7 @@ namespace YooAsset
{
_newList.Add(operation);
operation.SetPackageName(packageName);
operation.SetStart();
operation.StartOperation();
}
}
}