This commit is contained in:
CortexCore
2024-05-31 01:23:15 +08:00
parent c798b224be
commit 299082fe27
164 changed files with 3604 additions and 2018 deletions

View File

@@ -11,8 +11,8 @@ namespace BITKit
public event Action<float> onProgess;
public event Action<string> onSetTotalTime;
public event Action<string> onTime;
float totalTime => (float)list.Count / frameRate;
protected override void OnUpdate()
public float totalTime => (float)list.Count / frameRate;
protected override async void OnUpdate()
{
if (list.Count > 0)
{
@@ -20,6 +20,7 @@ namespace BITKit
if (state is PlayerState.Playing)
index = Math.Clamp(++index, 0, list.Count + 32);
await BITApp.SwitchToMainThread();
if (index > list.Count)
{
if (index - list.Count > frameRate / 2)
@@ -27,6 +28,8 @@ namespace BITKit
}
else
{
if (BITApp.CancellationToken.IsCancellationRequested) return;
output?.Invoke(list[index]);
onProgess?.Invoke(progess);
onTime?.Invoke(GetTime(totalTime * progess));
@@ -63,5 +66,6 @@ namespace BITKit
{
return new DateTime().AddSeconds(sec).ToString(timeFormat);
}
}
}