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