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.
 
 
 

124 lines
2.6 KiB

  1. using System;
  2. using System.Diagnostics;
  3. using CIG.Translation;
  4. using SUISSEngine;
  5. using UnityEngine;
  6. public class HUDConfirmState : State
  7. {
  8. //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
  9. public event HUDConfirmState.ButtonClickHandler OKEvent;
  10. //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
  11. public event HUDConfirmState.ButtonClickHandler CancelEvent;
  12. //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
  13. public event HUDConfirmState.ButtonClickHandler FlipEvent;
  14. //[DebuggerBrowsable(DebuggerBrowsableState.Never)]
  15. public event HUDConfirmState.ButtonClickHandler InstantEvent;
  16. private void OnDestroy()
  17. {
  18. this.CancelEvent = (this.OKEvent = (this.FlipEvent = (this.InstantEvent = null)));
  19. }
  20. public override void Enter(State oldState)
  21. {
  22. base.Enter(oldState);
  23. ((HUDConfirmView)this.View).SetFlipButtonVisible(false);
  24. ((HUDConfirmView)this.View).HideHint();
  25. HUDState hudstate = UnityEngine.Object.FindObjectOfType<HUDState>();
  26. if (hudstate != null)
  27. {
  28. hudstate.ConfirmStateEntered();
  29. }
  30. }
  31. public override void Leave(State newState, bool closeView)
  32. {
  33. base.Leave(newState, closeView);
  34. this.CancelEvent = (this.OKEvent = (this.FlipEvent = (this.InstantEvent = null)));
  35. }
  36. public void ShowFlipButton()
  37. {
  38. ((HUDConfirmView)this.View).SetFlipButtonVisible(true);
  39. }
  40. public void OKClicked()
  41. {
  42. bool flag = true;
  43. if (this.OKEvent != null)
  44. {
  45. flag = this.OKEvent();
  46. }
  47. if (flag)
  48. {
  49. this._fsm.SwitchState<HUDState>();
  50. }
  51. }
  52. public void CancelClicked()
  53. {
  54. bool flag = true;
  55. if (this.CancelEvent != null)
  56. {
  57. flag = this.CancelEvent();
  58. }
  59. if (flag)
  60. {
  61. this._fsm.SwitchState<HUDState>();
  62. }
  63. }
  64. public void FlipClicked()
  65. {
  66. bool flag = true;
  67. if (this.FlipEvent != null)
  68. {
  69. flag = this.FlipEvent();
  70. }
  71. if (flag)
  72. {
  73. this._fsm.SwitchState<HUDState>();
  74. }
  75. }
  76. public void InstantClicked()
  77. {
  78. bool flag = true;
  79. if (this.InstantEvent != null)
  80. {
  81. flag = this.InstantEvent();
  82. }
  83. if (flag)
  84. {
  85. this._fsm.SwitchState<HUDState>();
  86. }
  87. }
  88. public void SetHintText(ILocalizedString text)
  89. {
  90. ((HUDConfirmView)this.View).SetHintText(text);
  91. }
  92. public void SetImmediateCost(Currencies cost)
  93. {
  94. this.ImmediateCost = cost;
  95. ((HUDConfirmView)this.View).UpdateImmediateCost((!(cost == null)) ? new decimal?(cost.GetValue("Gold")) : null);
  96. }
  97. public Currencies ImmediateCost { get; protected set; }
  98. public override bool IsHUDState
  99. {
  100. get
  101. {
  102. return true;
  103. }
  104. }
  105. public delegate bool ButtonClickHandler();
  106. }