Implement browser tabs.

This commit is contained in:
2023-11-11 11:54:52 +08:00
parent c05b771425
commit 166478e4bb
5 changed files with 64 additions and 588 deletions

View File

@@ -1,13 +1,31 @@
using System;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Cryville.Crtr.Browsing.UI {
[RequireComponent(typeof(BrowserTabLayout))]
[RequireComponent(typeof(CanvasGroup))]
internal class BrowserTab : MonoBehaviour, IPointerClickHandler {
[SerializeField]
Image m_icon;
[SerializeField]
TextMeshProUGUI m_text;
[SerializeField]
float m_deselectedAlpha = 0.6f;
public event Action<BrowserTab> Clicked;
public Sprite Icon {
get { return m_icon.sprite; }
set { m_icon.sprite = value; }
}
public string Text {
get { return m_text.text; }
set { m_text.text = value; }
}
bool m_selected;
public bool Selected {
get { return m_selected; }
@@ -31,7 +49,7 @@ namespace Cryville.Crtr.Browsing.UI {
}
public void OnPointerClick(PointerEventData eventData) {
throw new System.NotImplementedException();
Clicked?.Invoke(this);
}
}
}