Moved UIRoutines call order. Call FinalizeChanges. Fixed UI Button Events. #359

Merged
maverickdgg merged 8 commits from SP3-20-UI-System into main 2023-02-23 14:00:51 +08:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit d7846082a3 - Show all commits

View File

@ -372,21 +372,21 @@ namespace SHADE
SHEventHandle SHScriptEngine::onUIElementReleased(SHEventPtr eventPtr) SHEventHandle SHScriptEngine::onUIElementReleased(SHEventPtr eventPtr)
{ {
auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get()); auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get());
csUIElementOnClicked(eventData->data->EID); csUIElementOnRemoved(eventData->data->EID);
return eventData->handle; return eventData->handle;
} }
SHEventHandle SHScriptEngine::onUIElementOnHoverEntered(SHEventPtr eventPtr) SHEventHandle SHScriptEngine::onUIElementOnHoverEntered(SHEventPtr eventPtr)
{ {
auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get()); auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get());
csUIElementOnClicked(eventData->data->EID); csUIElementOnHoverEntered(eventData->data->EID);
return eventData->handle; return eventData->handle;
} }
SHEventHandle SHScriptEngine::onUIElementOnHoverExited(SHEventPtr eventPtr) SHEventHandle SHScriptEngine::onUIElementOnHoverExited(SHEventPtr eventPtr)
{ {
auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get()); auto eventData = reinterpret_cast<const SHEventSpec<SHButtonClickEvent>*>(eventPtr.get());
csUIElementOnClicked(eventData->data->EID); csUIElementOnHoverExited(eventData->data->EID);
return eventData->handle; return eventData->handle;
} }

View File

@ -143,7 +143,7 @@ namespace SHADE
{ {
onReleasedEventMap[entity]->Invoke(); onReleasedEventMap[entity]->Invoke();
} }
SAFE_NATIVE_CALL_END("UIElement.OnClicked") SAFE_NATIVE_CALL_END("UIElement.OnReleased")
} }
void UIElement::OnHoverEntered(EntityID entity) void UIElement::OnHoverEntered(EntityID entity)
{ {
@ -153,7 +153,7 @@ namespace SHADE
{ {
onHoverEnterEventMap[entity]->Invoke(); onHoverEnterEventMap[entity]->Invoke();
} }
SAFE_NATIVE_CALL_END("UIElement.OnClicked") SAFE_NATIVE_CALL_END("UIElement.OnHoverEntered")
} }
void UIElement::OnHoverExited(EntityID entity) void UIElement::OnHoverExited(EntityID entity)
{ {
@ -163,6 +163,6 @@ namespace SHADE
{ {
onHoverExitEventMap[entity]->Invoke(); onHoverExitEventMap[entity]->Invoke();
} }
SAFE_NATIVE_CALL_END("UIElement.OnClicked") SAFE_NATIVE_CALL_END("UIElement.OnHoverExited")
} }
} }