Added debugging information

新增调试信息,出生场景和出生时间。
This commit is contained in:
hevinci
2022-04-22 16:22:09 +08:00
parent 7683746032
commit e6422445a6
7 changed files with 134 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
namespace YooAsset
@@ -202,7 +203,7 @@ namespace YooAsset
{
get
{
if(_taskCompletionSource == null)
if (_taskCompletionSource == null)
{
_taskCompletionSource = new TaskCompletionSource<object>();
if (IsDone)
@@ -226,9 +227,35 @@ namespace YooAsset
}
}
if(_taskCompletionSource != null)
if (_taskCompletionSource != null)
_taskCompletionSource.TrySetResult(null);
}
#endregion
#region
/// <summary>
/// 出生的场景
/// </summary>
public string SpawnScene = string.Empty;
/// <summary>
/// 出生的时间
/// </summary>
public string SpawnTime = string.Empty;
[Conditional("DEBUG")]
public void SetSpawnDebugInfo(string spawnScene)
{
SpawnScene = spawnScene;
SpawnTime = SpawnTimeToString(UnityEngine.Time.realtimeSinceStartup);
}
private string SpawnTimeToString(float spawnTime)
{
float h = UnityEngine.Mathf.FloorToInt(spawnTime / 3600f);
float m = UnityEngine.Mathf.FloorToInt(spawnTime / 60f - h * 60f);
float s = UnityEngine.Mathf.FloorToInt(spawnTime - m * 60f - h * 3600f);
return h.ToString("00") + ":" + m.ToString("00") + ":" + s.ToString("00");
}
#endregion
}
}