add another debug method
continuous-integration/drone/push Build is passing Details

debug
cosmonaut 2021-03-25 16:23:17 -07:00
parent 7ff3323391
commit f87cfc4c5a
2 changed files with 25 additions and 2 deletions

View File

@ -296,7 +296,7 @@ namespace Encompass
// should be used for debugging only! // should be used for debugging only!
#if DEBUG #if DEBUG
internal IEnumerable<object> Components(int entityID) internal IEnumerable<object> Debug_Components(int entityID)
{ {
foreach (var typeIndex in ExistingBits.EntityBitArray(entityID).TrueIndices()) foreach (var typeIndex in ExistingBits.EntityBitArray(entityID).TrueIndices())
{ {
@ -305,6 +305,17 @@ namespace Encompass
yield return generic.Invoke(this, new object[] { entityID }); yield return generic.Invoke(this, new object[] { entityID });
} }
} }
internal IEnumerable<Type> Debug_SearchComponentType(string typeString)
{
foreach (var type in TypeToIndex.Keys)
{
if (type.ToString().Contains(typeString))
{
yield return type;
}
}
}
#endif #endif
} }
} }

View File

@ -68,7 +68,19 @@ namespace Encompass
#if DEBUG #if DEBUG
protected IEnumerable<object> Debug_GetAllComponents(Entity entity) protected IEnumerable<object> Debug_GetAllComponents(Entity entity)
{ {
return _componentManager.Components(entity.ID); return _componentManager.Debug_Components(entity.ID);
}
protected IEnumerable<Entity> Debug_Entities(Type componentType)
{
var method = typeof(Renderer).GetMethod(nameof(ReadEntitiesAsEnumerable), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var generic = method.MakeGenericMethod(componentType);
return (IEnumerable<Entity>)generic.Invoke(this, null);
}
protected IEnumerable<Type> Debug_SearchComponentType(string typeString)
{
return _componentManager.Debug_SearchComponentType(typeString);
} }
#endif #endif
} }