TEngine 6

This commit is contained in:
Alex-Rachel
2025-03-07 23:09:46 +08:00
parent aad8ff3ee5
commit 551727687f
1988 changed files with 46223 additions and 94880 deletions

View File

@@ -43,7 +43,14 @@ namespace YooAsset
/// </summary>
public static void Update()
{
_frameTime = _watch.ElapsedMilliseconds;
// 移除已经完成的异步操作
// 注意:移除上一帧完成的异步操作,方便调试器接收到完整的信息!
for (int i = _operations.Count - 1; i >= 0; i--)
{
var operation = _operations[i];
if (operation.IsFinish)
_operations.RemoveAt(i);
}
// 添加新增的异步操作
if (_newList.Count > 0)
@@ -67,6 +74,7 @@ namespace YooAsset
}
// 更新进行中的异步操作
_frameTime = _watch.ElapsedMilliseconds;
for (int i = 0; i < _operations.Count; i++)
{
if (IsBusy)
@@ -76,19 +84,7 @@ namespace YooAsset
if (operation.IsFinish)
continue;
if (operation.IsDone == false)
operation.InternalOnUpdate();
if (operation.IsDone)
operation.SetFinish();
}
// 移除已经完成的异步操作
for (int i = _operations.Count - 1; i >= 0; i--)
{
var operation = _operations[i];
if (operation.IsFinish)
_operations.RemoveAt(i);
operation.UpdateOperation();
}
}
@@ -114,7 +110,7 @@ namespace YooAsset
{
if (operation.PackageName == packageName)
{
operation.SetAbort();
operation.AbortOperation();
}
}
@@ -123,7 +119,7 @@ namespace YooAsset
{
if (operation.PackageName == packageName)
{
operation.SetAbort();
operation.AbortOperation();
}
}
}
@@ -135,16 +131,41 @@ namespace YooAsset
{
_newList.Add(operation);
operation.SetPackageName(packageName);
operation.SetStart();
operation.StartOperation();
}
/// <summary>
/// 开始处理异步操作类
/// </summary>
public static void StartOperation(AsyncOperationBase operation)
#region
internal static List<DebugOperationInfo> GetDebugOperationInfos(string packageName)
{
_newList.Add(operation);
operation.SetStart();
List<DebugOperationInfo> result = new List<DebugOperationInfo>(_operations.Count);
foreach (var operation in _operations)
{
if (operation.PackageName == packageName)
{
var operationInfo = GetDebugOperationInfo(operation);
result.Add(operationInfo);
}
}
return result;
}
internal static DebugOperationInfo GetDebugOperationInfo(AsyncOperationBase operation)
{
var operationInfo = new DebugOperationInfo();
operationInfo.OperationName = operation.GetType().Name;
operationInfo.OperationDesc = operation.GetOperationDesc();
operationInfo.Priority = operation.Priority;
operationInfo.Progress = operation.Progress;
operationInfo.BeginTime = operation.BeginTime;
operationInfo.ProcessTime = operation.ProcessTime;
operationInfo.Status = operation.Status.ToString();
operationInfo.Childs = new List<DebugOperationInfo>(operation.Childs.Count);
foreach (var child in operation.Childs)
{
var childInfo = GetDebugOperationInfo(child);
operationInfo.Childs.Add(childInfo);
}
return operationInfo;
}
#endregion
}
}