mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +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)
|
||||
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.AddUnique(new DeleteOneFrameComponentSystem<TComponent>(), layerName);
|
||||
return b;
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
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_WARNING_TAG = "WARNING";
|
||||
public const string DEBUG_ERROR_TAG = "ERROR";
|
||||
|
@ -69,7 +69,7 @@ namespace DCFApixels.DragonECS
|
||||
BlueViolet = (138 << 24) + (43 << 16) + (226 << 8),
|
||||
/// <summary> Yellow. RGB is (255, 3, 62)</summary>
|
||||
AmericanRose = (255 << 24) + (3 << 16) + (62 << 8),
|
||||
|
||||
|
||||
/// <summary> Grey/Gray. RGB is (127, 127, 127)</summary>
|
||||
Gray = (127 << 24) + (127 << 16) + (127 << 8),
|
||||
/// <summary> Grey/Gray. RGB is (127, 127, 127)</summary>
|
||||
|
@ -117,7 +117,7 @@ namespace DCFApixels.DragonECS
|
||||
public int RegisterMark(string name)
|
||||
{
|
||||
int id;
|
||||
if(!_nameIdTable.TryGetValue(name, out id))
|
||||
if (!_nameIdTable.TryGetValue(name, out id))
|
||||
{
|
||||
id = _idDispenser.GetFree();
|
||||
_nameIdTable.Add(name, id);
|
||||
@ -149,7 +149,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
#if !DISABLE_DRAGONECS_DEBUGGER
|
||||
_stopwatchs = new Stopwatch[64];
|
||||
_stopwatchsNames= new string[64];
|
||||
_stopwatchsNames = new string[64];
|
||||
#endif
|
||||
}
|
||||
public override void Print(string tag, object v)
|
||||
|
@ -242,7 +242,7 @@ namespace DCFApixels.DragonECS
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (group.World != _source) throw new ArgumentException("groupFilter.WorldIndex != WorldIndex");
|
||||
#endif
|
||||
if(_count > 0)
|
||||
if (_count > 0)
|
||||
Clear();
|
||||
foreach (var item in group)
|
||||
AddInternal(item);
|
||||
@ -371,14 +371,14 @@ namespace DCFApixels.DragonECS
|
||||
#region Enumerator
|
||||
public ref struct Enumerator// : IDisposable
|
||||
{
|
||||
// private readonly EcsGroup source;
|
||||
// private readonly EcsGroup source;
|
||||
private readonly int[] _dense;
|
||||
private readonly int _count;
|
||||
private int _index;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Enumerator(EcsGroup group)
|
||||
{
|
||||
// source = group;
|
||||
// source = group;
|
||||
_dense = group._dense;
|
||||
_count = group._count;
|
||||
_index = 0;
|
||||
@ -389,7 +389,7 @@ namespace DCFApixels.DragonECS
|
||||
get => _dense[_index];
|
||||
}
|
||||
[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)]
|
||||
//public void Dispose() => source.Unlock();
|
||||
}
|
||||
@ -410,7 +410,7 @@ namespace DCFApixels.DragonECS
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = 0;
|
||||
foreach (var item in this)
|
||||
|
@ -194,7 +194,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
foreach (var item in Layers)
|
||||
{
|
||||
if(_systems.TryGetValue(item, out var list))
|
||||
if (_systems.TryGetValue(item, out var list))
|
||||
result.AddRange(list);
|
||||
}
|
||||
return new EcsPipeline(result.ToArray());
|
||||
@ -211,7 +211,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
_source = source;
|
||||
_layers = new List<string>(16) { basicLayerName, ADD_LAYER };
|
||||
_basicLayerName = basicLayerName;
|
||||
_basicLayerName = basicLayerName;
|
||||
}
|
||||
|
||||
public Builder Add(string newLayer) => Insert(ADD_LAYER, newLayer);
|
||||
|
@ -122,7 +122,7 @@ namespace DCFApixels.DragonECS
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
[UnityEngine.Scripting.RequireDerived, UnityEngine.Scripting.Preserve]
|
||||
#endif
|
||||
public abstract class EcsRunner<TInterface> : IEcsProcess, IEcsRunner
|
||||
public abstract class EcsRunner<TInterface> : IEcsProcess, IEcsRunner
|
||||
where TInterface : IEcsProcess
|
||||
{
|
||||
#region Register
|
||||
|
@ -360,13 +360,13 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
list.Clear();
|
||||
var itemsCount = GetComponentsCount(entityID);
|
||||
if (itemsCount == 0)
|
||||
if (itemsCount == 0)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < _pools.Length; i++)
|
||||
{
|
||||
if (_pools[i].Has(entityID))
|
||||
list.Add(_pools[i].GetRaw(entityID));
|
||||
list.Add(_pools[i].GetRaw(entityID));
|
||||
if (list.Count >= itemsCount)
|
||||
break;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
using (_executeWhere.Auto())
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
|
||||
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
||||
if (sourceGroup.IsNull) throw new System.ArgumentNullException();//TODO составить текст исключения.
|
||||
#endif
|
||||
_subject.GetIteratorFor(sourceGroup).CopyTo(_filteredGroup);
|
||||
return new EcsWhereResult<TSubject>(this, _filteredGroup.Readonly);
|
||||
|
@ -36,7 +36,7 @@ namespace DCFApixels.DragonECS
|
||||
void IEcsPoolImplementation.OnInit(EcsWorld world, int componentID)
|
||||
{
|
||||
_source = world;
|
||||
_id = componentID;
|
||||
_id = componentID;
|
||||
|
||||
const int capacity = 512;
|
||||
|
||||
@ -178,12 +178,12 @@ namespace DCFApixels.DragonECS
|
||||
#region Listeners
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user