Skip to content

Commit f912ddc

Browse files
committed
Adding protected sort methods to info tables
1 parent aaa738a commit f912ddc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Runtime/InfoTable.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public bool TryGet(InfoId infoId, out InfoScriptableObject val)
114114
{
115115
return TryGet(infoId.Value, out val);
116116
}
117-
117+
118118
public IEnumerator<InfoScriptableObject> GetEnumerator()
119119
{
120120
return entries.GetEnumerator();
@@ -125,6 +125,16 @@ IEnumerator IEnumerable.GetEnumerator()
125125
return GetEnumerator();
126126
}
127127

128+
protected void SortEntries(IComparer<InfoScriptableObject> comparer)
129+
{
130+
entries.Sort(comparer);
131+
}
132+
133+
protected void SortEntries(Comparison<InfoScriptableObject> comparison)
134+
{
135+
entries.Sort(comparison);
136+
}
137+
128138
}
129139

130140
/// <inheritdoc cref="InfoTable"/>
@@ -214,6 +224,16 @@ public bool TryGet(InfoId infoId, out T val)
214224
return TryGet(infoId.Value, out val);
215225
}
216226

227+
protected void SortEntries(IComparer<T> comparer)
228+
{
229+
entries.Sort(comparer);
230+
}
231+
232+
protected void SortEntries(Comparison<T> comparison)
233+
{
234+
entries.Sort(comparison);
235+
}
236+
217237
#if UNITY_EDITOR
218238
public override void GatherEntries()
219239
{

0 commit comments

Comments
 (0)