|
- using System;
- using CIG.Translation;
- using CIGEnums;
- using SUISS.Core;
- using UnityEngine;
-
- public class GenericPopupState : PopupBaseState
- {
- public override void Enter(State oldState)
- {
- base.Enter(oldState);
- this.overlayDismisses = true;
- }
-
- public void GreenButton()
- {
- base.ClosePopup(delegate()
- {
- if (this._greenButtonAction != null)
- {
- this._greenButtonAction();
- }
- });
- }
-
- public void RedButton()
- {
- base.ClosePopup(delegate()
- {
- if (this._redButtonAction != null)
- {
- this._redButtonAction();
- }
- });
- }
-
- public void CloseButton()
- {
- base.ClosePopup(this._closeAction);
- }
-
- public void UpdateInfo(Sprite icon, ILocalizedString title, ILocalizedString bodyText, ILocalizedString greenText, ILocalizedString redText, Action greenButtonAction, Action redButtonAction, Action closeAction, bool dismissable)
- {
- this._redButtonAction = redButtonAction;
- this._greenButtonAction = greenButtonAction;
- this._closeAction = closeAction;
- ((GenericPopupView)this.View).UpdateInfo(icon, title, bodyText, greenText, redText, dismissable);
- }
-
- public void UpdateInfo(UISpriteType spriteType, ILocalizedString title, ILocalizedString bodyText, ILocalizedString greenText, ILocalizedString redText, Action greenButtonAction, Action redButtonAction, Action closeAction, bool dismissable)
- {
- this.UpdateInfo(SingletonMonobehaviour<UISpriteAssetCollection>.Instance.GetAsset(spriteType), title, bodyText, greenText, redText, greenButtonAction, redButtonAction, closeAction, dismissable);
- }
-
- public void SetBottomSprite(SpriteRenderer bottomRenderer)
- {
- ((GenericPopupView)this.View).SetBottomSprite(bottomRenderer);
- }
-
- protected override void DismissPopup()
- {
- if (((GenericPopupView)this.View).Dismissable)
- {
- base.ClosePopup(this._closeAction);
- }
- }
-
- private Action _greenButtonAction;
-
- private Action _redButtonAction;
-
- private Action _closeAction;
-
- public bool overlayDismisses = true;
- }
|