refactoring

This commit is contained in:
Mikhail 2023-05-30 18:30:10 +08:00
parent 5661d1e6d9
commit 33f1f03294
10 changed files with 19 additions and 19 deletions

View File

@ -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;

View File

@ -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";

View File

@ -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)

View File

@ -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();
}

View File

@ -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());

View File

@ -366,7 +366,7 @@ namespace DCFApixels.DragonECS
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;
}

View File

@ -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);

View File

@ -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