mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
refactoring
This commit is contained in:
parent
5661d1e6d9
commit
33f1f03294
@ -53,7 +53,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public static EcsPipeline.Builder AutoDel<TComponent>(this EcsPipeline.Builder b, string layerName = AUTO_DEL_LAYER)
|
public static EcsPipeline.Builder AutoDel<TComponent>(this EcsPipeline.Builder b, string layerName = AUTO_DEL_LAYER)
|
||||||
where TComponent : struct, IEcsComponent
|
where TComponent : struct, IEcsComponent
|
||||||
{
|
{
|
||||||
if(AUTO_DEL_LAYER == layerName)
|
if (AUTO_DEL_LAYER == layerName)
|
||||||
b.Layers.Insert(EcsConsts.POST_END_LAYER, AUTO_DEL_LAYER);
|
b.Layers.Insert(EcsConsts.POST_END_LAYER, AUTO_DEL_LAYER);
|
||||||
b.AddUnique(new DeleteOneFrameComponentSystem<TComponent>(), layerName);
|
b.AddUnique(new DeleteOneFrameComponentSystem<TComponent>(), layerName);
|
||||||
return b;
|
return b;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
public const string FRAMEWORK_NAME = "DragonECS";
|
public const string FRAMEWORK_NAME = "DragonECS";
|
||||||
|
|
||||||
public const string EXCEPTION_MESSAGE_PREFIX = "["+ FRAMEWORK_NAME + "] ";
|
public const string EXCEPTION_MESSAGE_PREFIX = "[" + FRAMEWORK_NAME + "] ";
|
||||||
public const string DEBUG_PREFIX = "[DEBUG] ";
|
public const string DEBUG_PREFIX = "[DEBUG] ";
|
||||||
public const string DEBUG_WARNING_TAG = "WARNING";
|
public const string DEBUG_WARNING_TAG = "WARNING";
|
||||||
public const string DEBUG_ERROR_TAG = "ERROR";
|
public const string DEBUG_ERROR_TAG = "ERROR";
|
||||||
|
@ -117,7 +117,7 @@ namespace DCFApixels.DragonECS
|
|||||||
public int RegisterMark(string name)
|
public int RegisterMark(string name)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
if(!_nameIdTable.TryGetValue(name, out id))
|
if (!_nameIdTable.TryGetValue(name, out id))
|
||||||
{
|
{
|
||||||
id = _idDispenser.GetFree();
|
id = _idDispenser.GetFree();
|
||||||
_nameIdTable.Add(name, id);
|
_nameIdTable.Add(name, id);
|
||||||
@ -149,7 +149,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||||
_stopwatchs = new Stopwatch[64];
|
_stopwatchs = new Stopwatch[64];
|
||||||
_stopwatchsNames= new string[64];
|
_stopwatchsNames = new string[64];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
public override void Print(string tag, object v)
|
public override void Print(string tag, object v)
|
||||||
|
@ -242,7 +242,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (group.World != _source) throw new ArgumentException("groupFilter.WorldIndex != WorldIndex");
|
if (group.World != _source) throw new ArgumentException("groupFilter.WorldIndex != WorldIndex");
|
||||||
#endif
|
#endif
|
||||||
if(_count > 0)
|
if (_count > 0)
|
||||||
Clear();
|
Clear();
|
||||||
foreach (var item in group)
|
foreach (var item in group)
|
||||||
AddInternal(item);
|
AddInternal(item);
|
||||||
@ -389,7 +389,7 @@ namespace DCFApixels.DragonECS
|
|||||||
get => _dense[_index];
|
get => _dense[_index];
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool MoveNext() => ++_index <= _count && _count<_dense.Length; // <= потму что отсчет начинается с индекса 1 //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
public bool MoveNext() => ++_index <= _count && _count < _dense.Length; // <= потму что отсчет начинается с индекса 1 //_count < _dense.Length дает среде понять что проверки на выход за границы не нужны
|
||||||
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
//public void Dispose() => source.Unlock();
|
//public void Dispose() => source.Unlock();
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
foreach (var item in Layers)
|
foreach (var item in Layers)
|
||||||
{
|
{
|
||||||
if(_systems.TryGetValue(item, out var list))
|
if (_systems.TryGetValue(item, out var list))
|
||||||
result.AddRange(list);
|
result.AddRange(list);
|
||||||
}
|
}
|
||||||
return new EcsPipeline(result.ToArray());
|
return new EcsPipeline(result.ToArray());
|
||||||
|
@ -178,12 +178,12 @@ namespace DCFApixels.DragonECS
|
|||||||
#region Listeners
|
#region Listeners
|
||||||
public void AddListener(IEcsPoolEventListener listener)
|
public void AddListener(IEcsPoolEventListener listener)
|
||||||
{
|
{
|
||||||
if(listener == null) { throw new ArgumentNullException("listener is null"); }
|
if (listener == null) { throw new ArgumentNullException("listener is null"); }
|
||||||
_listeners.Add(listener);
|
_listeners.Add(listener);
|
||||||
}
|
}
|
||||||
public void RemoveListener(IEcsPoolEventListener listener)
|
public void RemoveListener(IEcsPoolEventListener listener)
|
||||||
{
|
{
|
||||||
if(listener == null) { throw new ArgumentNullException("listener is null"); }
|
if (listener == null) { throw new ArgumentNullException("listener is null"); }
|
||||||
_listeners.Remove(listener);
|
_listeners.Remove(listener);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user