mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-11-12 16:45:55 +08:00
add TypeMeta.ToString add DebuggerProxy for EcsProcess
This commit is contained in:
parent
ffa9bdb9bb
commit
f93696494e
@ -504,6 +504,13 @@ namespace DCFApixels.DragonECS
|
||||
All = Name | Group | Color | Description | Tags | TypeCode
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class TypeMetaDataCachedExtensions
|
||||
|
||||
@ -3,6 +3,7 @@ using DCFApixels.DragonECS.RunnersCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@ -489,9 +490,12 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#region EcsProcess
|
||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
||||
public readonly struct EcsProcessRaw : IEnumerable
|
||||
{
|
||||
private readonly Array _systems;
|
||||
|
||||
#region Properties
|
||||
public int Length
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@ -501,26 +505,62 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
get { return (IEcsProcess)_systems.GetValue(index); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal EcsProcessRaw(Array systems)
|
||||
{
|
||||
_systems = systems;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Enumerator
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return _systems.GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internal
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal T[] GetSystems_Internal<T>()
|
||||
{
|
||||
return (T[])_systems;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DebuggerProxy
|
||||
internal class DebuggerProxy
|
||||
{
|
||||
private EcsProcessRaw _process;
|
||||
public IEnumerable<TypeMeta> Systems
|
||||
{
|
||||
get
|
||||
{
|
||||
return _process._systems.Cast<IEcsProcess>().Select(o => o.GetMeta());
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return _process.Length; }
|
||||
}
|
||||
public DebuggerProxy(EcsProcessRaw process)
|
||||
{
|
||||
_process = process;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
[DebuggerTypeProxy(typeof(EcsProcess<>.DebuggerProxy))]
|
||||
public readonly struct EcsProcess<TProcess> : IReadOnlyCollection<TProcess>
|
||||
where TProcess : IEcsProcess
|
||||
{
|
||||
public readonly static EcsProcess<TProcess> Empty = new EcsProcess<TProcess>(Array.Empty<TProcess>());
|
||||
private readonly TProcess[] _systems;
|
||||
|
||||
#region Properties
|
||||
public bool IsNullOrEmpty
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@ -541,11 +581,17 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return _systems[index]; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal EcsProcess(TProcess[] systems)
|
||||
{
|
||||
_systems = systems;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Converts
|
||||
public static explicit operator EcsProcess<TProcess>(EcsProcessRaw raw)
|
||||
{
|
||||
return new EcsProcess<TProcess>(raw.GetSystems_Internal<TProcess>());
|
||||
@ -554,6 +600,9 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
return new EcsProcessRaw(process._systems);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Enumerator
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Enumerator GetEnumerator() { return new Enumerator(_systems); }
|
||||
IEnumerator<TProcess> IEnumerable<TProcess>.GetEnumerator() { return GetEnumerator(); }
|
||||
@ -581,6 +630,29 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose() { }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DebuggerProxy
|
||||
internal class DebuggerProxy
|
||||
{
|
||||
private EcsProcess<TProcess> _process;
|
||||
public IEnumerable<TypeMeta> Systems
|
||||
{
|
||||
get
|
||||
{
|
||||
return _process._systems.Select(o => o.GetMeta());
|
||||
}
|
||||
}
|
||||
public int Count
|
||||
{
|
||||
get { return _process.Length; }
|
||||
}
|
||||
public DebuggerProxy(EcsProcess<TProcess> process)
|
||||
{
|
||||
_process = process;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user