Non-public entities won't have symbols set

wip/source-generators
copygirl 1 year ago
parent 871eb3c808
commit ac8d8cea53
  1. 8
      src/gaemstone.Client/Components/InputComponents.cs
  2. 8
      src/gaemstone/ECS/Attributes.cs
  3. 5
      src/gaemstone/ECS/Universe+Modules.cs

@ -68,8 +68,8 @@ public class InputComponents
public struct CursorCapturedBy { }
[Private, Component]
public readonly struct RawValue1D
[Component]
internal readonly struct RawValue1D
{
private readonly float _value;
private RawValue1D(float value) => _value = value;
@ -78,8 +78,8 @@ public class InputComponents
public static implicit operator RawValue1D(float value) => new(value);
}
[Private, Component]
public readonly struct RawValue2D
[Component]
internal readonly struct RawValue2D
{
private readonly Vector2 _value;
private RawValue2D(Vector2 value) => _value = value;

@ -11,14 +11,6 @@ namespace gaemstone.ECS;
/// </summary>
public interface ICreateEntityAttribute { }
/// <summary>
/// By default, entities registered automatically have their symbol
/// (a globally unique identifier) set equal to their name. If they
/// are also marked with this attribute, the symbol won't be set.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class PrivateAttribute : Attribute { }
/// <summary>
/// A singleton is a single instance of a tag or component that can be retrieved
/// without explicitly specifying an entity in a query, where it is equivalent

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using gaemstone.Utility;
using static gaemstone.Flecs.Core;
using BindingFlags = System.Reflection.BindingFlags;
namespace gaemstone.ECS;
@ -174,7 +175,7 @@ internal class ModuleInfo
private void RegisterNestedTypes()
{
foreach (var type in Type.GetNestedTypes()) {
foreach (var type in Type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic)) {
if (!type.GetCustomAttributes(true).OfType<ICreateEntityAttribute>().Any()) continue;
// If proxied type is specified, use it instead of the marked type.
@ -191,7 +192,7 @@ internal class ModuleInfo
: new EntityPath(false, proxyType.Name);
var builder = path.IsAbsolute ? Universe.New(path) : Entity.NewChild(path);
if (!type.Has<PrivateAttribute>()) builder.Symbol(path.Name);
if (!type.IsPublic) builder.Symbol(path.Name);
var entity = builder.Build();

Loading…
Cancel
Save