2026-04-22 11:13:16 +08:00
|
|
|
namespace LoveLegend
|
2026-04-22 09:52:55 +08:00
|
|
|
{
|
|
|
|
|
public class AsyncDealData
|
|
|
|
|
{
|
|
|
|
|
public delegate void DealMethod();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private float _currentTime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float DelayTime = 1f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DealMethod dealMethod;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int RepeatCount = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsComplete => RepeatCount == 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void PassTime(float time)
|
|
|
|
|
{
|
|
|
|
|
_currentTime += time;
|
|
|
|
|
if (!(_currentTime >= DelayTime))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_currentTime -= DelayTime;
|
|
|
|
|
Run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Run()
|
|
|
|
|
{
|
|
|
|
|
if (RepeatCount == -1)
|
|
|
|
|
{
|
|
|
|
|
dealMethod?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (RepeatCount > 0)
|
|
|
|
|
{
|
|
|
|
|
dealMethod?.Invoke();
|
|
|
|
|
RepeatCount--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|