Fixed button click state not resetting bug #398
|
@ -5193,6 +5193,7 @@
|
||||||
Default Texture: 63979907
|
Default Texture: 63979907
|
||||||
Hovered Texture: 51379325
|
Hovered Texture: 51379325
|
||||||
Clicked Texture: 66788278
|
Clicked Texture: 66788278
|
||||||
|
current texture: 0
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 458
|
Canvas ID: 458
|
||||||
|
@ -5226,6 +5227,7 @@
|
||||||
Default Texture: 61602036
|
Default Texture: 61602036
|
||||||
Hovered Texture: 58910810
|
Hovered Texture: 58910810
|
||||||
Clicked Texture: 57786063
|
Clicked Texture: 57786063
|
||||||
|
current texture: 0
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 458
|
Canvas ID: 458
|
||||||
|
@ -5259,6 +5261,7 @@
|
||||||
Default Texture: 64806384
|
Default Texture: 64806384
|
||||||
Hovered Texture: 58347825
|
Hovered Texture: 58347825
|
||||||
Clicked Texture: 63234380
|
Clicked Texture: 63234380
|
||||||
|
current texture: 0
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 458
|
Canvas ID: 458
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace SHADE_Scripting.UI
|
||||||
return;
|
return;
|
||||||
if (tweening == true && thread != null)
|
if (tweening == true && thread != null)
|
||||||
{
|
{
|
||||||
Debug.Log("Tweening value " + thread.GetValue());
|
|
||||||
transform.LocalScale = defaultScale * thread.GetValue();
|
transform.LocalScale = defaultScale * thread.GetValue();
|
||||||
currentScale = thread.GetValue();
|
currentScale = thread.GetValue();
|
||||||
if (thread.IsCompleted())
|
if (thread.IsCompleted())
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PauseMenu : Script
|
||||||
UIElement resume = resumeBtn.GetComponent<UIElement>();
|
UIElement resume = resumeBtn.GetComponent<UIElement>();
|
||||||
if (resume != null)
|
if (resume != null)
|
||||||
{
|
{
|
||||||
resume.OnClick.RegisterAction(() =>
|
resume.OnRelease.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
if (GameManager.Instance.GamePause)
|
if (GameManager.Instance.GamePause)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ public class PauseMenu : Script
|
||||||
UIElement retry = retryBtn.GetComponent<UIElement>();
|
UIElement retry = retryBtn.GetComponent<UIElement>();
|
||||||
if (retry != null)
|
if (retry != null)
|
||||||
{
|
{
|
||||||
retry.OnClick.RegisterAction(() =>
|
retry.OnRelease.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
Audio.StopAllSounds();
|
Audio.StopAllSounds();
|
||||||
SceneManager.RestartScene();
|
SceneManager.RestartScene();
|
||||||
|
@ -75,7 +75,7 @@ public class PauseMenu : Script
|
||||||
UIElement quit = quitBtn.GetComponent<UIElement>();
|
UIElement quit = quitBtn.GetComponent<UIElement>();
|
||||||
if (quit != null)
|
if (quit != null)
|
||||||
{
|
{
|
||||||
quit.OnClick.RegisterAction(() =>
|
quit.OnRelease.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
Audio.StopAllSounds();
|
Audio.StopAllSounds();
|
||||||
//go to main menu
|
//go to main menu
|
||||||
|
|
|
@ -58,6 +58,7 @@ RTTR_REGISTRATION
|
||||||
.property("Default Texture", &SHButtonComponent::GetDefaultTexture, &SHButtonComponent::SetDefaultTexture)
|
.property("Default Texture", &SHButtonComponent::GetDefaultTexture, &SHButtonComponent::SetDefaultTexture)
|
||||||
.property("Hovered Texture", &SHButtonComponent::GetHoveredTexture, &SHButtonComponent::SetHoveredTexture)
|
.property("Hovered Texture", &SHButtonComponent::GetHoveredTexture, &SHButtonComponent::SetHoveredTexture)
|
||||||
.property("Clicked Texture", &SHButtonComponent::GetClickedTexture, &SHButtonComponent::SetClickedTexture)
|
.property("Clicked Texture", &SHButtonComponent::GetClickedTexture, &SHButtonComponent::SetClickedTexture)
|
||||||
|
.property("current texture", &SHButtonComponent::currentTexture)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SHADE
|
||||||
void SetHoveredTexture(AssetID texture) noexcept;
|
void SetHoveredTexture(AssetID texture) noexcept;
|
||||||
void SetClickedTexture(AssetID texture) noexcept;
|
void SetClickedTexture(AssetID texture) noexcept;
|
||||||
|
|
||||||
|
AssetID currentTexture;
|
||||||
|
|
||||||
friend class SHUISystem;
|
friend class SHUISystem;
|
||||||
private:
|
private:
|
||||||
|
@ -35,7 +35,7 @@ namespace SHADE
|
||||||
AssetID hoveredTexture;
|
AssetID hoveredTexture;
|
||||||
AssetID clickedTexture;
|
AssetID clickedTexture;
|
||||||
|
|
||||||
AssetID currentTexture;
|
|
||||||
|
|
||||||
|
|
||||||
RTTR_ENABLE()
|
RTTR_ENABLE()
|
||||||
|
|
|
@ -263,6 +263,11 @@ namespace SHADE
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//In case the UI was clicked but the mouse is not held down and the key up frame was missed because of active state.
|
||||||
|
if (comp.isClicked && !SHInputManager::GetKey(SHInputManager::SH_KEYCODE::LMB))
|
||||||
|
{
|
||||||
|
comp.isClicked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -318,7 +323,7 @@ namespace SHADE
|
||||||
//SHLOG_INFO("SETTING HOVERED TEXTURE")
|
//SHLOG_INFO("SETTING HOVERED TEXTURE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (textureID != 0 && textureID != comp.currentTexture)
|
if (textureID != 0 && comp.currentTexture != textureID)
|
||||||
{
|
{
|
||||||
auto material = renderable->GetModifiableMaterial();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
comp.currentTexture = textureID;
|
comp.currentTexture = textureID;
|
||||||
|
|
Loading…
Reference in New Issue