mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
update collectiona
This commit is contained in:
parent
3119ea42db
commit
fc167fb28c
@ -1,4 +1,5 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
|
using DCFApixels.DragonECS.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -13,7 +14,7 @@ namespace DCFApixels.DragonECS
|
|||||||
//_dense заполняется с индекса 1
|
//_dense заполняется с индекса 1
|
||||||
//в операциях изменяющих состояние группы нельзя итерироваться по this, либо осторожно учитывать этот момент
|
//в операциях изменяющих состояние группы нельзя итерироваться по this, либо осторожно учитывать этот момент
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 0, Size = 8)]
|
[StructLayout(LayoutKind.Sequential, Pack = 0, Size = 8)]
|
||||||
[DebuggerTypeProxy(typeof(DebuggerProxy))]
|
[DebuggerTypeProxy(typeof(EcsGroup.DebuggerProxy))]
|
||||||
public readonly ref struct EcsReadonlyGroup
|
public readonly ref struct EcsReadonlyGroup
|
||||||
{
|
{
|
||||||
private readonly EcsGroup _source;
|
private readonly EcsGroup _source;
|
||||||
@ -134,10 +135,10 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static implicit operator EcsSpan(EcsReadonlyGroup a) => a.ToSpan();
|
public static implicit operator EcsSpan(EcsReadonlyGroup a) => a.ToSpan();
|
||||||
internal class DebuggerProxy : EcsGroup.DebuggerProxy
|
//internal class DebuggerProxy : EcsGroup.DebuggerProxy
|
||||||
{
|
//{
|
||||||
public DebuggerProxy(EcsReadonlyGroup group) : base(group._source) { }
|
// public DebuggerProxy(EcsReadonlyGroup group) : base(group._source) { }
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +721,8 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Other
|
#region Other
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"group({_count}) {{{string.Join(", ", _dense.Skip(1).Take(_count).OrderBy(o => o))}}}";
|
return EntitiesCollectionUtility.AutoToString(_dense.Skip(1).Take(_count), "group");
|
||||||
|
//return $"group({_count}) {{{string.Join(", ", _dense.Skip(1).Take(_count).OrderBy(o => o))}}}";
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public int First()
|
public int First()
|
||||||
@ -762,6 +764,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public int CapacitySparce => _group.CapacitySparce;
|
public int CapacitySparce => _group.CapacitySparce;
|
||||||
public override string ToString() => _group.ToString();
|
public override string ToString() => _group.ToString();
|
||||||
public DebuggerProxy(EcsGroup group) => _group = group;
|
public DebuggerProxy(EcsGroup group) => _group = group;
|
||||||
|
public DebuggerProxy(EcsReadonlyGroup group) : this(group.GetGroupInternal()) { }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using DCFApixels.DragonECS.Utils;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
@ -122,7 +122,8 @@ namespace DCFApixels.DragonECS
|
|||||||
#pragma warning restore CS0809 // Устаревший член переопределяет неустаревший член
|
#pragma warning restore CS0809 // Устаревший член переопределяет неустаревший член
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"span({_values.Length}) {{{string.Join(", ", _values.ToArray().OrderBy(o => o))}}}";
|
return EntitiesCollectionUtility.AutoToString(_values.ToArray(), "span");
|
||||||
|
//return $"span({_values.Length}) {{{string.Join(", ", _values.ToArray().OrderBy(o => o))}}}";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class DebuggerProxy
|
internal class DebuggerProxy
|
||||||
@ -142,7 +143,6 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int Count => _values.Length;
|
public int Count => _values.Length;
|
||||||
//public override string ToString() => $"span({_values.Length}) {{{string.Join(", ", _values.OrderBy(o => o))}}}";
|
|
||||||
public DebuggerProxy(EcsSpan span)
|
public DebuggerProxy(EcsSpan span)
|
||||||
{
|
{
|
||||||
_values = new int[span.Length];
|
_values = new int[span.Length];
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS.Utils
|
namespace DCFApixels.DragonECS.Utils
|
||||||
{
|
{
|
||||||
@ -51,4 +53,12 @@ namespace DCFApixels.DragonECS.Utils
|
|||||||
new IntPtr(Marshal.SizeOf(typeof(T)) * newCount))).ToPointer();
|
new IntPtr(Marshal.SizeOf(typeof(T)) * newCount))).ToPointer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class EntitiesCollectionUtility
|
||||||
|
{
|
||||||
|
public static string AutoToString(IEnumerable<int> range, string name)
|
||||||
|
{
|
||||||
|
return $"{name}({range.Count()}) {{{string.Join(", ", range.OrderBy(o => o))}}})";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user