mirror of
https://github.com/peng-zhihui/ElectronBot.git
synced 2026-10-21 22:56:26 +08:00
51 lines
917 B
C#
51 lines
917 B
C#
namespace UIWidgets
|
|
{
|
|
using UIWidgets.l10n;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
/// <summary>
|
|
/// TabIconButton.
|
|
/// </summary>
|
|
public class TabIconButtonBase : TabButton<TabIcons>
|
|
{
|
|
/// <summary>
|
|
/// The name.
|
|
/// </summary>
|
|
[SerializeField]
|
|
public TextAdapter NameAdapter;
|
|
|
|
/// <summary>
|
|
/// The icon.
|
|
/// </summary>
|
|
[SerializeField]
|
|
public Image Icon;
|
|
|
|
/// <summary>
|
|
/// The size of the set native.
|
|
/// </summary>
|
|
[SerializeField]
|
|
public bool SetNativeSize;
|
|
|
|
/// <summary>
|
|
/// Sets the data.
|
|
/// </summary>
|
|
/// <param name="tab">Tab.</param>
|
|
public override void SetData(TabIcons tab)
|
|
{
|
|
NameAdapter.text = Localization.GetTranslation(tab.Name);
|
|
|
|
if (Icon != null)
|
|
{
|
|
Icon.sprite = tab.IconDefault;
|
|
|
|
if (SetNativeSize)
|
|
{
|
|
Icon.SetNativeSize();
|
|
}
|
|
|
|
Icon.color = (Icon.sprite == null) ? Color.clear : Color.white;
|
|
}
|
|
}
|
|
}
|
|
} |