Initial setup for testing AI performance, random fixes
All checks were successful
Build / Build (push) Successful in 54s
All checks were successful
Build / Build (push) Successful in 54s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Reflection;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
/// </summary>
|
||||
public static class ScriptUtils
|
||||
{
|
||||
private static readonly Dictionary<Type, (ScriptCategory category, StringKey name)> Cache = new();
|
||||
private static readonly ConcurrentDictionary<Type, (ScriptCategory category, StringKey name)> Cache = new();
|
||||
|
||||
/// <summary>
|
||||
/// Resolve name from the <see cref="ScriptAttribute"/> of the given script.
|
||||
|
||||
@@ -97,7 +97,15 @@ public class ScriptSet : IScriptSet
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerator<ScriptContainer> GetEnumerator() => _scripts.GetEnumerator();
|
||||
public IEnumerator<ScriptContainer> GetEnumerator()
|
||||
{
|
||||
var currentIndex = 0;
|
||||
while (currentIndex < _scripts.Count)
|
||||
{
|
||||
yield return _scripts[currentIndex];
|
||||
currentIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
@@ -176,7 +184,7 @@ public class ScriptSet : IScriptSet
|
||||
if (script is null)
|
||||
return;
|
||||
script.Script?.OnRemove();
|
||||
_scripts.Remove(script);
|
||||
script.Clear();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user