26 lines
722 B
C#
26 lines
722 B
C#
using SharpUI.Source.Common.Util.Extensions;
|
|
using UnityEngine;
|
|
|
|
namespace SharpUI.Source.Common.UI.Elements.Button
|
|
{
|
|
public class TabButton : RectButton
|
|
{
|
|
[SerializeField] public GameObject content;
|
|
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
|
|
GetEventListener().ObserveOnSelected().SubscribeWith(this,
|
|
_ => SetContentVisibility(true));
|
|
GetEventListener().ObserveOnDeselected().SubscribeWith(this,
|
|
_ => SetContentVisibility(false));
|
|
}
|
|
|
|
private void SetContentVisibility(bool visible)
|
|
{
|
|
if (content != null)
|
|
content.SetActive(visible);
|
|
}
|
|
}
|
|
} |