Merge branch 'develop' into fix-bug/character-sound

This commit is contained in:
VDH
2026-04-15 16:00:51 +07:00
8 changed files with 289 additions and 109 deletions
+70
View File
@@ -9,6 +9,8 @@ using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts.Task.UI;
using BrewMonster.Scripts.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using TMPro;
public class CECUIManager : MonoSingleton<CECUIManager>
@@ -366,6 +368,74 @@ public class CECUIManager : MonoSingleton<CECUIManager>
return null;
}
/// <summary>
/// Dialog names on <see cref="_uiStack"/> that are normal gameplay HUD and must NOT block world raycasts
/// (the stack always has at least <c>Win_Hpmpxp</c> after <see cref="Awake"/>).
/// </summary>
private static readonly HashSet<string> HudStackDialogNames = new HashSet<string>(StringComparer.Ordinal)
{
"Win_Hpmpxp",
};
/// <summary>
/// Returns true when a modal / non-HUD dialog is open and world clicks should be ignored.
/// </summary>
public bool IsWorldInteractionBlockedByUI()
{
if (_uiStack == null || _uiStack.Count == 0)
return false;
foreach (var name in _uiStack)
{
if (string.IsNullOrEmpty(name))
continue;
if (!HudStackDialogNames.Contains(name))
return true;
}
return false;
}
/// <summary>
/// True when the pointer hits UI that should consume the click (buttons, fields, scroll views).
/// Unlike <see cref="EventSystem.IsPointerOverGameObject"/>, full-screen Images/Text with raycast
/// but no interactive control do not block — so clicks can reach the world for NPC selection.
/// </summary>
public static bool IsPointerOverInteractiveUI()
{
var es = EventSystem.current;
if (es == null)
return false;
Vector2 pos = Input.mousePosition;
if (Input.touchCount > 0)
pos = Input.GetTouch(0).position;
var ped = new PointerEventData(es) { position = pos };
var results = new List<RaycastResult>();
es.RaycastAll(ped, results);
if (results.Count == 0)
return false;
foreach (var r in results)
{
var go = r.gameObject;
if (go == null)
continue;
if (go.GetComponentInParent<Selectable>() != null)
return true;
if (go.GetComponentInParent<TMP_InputField>() != null)
return true;
if (go.GetComponentInParent<InputField>() != null)
return true;
if (go.GetComponentInParent<ScrollRect>() != null)
return true;
}
return false;
}
// public CDlgMessageBox ShowMessageBox(MessageBoxData messageBoxData)
// {
// var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox;