|
- using System;
- using CIG.Translation;
- using UnityEngine;
- using UnityEngine.UI;
-
- public class GenericPopupView : PopupBaseView
- {
- public bool Dismissable { get; private set; }
-
- public override void OnBlackOverlayClicked()
- {
- if (this.Dismissable && (this.State as GenericPopupState).overlayDismisses)
- {
- base.OnBlackOverlayClicked();
- }
- }
-
- public void OnGreenButtonClicked()
- {
- if (!base.PopupState.Closed)
- {
- ((GenericPopupState)this.State).GreenButton();
- }
- }
-
- public void OnRedButtonClicked()
- {
- if (!base.PopupState.Closed)
- {
- ((GenericPopupState)this.State).RedButton();
- }
- }
-
- public override void OnCloseClicked()
- {
- ((GenericPopupState)this.State).CloseButton();
- base.OnCloseClicked();
- }
-
- public void UpdateInfo(Sprite icon, ILocalizedString title, ILocalizedString bodyText, ILocalizedString greenText, ILocalizedString redText, bool dismissable)
- {
- this.Dismissable = dismissable;
- this._iconBottomSprite.gameObject.SetActive(false);
- this._titleLabel.gameObject.SetActive(title != null && title != Localization.EmptyLocalizedString);
- this._titleLabel.LocalizedString = title;
- this._bodyLabel.LocalizedString = bodyText;
- this._iconBackground.SetActive(icon != null);
- this._iconSprite.gameObject.SetActive(icon != null);
- this._iconSprite.sprite = icon;
- bool flag = greenText != null && greenText != Localization.EmptyLocalizedString;
- bool flag2 = redText != null && redText != Localization.EmptyLocalizedString;
- this._greenButton.gameObject.SetActive(flag);
- if (flag)
- {
- this._greenButtonLabel.LocalizedString = greenText;
- }
- this._redButton.gameObject.SetActive(flag2);
- if (flag2)
- {
- this._redButtonLabel.LocalizedString = redText;
- }
- this._closeButton.gameObject.SetActive(this.Dismissable);
- }
-
- public void SetBottomSprite(SpriteRenderer bottomRenderer)
- {
- Sprite sprite = (!(bottomRenderer.sprite == null)) ? bottomRenderer.sprite : null;
- if (sprite == null)
- {
- return;
- }
- this._iconBottomSprite.sprite = sprite;
- this._iconBottomSprite.gameObject.SetActive(true);
- }
-
- [SerializeField]
- private Button _closeButton;
-
- [SerializeField]
- private LocalizedText _titleLabel;
-
- [SerializeField]
- private LocalizedText _bodyLabel;
-
- [SerializeField]
- private GameObject _iconBackground;
-
- [SerializeField]
- private Image _iconSprite;
-
- [SerializeField]
- private Image _iconBottomSprite;
-
- [SerializeField]
- private Button _greenButton;
-
- [SerializeField]
- private LocalizedText _greenButtonLabel;
-
- [SerializeField]
- private Button _redButton;
-
- [SerializeField]
- private LocalizedText _redButtonLabel;
- }
|