mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 10:34:37 +08:00
fix pipeline.builder merge
This commit is contained in:
parent
8c442a66c0
commit
bed850eb84
@ -537,30 +537,33 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region MergeWith
|
#region MergeWith
|
||||||
private static bool AreMatchingOrderIdentical(IReadOnlyList<string> listA, IReadOnlyList<string> listB)
|
private static bool AreMatchingOrderIdentical(List<string> listA, IReadOnlyList<string> listB)
|
||||||
{
|
{
|
||||||
int indexA = 0;
|
int lastIndexof = 0;
|
||||||
|
for (int i = 0; i < listB.Count; i++)
|
||||||
foreach (string itemB in listB)
|
|
||||||
{
|
{
|
||||||
if (indexA < listA.Count && listA[indexA] == itemB)
|
var a = listB[i];
|
||||||
|
int indexof = listA.IndexOf(a);
|
||||||
|
|
||||||
|
if (indexof < 0) { continue; }
|
||||||
|
if (indexof < lastIndexof)
|
||||||
{
|
{
|
||||||
indexA++;
|
return false;
|
||||||
}
|
}
|
||||||
|
lastIndexof = indexof;
|
||||||
}
|
}
|
||||||
return indexA == listA.Count;
|
return true;
|
||||||
}
|
}
|
||||||
public void MergeWith(IReadOnlyList<string> other)
|
public void MergeWith(IReadOnlyList<string> other)
|
||||||
{
|
{
|
||||||
List<string> listA = _layers;
|
List<string> listA = _layers;
|
||||||
IReadOnlyList<string> listB = other;
|
IReadOnlyList<string> listB = other;
|
||||||
|
|
||||||
|
//TODO все еще не работает!!!
|
||||||
if (AreMatchingOrderIdentical(listA, listB) == false)
|
if (AreMatchingOrderIdentical(listA, listB) == false)
|
||||||
{
|
{
|
||||||
//Для слияния списков слоев, нужно чтобы названия слоев, присутствующие в обоих списках, появлялись в одном и том же порядке в обоих списках
|
//Для слияния списков слоев, нужно чтобы в пересечении порядок записей совпадал
|
||||||
|
Throw.Exception("To merge layer lists, the names of the layers present in both lists must appear in the same order in both lists.");
|
||||||
//TODO все еще не работает!!!
|
|
||||||
//Throw.Exception("To merge layer lists, the names of the layers present in both lists must appear in the same order in both lists.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<string> seen = new HashSet<string>();
|
HashSet<string> seen = new HashSet<string>();
|
||||||
|
Loading…
Reference in New Issue
Block a user