-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
867ced5
commit 5f41e0b
Showing
7 changed files
with
220 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace BM | ||
{ | ||
public static partial class AssetComponent | ||
{ | ||
/// <summary> | ||
/// 计时 | ||
/// </summary> | ||
private static float _timer = 0; | ||
|
||
/// <summary> | ||
/// 下载进度更新器 | ||
/// </summary> | ||
internal static Action<float> DownLoadAction = null; | ||
|
||
/// <summary> | ||
/// 等待计时队列 | ||
/// </summary> | ||
internal static Queue<TimerAwait> TimerAwaitQueue = new Queue<TimerAwait>(); | ||
|
||
/// <summary> | ||
/// 卸载周期计时循环 | ||
/// </summary> | ||
public static void Update() | ||
{ | ||
float nowTime = Time.deltaTime; | ||
int awaitQueueCount = TimerAwaitQueue.Count; | ||
for (int i = 0; i < awaitQueueCount; i++) | ||
{ | ||
TimerAwait timerAwait = TimerAwaitQueue.Dequeue(); | ||
if (!timerAwait.CalcSubTime(nowTime)) | ||
{ | ||
TimerAwaitQueue.Enqueue(timerAwait); | ||
} | ||
} | ||
_timer += nowTime; | ||
if (_timer >= _unLoadCirculateTime) | ||
{ | ||
_timer = 0; | ||
AutoAddToTrueUnLoadPool(); | ||
} | ||
DownLoadAction?.Invoke(nowTime); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.