Implement browser tabs.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user