添加transport库

This commit is contained in:
sunqinzhe committed 2025-12-14 03:02:38 +08:00
1 parent e3f449f183
commit 3fe3366e75
18 files changed
+188 -66

No files matched your search

@@ -1,4 +1,5 @@
using System;
using GameCore.LowLevel;
namespace GameCore.TinyECS
{
@@ -18,7 +19,7 @@ namespace GameCore.TinyECS
public override string ToString() => $"Entity<{type}>({index},{generation})";
public bool Equals(Entity<TEnum> other) => type.Equals(other.type) && index == other.index && generation == other.generation;
public override bool Equals(object obj) => obj is Entity<TEnum> other && Equals(other);
public override int GetHashCode() => HashCode.Combine(type, index, generation);
public override int GetHashCode() => LowLevelUtility.HashCombine(type.GetHashCode(), index, generation);
public static bool operator ==(Entity<TEnum> lhs, Entity<TEnum> rhs) => lhs.Equals(rhs);
public static bool operator !=(Entity<TEnum> lhs, Entity<TEnum> rhs) => !(lhs == rhs);
@@ -35,8 +35,8 @@ namespace GameCore.TinyECS
var id2 = ComponentId.Get<T2>();
meta.componentIdToIndex[id1] = 1;
meta.componentIdToIndex[id2] = 2;
meta.componentIdToOffset[id1] = (short)StructUtility.OffsetOf<(T1, T2), T1>();
meta.componentIdToOffset[id2] = (short)StructUtility.OffsetOf<(T1, T2), T2>();
meta.componentIdToOffset[id1] = (short)LowLevelUtility.OffsetOf<(T1, T2), T1>();
meta.componentIdToOffset[id2] = (short)LowLevelUtility.OffsetOf<(T1, T2), T2>();
meta.elementSize = UnsafeUtility.SizeOf<(T1, T2)>();
meta.elementAlign = UnsafeUtility.AlignOf<(T2, T2)>();
return meta;