Handle hide option panel

This commit is contained in:
HungDK
2026-02-26 09:18:57 +07:00
parent 6db18f3013
commit 76e5c44e39
@@ -101,8 +101,9 @@ namespace BrewMonster.UI
panelRoot.pivot = new Vector2(0, 1);
}
void Update()
public override void Update()
{
base.Update();
if (!m_bShow) return;
if (Input.GetKeyDown(KeyCode.Escape))
{
@@ -111,7 +112,7 @@ namespace BrewMonster.UI
}
if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && panelRoot != null)
{
var canvas = panelRoot.GetComponentInParent<Canvas>();
var canvas = GetComponentInParent<Canvas>();
Camera cam = canvas != null && canvas.renderMode == RenderMode.ScreenSpaceCamera ? canvas.worldCamera : null;
if (!RectTransformUtility.RectangleContainsScreenPoint(panelRoot, Input.mousePosition, cam))
Show(false);