com.alicizax.unity.framework/Runtime/Timer/ITimerService.cs
2026-04-28 16:29:44 +08:00

40 lines
1.2 KiB
C#

using System;
public static class TimerDebugFlags
{
public const byte Running = 1 << 0;
public const byte Loop = 1 << 1;
public const byte Unscaled = 1 << 2;
}
public struct TimerDebugInfo
{
public ulong TimerHandle;
public float LeftTime;
public float Duration;
public float Age;
public byte Flags;
}
namespace AlicizaX.Timer.Runtime
{
[UnityEngine.Scripting.Preserve]
public interface ITimerService : IService
{
ulong AddTimer(TimerHandlerNoArgs callback, float time, bool isLoop = false, bool isUnscaled = false);
ulong AddTimer<T>(Action<T> callback, T arg, float time, bool isLoop = false, bool isUnscaled = false) where T : class;
void Stop(ulong timerHandle);
void Resume(ulong timerHandle);
bool IsRunning(ulong timerHandle);
float GetLeftTime(ulong timerHandle);
void Restart(ulong timerHandle);
void RemoveTimer(ulong timerHandle);
int GetAllTimers(TimerDebugInfo[] results);
void GetStatistics(out int activeCount, out int poolCapacity, out int peakActiveCount, out int freeCount);
int GetStaleOneShotTimers(TimerDebugInfo[] results);
}
}