StageOldUnitCircle.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System;
  2. using UnityEngine;
  3. public class StageOldUnitCircle : MonoBehaviour
  4. {
  5. public void Awake()
  6. {
  7. this.btn_ = UTY.GetChildObject(base.gameObject, "Parent", false).GetComponent<UIButton>();
  8. this.over_image_ = UTY.GetChildObject(this.btn_.gameObject, "OverImage", false).GetComponent<UISprite>();
  9. this.name_label_ = UTY.GetChildObject(this.over_image_.gameObject, "Name", false).GetComponent<UILabel>();
  10. this.over_image_.alpha = 0f;
  11. EventDelegate.Add(base.GetComponentInChildren<UIButton>().onClick, new EventDelegate.Callback(this.OnClick));
  12. this.anime_ = base.gameObject.AddComponent<Animation>();
  13. this.anime_.playAutomatically = false;
  14. AnimationClip @in = this.In;
  15. bool legacy = true;
  16. this.Out.legacy = legacy;
  17. @in.legacy = legacy;
  18. this.anime_.AddClip(this.In, "In");
  19. this.anime_.AddClip(this.Out, "Out");
  20. }
  21. public void SetOnSelectEvent(Action<StageOldUnitCircle> call_back)
  22. {
  23. this.on_select_event_ = call_back;
  24. }
  25. public void SetOnFinishAnimeEvent(Action<StageOldUnitCircle> call_back)
  26. {
  27. this.on_finish_anime_event_ = call_back;
  28. }
  29. public void SetStageData(YotogiOld.StageData stage_data)
  30. {
  31. bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
  32. this.stage_data_ = stage_data;
  33. this.btn_.normalSprite = ((!isDaytime) ? this.stage_data_.thumbnail_name_night : this.stage_data_.thumbnail_name);
  34. this.name_label_.text = this.stage_data_.draw_name;
  35. }
  36. public void SetStageSpotData(YotogiOld.StageData stage_data, int spot_no)
  37. {
  38. this.stage_data_ = stage_data;
  39. this.spot_no_ = spot_no;
  40. YotogiOld.StageData.SpotData spotData = this.stage_data_.spot_data[this.spot_no_];
  41. bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
  42. this.btn_.normalSprite = ((!isDaytime) ? spotData.thumbnail_name_night : spotData.thumbnail_name_daytime);
  43. this.name_label_.text = spotData.name;
  44. }
  45. public void PlayAnimeFadeOut()
  46. {
  47. this.anime_.Play("Out");
  48. }
  49. public void PlayAnimeFadeIn()
  50. {
  51. this.anime_.Play("In");
  52. }
  53. public void OnHoverOver()
  54. {
  55. this.over_image_.alpha = 1f;
  56. }
  57. public void OnHoverOut()
  58. {
  59. this.over_image_.alpha = 0f;
  60. }
  61. public void OnClick()
  62. {
  63. if (this.anime_.isPlaying)
  64. {
  65. return;
  66. }
  67. if (this.on_select_event_ != null)
  68. {
  69. this.on_select_event_(this);
  70. }
  71. }
  72. public void OnAnimeEndOfChange()
  73. {
  74. if (this.on_finish_anime_event_ != null)
  75. {
  76. this.on_finish_anime_event_(this);
  77. }
  78. }
  79. public YotogiOld.StageData stage_data
  80. {
  81. get
  82. {
  83. return this.stage_data_;
  84. }
  85. }
  86. public int spot_no
  87. {
  88. get
  89. {
  90. return this.spot_no_;
  91. }
  92. }
  93. private YotogiOld.StageData stage_data_;
  94. private int spot_no_;
  95. private Action<StageOldUnitCircle> on_select_event_;
  96. private Action<StageOldUnitCircle> on_finish_anime_event_;
  97. private UIButton btn_;
  98. private UISprite over_image_;
  99. private UILabel name_label_;
  100. private Animation anime_;
  101. [SerializeField]
  102. private AnimationClip In;
  103. [SerializeField]
  104. private AnimationClip Out;
  105. }