Added the `HierarchyEditor` and `LocalToWorldEditor` classes to implement custom component editing functionality. Added the `Vector3Field` control for 3D vector manipulation and its corresponding XAML definition. Added the `ComponentDataView` and `ComponentObject` classes to manage component data display and access. Added the `CustomEditorAttribute` to mark classes as custom editors for specific components. Changed the `IInspectable` interface to use properties for `Icon`, `HeaderContent`, and `InspectorContent`. Changed the `PropertyField` class to enhance UI control binding capabilities. Changed the `EditorWorldManager` to improve world data loading and deserialization processes. Changed the `EntityNode` and `WorldNode` classes to update entity construction and component querying. Changed the `StaticResource` class to include new binding flags for component properties. Changed the `InspectorService` to remove old contract references and adopt new interfaces. Changed the `QueryEnumerable` and related files to update generic constraints for improved type safety. Changed the `QueryItem` class to reflect new generic constraints and enhance deconstruction. Changed the `World.Query` methods to utilize the updated generic constraints. Updated the `SerializationTest` to align with new entity creation and management practices.
105 lines
5.3 KiB
C#
105 lines
5.3 KiB
C#
|
|
|
|
using Ghost.Entities.Components;
|
|
|
|
namespace Ghost.Entities;
|
|
|
|
public partial class World
|
|
{
|
|
public QueryEnumerable<T0> Query<T0>()
|
|
where T0 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0>(
|
|
this,
|
|
pool0,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1> Query<T0, T1>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1>(
|
|
this,
|
|
pool0, pool1,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2> Query<T0, T1, T2>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2>(
|
|
this,
|
|
pool0, pool1, pool2,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2, T3> Query<T0, T1, T2, T3>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2) && _componentStorage.TryGetPool<T3>(out var pool3)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2, T3>(
|
|
this,
|
|
pool0, pool1, pool2, pool3,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2, T3, T4> Query<T0, T1, T2, T3, T4>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2) && _componentStorage.TryGetPool<T3>(out var pool3) && _componentStorage.TryGetPool<T4>(out var pool4)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2, T3, T4>(
|
|
this,
|
|
pool0, pool1, pool2, pool3, pool4,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2, T3, T4, T5> Query<T0, T1, T2, T3, T4, T5>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2) && _componentStorage.TryGetPool<T3>(out var pool3) && _componentStorage.TryGetPool<T4>(out var pool4) && _componentStorage.TryGetPool<T5>(out var pool5)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2, T3, T4, T5>(
|
|
this,
|
|
pool0, pool1, pool2, pool3, pool4, pool5,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2, T3, T4, T5, T6> Query<T0, T1, T2, T3, T4, T5, T6>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData where T6 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2) && _componentStorage.TryGetPool<T3>(out var pool3) && _componentStorage.TryGetPool<T4>(out var pool4) && _componentStorage.TryGetPool<T5>(out var pool5) && _componentStorage.TryGetPool<T6>(out var pool6)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2, T3, T4, T5, T6>(
|
|
this,
|
|
pool0, pool1, pool2, pool3, pool4, pool5, pool6,
|
|
pool0.Count);
|
|
}
|
|
|
|
public QueryEnumerable<T0, T1, T2, T3, T4, T5, T6, T7> Query<T0, T1, T2, T3, T4, T5, T6, T7>()
|
|
where T0 : unmanaged, IComponentData where T1 : unmanaged, IComponentData where T2 : unmanaged, IComponentData where T3 : unmanaged, IComponentData where T4 : unmanaged, IComponentData where T5 : unmanaged, IComponentData where T6 : unmanaged, IComponentData where T7 : unmanaged, IComponentData
|
|
{
|
|
if (!(_componentStorage.TryGetPool<T0>(out var pool0) && _componentStorage.TryGetPool<T1>(out var pool1) && _componentStorage.TryGetPool<T2>(out var pool2) && _componentStorage.TryGetPool<T3>(out var pool3) && _componentStorage.TryGetPool<T4>(out var pool4) && _componentStorage.TryGetPool<T5>(out var pool5) && _componentStorage.TryGetPool<T6>(out var pool6) && _componentStorage.TryGetPool<T7>(out var pool7)))
|
|
return default;
|
|
|
|
return new QueryEnumerable<T0, T1, T2, T3, T4, T5, T6, T7>(
|
|
this,
|
|
pool0, pool1, pool2, pool3, pool4, pool5, pool6, pool7,
|
|
pool0.Count);
|
|
}
|
|
|
|
} |