Added UI Element and other QoL fixes for scripting #329

Merged
Pycorax merged 7 commits from SP3-6-c-scripting into main 2023-02-02 10:57:20 +08:00
5 changed files with 25 additions and 1 deletions
Showing only changes of commit 53f599a238 - Show all commits

View File

@ -259,6 +259,13 @@ namespace SHADE
ScriptStore::RemoveScript<T>(entity);
}
void GameObject::RemoveScript(Script^ script)
{
if (!valid)
throw gcnew System::NullReferenceException();
ScriptStore::RemoveScript(entity, script);
}
/*---------------------------------------------------------------------------------*/
/* Scene Graph Functions */
/*---------------------------------------------------------------------------------*/

View File

@ -259,6 +259,12 @@ namespace SHADE
/// <typeparam name="T">Type of Scripts to remove.</typeparam>
generic<typename T> where T : ref class, Script
void RemoveScript();
/// <summary>
/// Removes a specific script from this script's parent.
/// </summary>
/// <param name="script">The script to remove.</param>
/// <returns>True if successfully removed. False otherwise.</returns>
void RemoveScript(Script^ script);
/*-----------------------------------------------------------------------------*/
/* Scene Graph Functions */

View File

@ -126,6 +126,11 @@ namespace SHADE
ScriptStore::RemoveScript<T>(owner.GetEntity());
}
void Script::RemoveScript(Script^ script)
{
ScriptStore::RemoveScript(owner.GetEntity(), script);
}
Script::operator bool(Script^ s)
{
return s != nullptr;

View File

@ -198,6 +198,12 @@ namespace SHADE
/// </typeparam>
generic<typename T> where T : ref class, Script
void RemoveScript();
/// <summary>
/// Removes a specific script from this script's parent.
/// </summary>
/// <param name="script">The script to remove.</param>
/// <returns>True if successfully removed. False otherwise.</returns>
void RemoveScript(Script^ script);
/*-----------------------------------------------------------------------------*/
/* Operator Overloads */

View File

@ -203,7 +203,7 @@ namespace SHADE
generic<typename T> where T : ref class, Script
static void RemoveScript(Entity entity);
/// <summary>
/// Removes a specific script from the
/// Removes a specific script from the specified entity.
/// </summary>
/// <param name="entity">The entity to remove the script from.</param>
/// <param name="script">The script to remove.</param>