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

58 lines
1.7 KiB
C#
Raw Normal View History

2024-07-28 10:52:17 +00:00
using PkmnLib.Static.Utils;
2024-07-27 14:26:45 +00:00
namespace PkmnLib.Dynamic.ScriptHandling;
2024-07-28 10:52:17 +00:00
/// <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>
2024-07-27 14:26:45 +00:00
public interface IScriptSet : IEnumerable<ScriptContainer>
{
2024-07-28 10:52:17 +00:00
/// <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>
2024-07-27 14:26:45 +00:00
void Clear();
2024-07-28 10:52:17 +00:00
/// <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>
2024-07-27 14:26:45 +00:00
ScriptContainer At(int index);
2024-07-28 10:52:17 +00:00
/// <summary>
/// Gets the number of scripts in the set.
/// </summary>
2024-07-27 14:26:45 +00:00
int Count { get; }
2024-07-28 10:52:17 +00:00
/// <summary>
/// Gets the names of all scripts in the set.
/// </summary>
IEnumerable<StringKey> GetScriptNames();
2024-07-27 14:26:45 +00:00
}