From 7792ce5990fd34112b49ee19166cd95fb23692cc Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Thu, 22 Jun 2023 09:10:51 +0800 Subject: [PATCH] update --- src/RelationManager.cs | 43 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/RelationManager.cs b/src/RelationManager.cs index 74a350b..d88d237 100644 --- a/src/RelationManager.cs +++ b/src/RelationManager.cs @@ -120,12 +120,12 @@ namespace DragonECS.DragonECS #region Has public bool HasRelation(int entityID, int otherEntityID) => _source._relationsMatrix.Contains(entityID, otherEntityID); - public bool HasRelationWith(EcsSubject subject, int entityID, int otherEntityID) - { - if (subject.World != _relationWorld) - throw new ArgumentException(); - return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out int entity) && subject.IsMatches(entity); - } + //public bool HasRelationWith(EcsSubject subject, int entityID, int otherEntityID) + //{ + // if (subject.World != _relationWorld) + // throw new ArgumentException(); + // return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out int entity) && subject.IsMatches(entity); + //} #endregion #region GetRelation @@ -139,27 +139,32 @@ namespace DragonECS.DragonECS { return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity); } - public bool TryGetRelation(EcsSubject subject, int entityID, int otherEntityID, out int entity) - { - return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity) && subject.IsMatches(entity); - } + //public bool TryGetRelation(EcsSubject subject, int entityID, int otherEntityID, out int entity) + //{ + // return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity) && subject.IsMatches(entity); + //} #endregion #region GetRelations - //ReadOnlySpan временная заглушка, потому тут будет спан из линкедлиста - public ReadOnlySpan GetRelations(int entityID) + public IdsLinkedList.Span GetRelations(int entityID) { - throw new NotImplementedException(); + return _basket.GetSpanFor(entityID); } //ReadOnlySpan временная заглушка, потому тут будет спан из линкедлиста - public ReadOnlySpan GetRelationsWith(EcsSubject subject, int entityID) - { - if (subject.World != _relationWorld) - throw new ArgumentException(); - throw new NotImplementedException(); - } + //public ReadOnlySpan GetRelationsWith(EcsSubject subject, int entityID) + //{ + // if (subject.World != _relationWorld) + // throw new ArgumentException(); + // throw new NotImplementedException(); + //} #endregion } + + public struct RelationsSpan + { + private readonly IdsBasket _basket; + private readonly EcsSubject _subject; + } #endregion }