Merge branch 'dev'

This commit is contained in:
Mikhail 2024-03-28 20:33:50 +08:00
commit cbfe7930b3
2 changed files with 77 additions and 1 deletions

View File

@ -731,6 +731,14 @@ namespace DCFApixels.DragonECS
#endregion
}
public static class EcsWorldExtenssions
{
public static bool IsNullOrDetroyed(this EcsWorld self)
{
return self == null || self.IsDestroyed;
}
}
#region Callbacks Interface
public interface IEcsWorldEventListener
{

View File

@ -105,49 +105,72 @@ namespace DCFApixels.DragonECS
#endregion
#region TryGetters
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetID(out int id)
{
id = this.id;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetWorld(out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryGetWorldID(out short worldID)
{
worldID = world;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unpack(out int id, out EcsWorld world)
{
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
world = EcsWorld.GetWorld(this.world);
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unpack(out int id, out short gen, out EcsWorld world)
{
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
world = EcsWorld.GetWorld(this.world);
gen = this.gen;
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unpack(out int id, out short worldID)
{
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
worldID = world;
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unpack(out int id, out short gen, out short worldID)
{
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (!IsAlive) { Throw.Ent_ThrowIsNotAlive(this); }
#endif
worldID = world;
gen = this.gen;
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnpack(out int id, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
id = this.id;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnpack(out int id, out short gen, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
@ -155,12 +178,14 @@ namespace DCFApixels.DragonECS
id = this.id;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnpack(out int id, out short worldID)
{
worldID = world;
id = this.id;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool TryUnpack(out int id, out short gen, out short worldID)
{
worldID = world;
@ -168,6 +193,49 @@ namespace DCFApixels.DragonECS
id = this.id;
return IsAlive;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetIDUnchecked()
{
return id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public EcsWorld GetWorldUnchecked()
{
return EcsWorld.GetWorld(world);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public short GetWorldIDUnchecked()
{
return world;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UnpackUnchecked(out int id, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UnpackUnchecked(out int id, out short gen, out EcsWorld world)
{
world = EcsWorld.GetWorld(this.world);
gen = this.gen;
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UnpackUnchecked(out int id, out short worldID)
{
worldID = world;
id = this.id;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UnpackUnchecked(out int id, out short gen, out short worldID)
{
worldID = world;
gen = this.gen;
id = this.id;
}
#endregion
#region Operators