Implement drafted new UI.
This commit is contained in:
37
Assets/Cryville/Crtr/Browsing/UI/BrowserTab.cs
Normal file
37
Assets/Cryville/Crtr/Browsing/UI/BrowserTab.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user