All working but codex.

This commit is contained in:
2026-05-13 14:20:25 +01:00
parent c203f836b1
commit 602e1ec0d3
49 changed files with 186784 additions and 62239 deletions

View File

@@ -15,11 +15,17 @@ namespace BriarQueen.UI.Menus.Components
IDeselectHandler
{
[Header("References")]
[SerializeField] private TextMeshProUGUI _label;
[SerializeField] protected TextMeshProUGUI _label;
private Button _button;
private UnderlineButtonGroup _group;
private bool _isHovered;
[SerializeField]
protected TextMeshProUGUI _contextLabel;
[SerializeField]
protected string _contextText;
protected Button _button;
protected UnderlineButtonGroup _group;
protected bool _isHovered;
public event Action<UnderlineButton> SelectionRequested;
public event Action<UnderlineButton> HoverEntered;
@@ -29,14 +35,15 @@ namespace BriarQueen.UI.Menus.Components
// True when this button is registered with a group
public bool IsGrouped => _group != null;
private void Awake()
protected virtual void Awake()
{
_button = GetComponent<Button>();
SetUnderline(false);
}
private void OnDisable()
protected virtual void OnDisable()
{
_isHovered = false;
SetUnderline(false);
@@ -68,6 +75,8 @@ namespace BriarQueen.UI.Menus.Components
HoverEntered?.Invoke(this);
else
RefreshStandaloneState();
UpdateContextText();
}
public void OnPointerExit(PointerEventData eventData)
@@ -78,10 +87,13 @@ namespace BriarQueen.UI.Menus.Components
HoverExited?.Invoke(this);
else
RefreshStandaloneState();
UpdateContextText();
}
public void OnPointerClick(PointerEventData eventData)
{
Debug.Log($"[UnderlineButton] OnPointerClick {gameObject.name}");
if (_button != null && !_button.interactable) return;
SelectionRequested?.Invoke(this);
}
@@ -102,6 +114,8 @@ namespace BriarQueen.UI.Menus.Components
IsSelected = true;
RefreshStandaloneState();
}
UpdateContextText();
}
public void OnDeselect(BaseEventData eventData)
@@ -115,6 +129,8 @@ namespace BriarQueen.UI.Menus.Components
IsSelected = false;
RefreshStandaloneState();
}
UpdateContextText();
}
// ── Public API ────────────────────────────────────────────────
@@ -154,5 +170,16 @@ namespace BriarQueen.UI.Menus.Components
SetUnderline(IsSelected || _isHovered);
}
private void UpdateContextText()
{
if (_contextLabel == null)
return;
if(IsSelected || _isHovered)
_contextLabel.text = _contextText;
else
_contextLabel.text = string.Empty;
}
}
}