[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,48 @@
#if VCONTAINER_ECS_INTEGRATION
using System;
using System.Collections.Generic;
using Unity.Entities;
namespace VContainer.Unity
{
public sealed class WorldConfigurationHelper : IDisposable
{
public readonly World World;
public WorldConfigurationHelper(IEnumerable<World> worlds, string targetWorldName)
{
foreach (var world in worlds)
{
if (world.Name == targetWorldName)
{
World = world;
break;
}
}
if (World is null)
throw new VContainerException(typeof(WorldConfigurationHelper), $"World {targetWorldName} is not registered");
}
public void SortSystems()
{
foreach (var system in World.Systems)
{
if (system is ComponentSystemGroup group)
group.SortSystems();
}
}
public void Dispose()
{
foreach (var system in World.Systems)
{
if (system is IDisposable disposableSystem)
{
disposableSystem.Dispose();
}
}
}
}
}
#endif