simple refactoring

This commit is contained in:
Mikhail 2024-06-25 23:35:51 +08:00
parent 90a1d16618
commit f29e9dfdca
2 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,6 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using static DCFApixels.DragonECS.EcsPipeline.Builder;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
@ -94,7 +93,7 @@ namespace DCFApixels.DragonECS
private void AddRecordInternal(IEcsProcess system, string layer, int addOrder, int sortOrder, bool isUnique) private void AddRecordInternal(IEcsProcess system, string layer, int addOrder, int sortOrder, bool isUnique)
{ {
SystemRecord record = new SystemRecord(system, layer, addOrder, sortOrder, isUnique); SystemRecord record = new SystemRecord(system, layer, addOrder, sortOrder, isUnique);
if(_layerLists.TryGetValue(layer, out LayerSystemsList list) == false) if (_layerLists.TryGetValue(layer, out LayerSystemsList list) == false)
{ {
list = new LayerSystemsList(layer); list = new LayerSystemsList(layer);
_layerLists.Add(layer, list); _layerLists.Add(layer, list);
@ -224,11 +223,11 @@ namespace DCFApixels.DragonECS
{ {
ref var record = ref _systemRecords[i]; ref var record = ref _systemRecords[i];
var list = _layerLists[record.layer]; var list = _layerLists[record.layer];
if(list.IsInit == false) if (list.IsInit == false)
{ {
list = basicLayerList; list = basicLayerList;
} }
if(record.isUnique == false || uniqueSystemsSet.Add(record.system.GetType())) if (record.isUnique == false || uniqueSystemsSet.Add(record.system.GetType()))
{ {
list.Add(record.system, record.addOrder, record.sortOrder, record.isUnique); list.Add(record.system, record.addOrder, record.sortOrder, record.isUnique);
} }
@ -516,11 +515,11 @@ namespace DCFApixels.DragonECS
} }
public void Add(IEcsProcess system, int addOrder, int sortingOrder, bool isUnique) public void Add(IEcsProcess system, int addOrder, int sortingOrder, bool isUnique)
{ {
if(recordsCount <= 1) if (recordsCount <= 1)
{ {
_lastSortingOrder = sortingOrder; _lastSortingOrder = sortingOrder;
} }
else if(_lastSortingOrder != sortingOrder) else if (_lastSortingOrder != sortingOrder)
{ {
_isSorted = false; _isSorted = false;
} }

View File

@ -265,7 +265,7 @@ namespace DCFApixels.DragonECS
{ {
this.name = name; this.name = name;
int indexof = name.LastIndexOf('.'); int indexof = name.LastIndexOf('.');
if(indexof > 0) if (indexof > 0)
{ {
layerNameSpace = name.Substring(0, indexof + 1); layerNameSpace = name.Substring(0, indexof + 1);
layerName = name.Substring(indexof + 1); layerName = name.Substring(indexof + 1);