This commit is contained in:
Mikhail 2024-11-01 20:36:24 +08:00
parent bdc707dc74
commit a26288a069
3 changed files with 23 additions and 79 deletions

View File

@ -34,11 +34,11 @@ namespace DCFApixels.DragonECS
} }
IEnumerator<T> IEnumerable<T>.GetEnumerator() //IntelliSense hack IEnumerator<T> IEnumerable<T>.GetEnumerator() //IntelliSense hack
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
IEnumerator IEnumerable.GetEnumerator() //IntelliSense hack IEnumerator IEnumerable.GetEnumerator() //IntelliSense hack
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator T(UnityComponent<T> a) { return a.obj; } public static implicit operator T(UnityComponent<T> a) { return a.obj; }

View File

@ -57,35 +57,16 @@ namespace DCFApixels.DragonECS.Unity.Internal
[MetaID("2DD8BC809201633E2761D5AEF65B7090")] [MetaID("2DD8BC809201633E2761D5AEF65B7090")]
public class EcsLateGizmosRunner : EcsRunner<IEcsGizmosProcess>, IEcsGizmosProcess public class EcsLateGizmosRunner : EcsRunner<IEcsGizmosProcess>, IEcsGizmosProcess
{ {
#if DEBUG && !DISABLE_DEBUG private RunHelper _helper;
private EcsProfilerMarker[] _markers;
#endif
public void DrawGizmos()
{
#if DEBUG && !DISABLE_DEBUG
for (int i = 0; i < Process.Length; i++)
{
using (_markers[i].Auto())
{
Process[i].DrawGizmos();
}
}
#else
foreach (var item in Process) item.DrawGizmos();
#endif
}
#if DEBUG && !DISABLE_DEBUG
protected override void OnSetup() protected override void OnSetup()
{ {
_markers = new EcsProfilerMarker[Process.Length]; _helper = new RunHelper(this);
for (int i = 0; i < Process.Length; i++) }
public void DrawGizmos()
{ {
_markers[i] = new EcsProfilerMarker($"{Process[i].GetType().Name}.{nameof(DrawGizmos)}"); _helper.Run(p => p.DrawGizmos());
} }
} }
#endif
}
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
@ -94,35 +75,16 @@ namespace DCFApixels.DragonECS.Unity.Internal
[MetaID("EDE8BC809201603B47C3A9D1EFD4EE95")] [MetaID("EDE8BC809201603B47C3A9D1EFD4EE95")]
public class EcsLateRunRunner : EcsRunner<IEcsLateRunProcess>, IEcsLateRunProcess public class EcsLateRunRunner : EcsRunner<IEcsLateRunProcess>, IEcsLateRunProcess
{ {
#if DEBUG && !DISABLE_DEBUG private RunHelper _helper;
private EcsProfilerMarker[] _markers;
#endif
public void LateRun()
{
#if DEBUG && !DISABLE_DEBUG
for (int i = 0; i < Process.Length; i++)
{
using (_markers[i].Auto())
{
Process[i].LateRun();
}
}
#else
foreach (var item in Process) item.LateRun();
#endif
}
#if DEBUG && !DISABLE_DEBUG
protected override void OnSetup() protected override void OnSetup()
{ {
_markers = new EcsProfilerMarker[Process.Length]; _helper = new RunHelper(this);
for (int i = 0; i < Process.Length; i++) }
public void LateRun()
{ {
_markers[i] = new EcsProfilerMarker($"EcsRunner.{Process[i].GetType().Name}.{nameof(LateRun)}"); _helper.Run(p => p.LateRun());
} }
} }
#endif
}
[MetaColor(MetaColor.DragonRose)] [MetaColor(MetaColor.DragonRose)]
[MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)] [MetaGroup(EcsUnityConsts.PACK_GROUP, EcsConsts.PROCESSES_GROUP)]
@ -131,33 +93,14 @@ namespace DCFApixels.DragonECS.Unity.Internal
[MetaID("45F7BC809201866AA05F6DC096A47F01")] [MetaID("45F7BC809201866AA05F6DC096A47F01")]
public class EcsFixedRunRunner : EcsRunner<IEcsFixedRunProcess>, IEcsFixedRunProcess public class EcsFixedRunRunner : EcsRunner<IEcsFixedRunProcess>, IEcsFixedRunProcess
{ {
#if DEBUG && !DISABLE_DEBUG private RunHelper _helper;
private EcsProfilerMarker[] _markers;
#endif
public void FixedRun()
{
#if DEBUG && !DISABLE_DEBUG
for (int i = 0; i < Process.Length; i++)
{
using (_markers[i].Auto())
{
Process[i].FixedRun();
}
}
#else
foreach (var item in Process) item.FixedRun();
#endif
}
#if DEBUG && !DISABLE_DEBUG
protected override void OnSetup() protected override void OnSetup()
{ {
_markers = new EcsProfilerMarker[Process.Length]; _helper = new RunHelper(this);
for (int i = 0; i < Process.Length; i++) }
public void FixedRun()
{ {
_markers[i] = new EcsProfilerMarker($"EcsRunner.{Process[i].GetType().Name}.{nameof(FixedRun)}"); _helper.Run(p => p.FixedRun());
} }
} }
#endif
}
} }

View File

@ -1,4 +1,5 @@
using System; using DCFApixels.DragonECS.Core;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using UnityEngine; using UnityEngine;