mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
simple refactoring
This commit is contained in:
parent
90a1d16618
commit
f29e9dfdca
@ -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
|
||||||
{
|
{
|
||||||
@ -19,7 +18,7 @@ namespace DCFApixels.DragonECS
|
|||||||
private int _systemRecordsCount = 0;
|
private int _systemRecordsCount = 0;
|
||||||
private int _systemRecordsInrement = 0;
|
private int _systemRecordsInrement = 0;
|
||||||
|
|
||||||
private Dictionary<string, LayerSystemsList> _layerLists = new Dictionary<string, LayerSystemsList>();
|
private Dictionary<string, LayerSystemsList> _layerLists = new Dictionary<string, LayerSystemsList>();
|
||||||
|
|
||||||
private readonly List<InitDeclaredRunner> _initDeclaredRunners = new List<InitDeclaredRunner>(4);
|
private readonly List<InitDeclaredRunner> _initDeclaredRunners = new List<InitDeclaredRunner>(4);
|
||||||
|
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user