public ContainerIterator GetIterator() { AbstractClass[] classes = Registry.LazyClassesSearch(_components); List <RefArray[]> arrays = new List <RefArray[]>(); for (int i = 0; i < classes.Length; i++) { AbstractClass c = classes[i]; bool done = false; for (int j = 0; j < _SOAs.Length; j++) { TypeQueryResultValue result = _SOAs[j]; for (int k = 0; k < _components.Length; k++) { if (_SOAs[i].HashCode == c.HashCode) { RefArray[] classArgs = _SOAs[i].ComponentArrays; if (classArgs.Length == 0) { continue; } arrays.Add(classArgs); done = true; Console.WriteLine("Added: " + c.ClassType.FullName); break; } } if (done) { break; } } } return(new ContainerIterator(arrays.ToArray())); }
public TypeQueryResultValue[] GetSOAs(uint[] components) { AbstractClass[] results = Registry.LazyClassesSearch(components); TypeQueryResultValue[] values = new TypeQueryResultValue[results.Length]; for (int i = 0; i < values.Length; i++) { var value = _containers[results[i].HashCode]; // maps to a single class RefArray[] refArrays = new RefArray[value.Length]; for (var j = 0; j < refArrays.Length; j++) { // for each component refArrays[j] = value[j].GetRefArray(); } values[i] = new TypeQueryResultValue(results[i], refArrays); Console.WriteLine($"EcsTable::GetSOAs\t::[{string.Join(", ", components)}]->{results[i].ClassType.Name}"); } return(values); }