PkmnLib.NET/PkmnLib.Dynamic/ScriptHandling/ScriptSet.cs

58 lines
1.7 KiB
C#

using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.ScriptHandling;
/// <summary>
/// A script set is a collection of scripts that can be accessed by a key.
/// We can add, remove, and clear scripts from the set.
/// This is generally used for volatile scripts.
/// </summary>
public interface IScriptSet : IEnumerable<ScriptContainer>
{
/// <summary>
/// Adds a script to the set. If the script with that name already exists in this set, this
/// makes that script stack instead. The return value here is that script.
/// </summary>
ScriptContainer Add(Script script);
/// <summary>
/// Adds a script with a name to the set. If the script with that name already exists in this
/// set, this makes that script stack instead. The return value here is that script.
/// </summary>
ScriptContainer? Add(StringKey scriptKey);
/// <summary>
/// Gets a script from the set using its unique name.
/// </summary>
ScriptContainer? Get(StringKey scriptKey);
/// <summary>
/// Removes a script from the set using its unique name.
/// </summary>
void Remove(StringKey scriptKey);
/// <summary>
/// Clears all scripts from the set.
/// </summary>
void Clear();
/// <summary>
/// Checks if the set has a script with the given name.
/// </summary>
void Contains(StringKey scriptKey);
/// <summary>
/// Gets a script from the set at a specific index.
/// </summary>
ScriptContainer At(int index);
/// <summary>
/// Gets the number of scripts in the set.
/// </summary>
int Count { get; }
/// <summary>
/// Gets the names of all scripts in the set.
/// </summary>
IEnumerable<StringKey> GetScriptNames();
}