38 lines
884 B
C#
38 lines
884 B
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
namespace Cryville.Crtr.Browsing.UI {
|
|
[RequireComponent(typeof(BrowserTabLayout))]
|
|
[RequireComponent(typeof(CanvasGroup))]
|
|
internal class BrowserTab : MonoBehaviour, IPointerClickHandler {
|
|
[SerializeField]
|
|
float m_deselectedAlpha = 0.6f;
|
|
|
|
bool m_selected;
|
|
public bool Selected {
|
|
get { return m_selected; }
|
|
set {
|
|
if (m_selected == value) return;
|
|
m_selected = value;
|
|
UpdateSelected();
|
|
}
|
|
}
|
|
void UpdateSelected() {
|
|
_group.alpha = Selected ? 1 : m_deselectedAlpha;
|
|
_layout.Selected = Selected;
|
|
}
|
|
|
|
CanvasGroup _group;
|
|
BrowserTabLayout _layout;
|
|
void Awake() {
|
|
_group = GetComponent<CanvasGroup>();
|
|
_layout = GetComponent<BrowserTabLayout>();
|
|
UpdateSelected();
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData) {
|
|
throw new System.NotImplementedException();
|
|
}
|
|
}
|
|
}
|