Moved UIRoutines call order. Call FinalizeChanges. Fixed UI Button Events. #359
|
@ -28,6 +28,18 @@ namespace SHADE
|
|||
: Component(entity)
|
||||
{}
|
||||
|
||||
void UIElement::ClearStaticEventData()
|
||||
{
|
||||
if (onClickEventMap != nullptr)
|
||||
onClickEventMap->Clear();
|
||||
if (onReleasedEventMap != nullptr)
|
||||
onReleasedEventMap->Clear();
|
||||
if (onHoverEnterEventMap != nullptr)
|
||||
onHoverEnterEventMap->Clear();
|
||||
if (onHoverExitEventMap != nullptr)
|
||||
onHoverExitEventMap->Clear();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Properties */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -37,7 +49,7 @@ namespace SHADE
|
|||
if (onClickEventMap == nullptr)
|
||||
{
|
||||
onClickEventMap = gcnew System::Collections::Generic::Dictionary<Entity, CallbackEvent ^>();
|
||||
}
|
||||
}
|
||||
|
||||
// Create event if it wasn't before
|
||||
if (!onClickEventMap->ContainsKey(owner.EntityId))
|
||||
|
|
|
@ -73,6 +73,15 @@ namespace SHADE
|
|||
CallbackEvent^ get();
|
||||
}
|
||||
|
||||
internal:
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Static Clear Functions */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Disposes static event data which may contains data from SHADE_Scripting.
|
||||
/// </summary>
|
||||
static void ClearStaticEventData();
|
||||
|
||||
private:
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Event Handling Functions */
|
||||
|
@ -108,6 +117,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------*/
|
||||
/* Static Data Members */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
// As these hold references to code in SHADE_Scripting, we must remember to dispose of them when changing scenes
|
||||
static System::Collections::Generic::Dictionary<Entity, CallbackEvent^>^ onClickEventMap;
|
||||
static System::Collections::Generic::Dictionary<Entity, CallbackEvent^>^ onReleasedEventMap;
|
||||
static System::Collections::Generic::Dictionary<Entity, CallbackEvent^>^ onHoverEnterEventMap;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace SHADE
|
|||
/// specified Component.
|
||||
/// </returns>
|
||||
generic<typename T> where T : BaseComponent
|
||||
static T GetComponent(EntityID entity);
|
||||
static T GetComponent(EntityID entity);
|
||||
/// <summary>
|
||||
/// Retrieves the first Component from the specified GameObject's children that
|
||||
/// matches the specified type.
|
||||
|
|
|
@ -21,6 +21,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Utility/Convert.hxx"
|
||||
#include "Utility/Debug.hxx"
|
||||
#include "Scripts/ScriptStore.hxx"
|
||||
#include "Components/UIElement.hxx"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -43,6 +44,9 @@ namespace SHADE
|
|||
oss << "[EngineInterface] Unloading " << Convert::ToNative(ManagedLibraryName) << ".dll";
|
||||
ScriptStore::Exit();
|
||||
|
||||
// Unload static data of components that have access to the assembly
|
||||
UIElement::ClearStaticEventData();
|
||||
|
||||
// Unload the script
|
||||
scriptContext->Unload();
|
||||
scriptContext = nullptr;
|
||||
|
|
Loading…
Reference in New Issue