You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System;
- using CIG.Translation;
- using UnityEngine;
- using UnityEngine.UI;
-
- namespace CIG
- {
- public class TabButtonView : MonoBehaviour
- {
- public bool IsActive
- {
- get
- {
- return this._isActive;
- }
- set
- {
- this._isActive = value;
- if (this._isActive)
- {
- this._tabBackground.sprite = this._activeTabBackgroundSprite;
- }
- else
- {
- this._tabBackground.sprite = this._inactiveTabBackgroundSprite;
- }
- }
- }
-
- public void UpdateBadge(bool isActive)
- {
- if (this._badgeObject != null)
- {
- this._badgeObject.SetActive(isActive);
- }
- }
-
- public void UpdateBadge(int amount)
- {
- if (this._badgeObject != null)
- {
- bool flag = amount > 0;
- this._badgeObject.SetActive(flag);
- if (flag)
- {
- this._badgeLabel.LocalizedString = Localization.Integer(amount);
- }
- }
- }
-
- public ILocalizedString LocalizedTitle
- {
- get
- {
- return string.IsNullOrEmpty(this._titleLocalizationKey) ? Localization.EmptyLocalizedString : Localization.Key(this._titleLocalizationKey);
- }
- }
-
- [SerializeField]
- [Header("Background")]
- private Sprite _inactiveTabBackgroundSprite;
-
- [SerializeField]
- private Sprite _activeTabBackgroundSprite;
-
- [SerializeField]
- private Image _tabBackground;
-
- [SerializeField]
- private GameObject _badgeObject;
-
- [SerializeField]
- private LocalizedText _badgeLabel;
-
- [SerializeField]
- private string _titleLocalizationKey;
-
- private bool _isActive;
- }
- }
|