|
- using System;
- using System.Diagnostics;
- using CIG.Translation;
- using SUISSEngine;
- using UnityEngine;
-
- public class HUDConfirmState : State
- {
- //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public event HUDConfirmState.ButtonClickHandler OKEvent;
-
- //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public event HUDConfirmState.ButtonClickHandler CancelEvent;
-
- //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public event HUDConfirmState.ButtonClickHandler FlipEvent;
-
- //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
- public event HUDConfirmState.ButtonClickHandler InstantEvent;
-
- private void OnDestroy()
- {
- this.CancelEvent = (this.OKEvent = (this.FlipEvent = (this.InstantEvent = null)));
- }
-
- public override void Enter(State oldState)
- {
- base.Enter(oldState);
- ((HUDConfirmView)this.View).SetFlipButtonVisible(false);
- ((HUDConfirmView)this.View).HideHint();
- HUDState hudstate = UnityEngine.Object.FindObjectOfType<HUDState>();
- if (hudstate != null)
- {
- hudstate.ConfirmStateEntered();
- }
- }
-
- public override void Leave(State newState, bool closeView)
- {
- base.Leave(newState, closeView);
- this.CancelEvent = (this.OKEvent = (this.FlipEvent = (this.InstantEvent = null)));
- }
-
- public void ShowFlipButton()
- {
- ((HUDConfirmView)this.View).SetFlipButtonVisible(true);
- }
-
- public void OKClicked()
- {
- bool flag = true;
- if (this.OKEvent != null)
- {
- flag = this.OKEvent();
- }
- if (flag)
- {
- this._fsm.SwitchState<HUDState>();
- }
- }
-
- public void CancelClicked()
- {
- bool flag = true;
- if (this.CancelEvent != null)
- {
- flag = this.CancelEvent();
- }
- if (flag)
- {
- this._fsm.SwitchState<HUDState>();
- }
- }
-
- public void FlipClicked()
- {
- bool flag = true;
- if (this.FlipEvent != null)
- {
- flag = this.FlipEvent();
- }
- if (flag)
- {
- this._fsm.SwitchState<HUDState>();
- }
- }
-
- public void InstantClicked()
- {
- bool flag = true;
- if (this.InstantEvent != null)
- {
- flag = this.InstantEvent();
- }
- if (flag)
- {
- this._fsm.SwitchState<HUDState>();
- }
- }
-
- public void SetHintText(ILocalizedString text)
- {
- ((HUDConfirmView)this.View).SetHintText(text);
- }
-
- public void SetImmediateCost(Currencies cost)
- {
- this.ImmediateCost = cost;
- ((HUDConfirmView)this.View).UpdateImmediateCost((!(cost == null)) ? new decimal?(cost.GetValue("Gold")) : null);
- }
-
- public Currencies ImmediateCost { get; protected set; }
-
- public override bool IsHUDState
- {
- get
- {
- return true;
- }
- }
-
- public delegate bool ButtonClickHandler();
- }
|