[Add] VContainer

This commit is contained in:
2026-04-07 04:51:37 +07:00
parent 76562726ec
commit 4f9b878775
193 changed files with 8036 additions and 0 deletions
@@ -0,0 +1,43 @@
using VContainer.Internal;
namespace VContainer.Unity
{
interface IPlayerLoopItem
{
bool MoveNext();
}
sealed class PlayerLoopRunner
{
readonly FreeList<IPlayerLoopItem> runners = new FreeList<IPlayerLoopItem>(16);
int running;
public void Dispatch(IPlayerLoopItem item)
{
runners.Add(item);
}
public void Run()
{
var span =
#if NETSTANDARD2_1
runners.AsSpan();
#else
runners;
#endif
for (var i = 0; i < span.Length; i++)
{
var item = span[i];
if (item != null)
{
var continued = item.MoveNext();
if (!continued)
{
runners.RemoveAt(i);
}
}
}
}
}
}