Moved UIRoutines call order. Call FinalizeChanges. Fixed UI Button Events. #359
|
@ -11,13 +11,14 @@ public class ChangeSceneButton : Script
|
|||
UIElement ui = GetComponent<UIElement>();
|
||||
if (ui != null)
|
||||
{
|
||||
ui.OnClick.RegisterAction(() =>
|
||||
ui.OnHoverEnter.RegisterAction(() =>
|
||||
{
|
||||
Debug.Log("C# Hover Enter");
|
||||
if (sceneID != 0)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
SceneManager.ChangeScene(sceneID);
|
||||
Audio.StopAllSounds();
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//SceneManager.ChangeScene(sceneID);
|
||||
//Audio.StopAllSounds();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -204,6 +204,7 @@ namespace SHADE
|
|||
SHButtonClickEvent clickEvent;
|
||||
clickEvent.EID = comp.GetEID();
|
||||
SHEventManager::BroadcastEvent(clickEvent, SH_BUTTON_HOVER_ENTER_EVENT);
|
||||
SHLOG_INFO("C++ BROADCASTED HOVER ENTER EVENT EID: {}", clickEvent.EID);
|
||||
}
|
||||
comp.isHovered = true;
|
||||
|
||||
|
@ -313,6 +314,7 @@ namespace SHADE
|
|||
auto material = renderable->GetModifiableMaterial();
|
||||
comp.currentTexture = textureID;
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
||||
loadTexture = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,6 +369,7 @@ namespace SHADE
|
|||
auto material = renderable->GetModifiableMaterial();
|
||||
comp.currentTexture = textureID;
|
||||
material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(textureID));
|
||||
loadTexture = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -390,6 +393,11 @@ namespace SHADE
|
|||
if (SHSceneManager::CheckNodeAndComponentsActive<SHToggleButtonComponent>(comp.GetEID()))
|
||||
system->UpdateToggleButtonComponent(comp);
|
||||
}
|
||||
if (system->loadTexture == true)
|
||||
{
|
||||
system->loadTexture = false;
|
||||
SHResourceManager::FinaliseChanges();
|
||||
}
|
||||
}
|
||||
|
||||
SHVec2 SHUISystem::CanvasToScreenPoint(SHVec2& const canvasPoint, bool normalized) noexcept
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace SHADE
|
|||
|
||||
|
||||
private:
|
||||
bool loadTexture{false};
|
||||
|
||||
void UpdateUIComponent(SHUIComponent& comp) noexcept;
|
||||
void UpdateButtonComponent(SHButtonComponent& comp) noexcept;
|
||||
void UpdateToggleButtonComponent(SHToggleButtonComponent& comp) noexcept;
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Return the event
|
||||
return onClickEventMap[owner.EntityId];
|
||||
return onReleasedEventMap[owner.EntityId];
|
||||
}
|
||||
CallbackEvent^ UIElement::OnHoverEnter::get()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue