update runtime code
重构了OperationSystem的机制。从列表模式修改为链模式
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user