YotogiOldSkillUnit.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using MaidStatus;
  3. using UnityEngine;
  4. using Yotogis;
  5. public class YotogiOldSkillUnit : MonoBehaviour
  6. {
  7. public void Awake()
  8. {
  9. this.icon_ = UTY.GetChildObject(base.gameObject, "Icon", false).GetComponent<YotogiOldSkillIcon>();
  10. UTY.GetChildObject(base.gameObject, "levelup", false).SetActive(false);
  11. GameObject childObject = UTY.GetChildObject(base.gameObject, "Description", false);
  12. this.gauge_obj_ = UTY.GetChildObject(childObject, "Gauge", false);
  13. this.name_obj_ = UTY.GetChildObject(childObject, "Name", false);
  14. this.stargroup_obj_ = UTY.GetChildObject(childObject, "StarGroup", false);
  15. GameObject childObject2 = UTY.GetChildObject(childObject, "UnderGroup", false);
  16. this.acquired_experience_obj = UTY.GetChildObject(UTY.GetChildObject(childObject2, "AcquiredExperience", false), "Value", false);
  17. this.cost_of_hp_obj = UTY.GetChildObject(UTY.GetChildObject(childObject2, "CostOfHp", false), "Value", false);
  18. this.button_ = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIButton>();
  19. }
  20. public void SetSkillData(Maid maid, Skill.Old.Data set_skill_data, YotogiSkillData param_data)
  21. {
  22. this.maid_ = maid;
  23. this.skill_data_ = set_skill_data;
  24. this.param_data_ = param_data;
  25. this.name_obj_.GetComponent<UILabel>().text = this.skill_data_.name;
  26. this.acquired_experience_obj.GetComponent<UILabel>().text = this.skill_data_.add_yotogi_class_exp.ToString();
  27. this.cost_of_hp_obj.GetComponent<UILabel>().text = this.skill_data_.exec_need_hp.ToString();
  28. this.icon_.SetSkillData(this.skill_data_);
  29. if (0U < this.param_data_.playCount)
  30. {
  31. UTY.GetChildObject(base.gameObject, "IconNew", false).SetActive(false);
  32. }
  33. else
  34. {
  35. UTY.GetChildObject(base.gameObject, "IconNew", false).SetActive(true);
  36. }
  37. this.UpdateGage(this.param_data_.expSystem);
  38. }
  39. public void SetExpAnime(int start_total_exp, int add_exp, float anime_time)
  40. {
  41. if (anime_time <= 0f)
  42. {
  43. return;
  44. }
  45. this.result_anime_exp_system_ = (SimpleExperienceSystem)this.param_data_.expSystem.Clone();
  46. this.result_anime_exp_system_.SetTotalExp(start_total_exp + add_exp);
  47. add_exp = this.result_anime_exp_system_.GetTotalExp() - start_total_exp;
  48. if (add_exp <= 0)
  49. {
  50. return;
  51. }
  52. this.result_anime_exp_system_.SetTotalExp(start_total_exp);
  53. this.UpdateGage(this.result_anime_exp_system_);
  54. this.anime_event_ = delegate()
  55. {
  56. iTween.ValueTo(this.gameObject, iTween.Hash(new object[]
  57. {
  58. "from",
  59. start_total_exp,
  60. "to",
  61. start_total_exp + add_exp,
  62. "time",
  63. anime_time,
  64. "onupdate",
  65. "UpdateValue"
  66. }));
  67. };
  68. }
  69. public void StartAnime()
  70. {
  71. if (this.anime_event_ != null)
  72. {
  73. this.anime_event_();
  74. this.anime_event_ = null;
  75. }
  76. }
  77. public void UpdateValue(int value)
  78. {
  79. if (this.result_anime_exp_system_ == null)
  80. {
  81. return;
  82. }
  83. int currentLevel = this.result_anime_exp_system_.GetCurrentLevel();
  84. this.result_anime_exp_system_.SetTotalExp(value);
  85. if (currentLevel < this.result_anime_exp_system_.GetCurrentLevel() && !UTY.GetChildObject(base.gameObject, "levelup", false).activeSelf)
  86. {
  87. GameMain.Instance.SoundMgr.PlaySystem("SE008.ogg");
  88. UTY.GetChildObject(base.gameObject, "levelup", false).SetActive(true);
  89. }
  90. this.UpdateGage(this.result_anime_exp_system_);
  91. }
  92. public void UpdateGage(IExperienceSystem exp_system)
  93. {
  94. if (this.skill_data_ == null)
  95. {
  96. return;
  97. }
  98. int currentLevel = exp_system.GetCurrentLevel();
  99. GameObject[] array = new GameObject[3];
  100. for (int i = 0; i < array.Length; i++)
  101. {
  102. array[i] = UTY.GetChildObject(this.stargroup_obj_, "Star" + i.ToString(), false);
  103. array[i].SetActive(i <= currentLevel - 1);
  104. }
  105. float num = 0f;
  106. if (exp_system.GetNextLevelExp(currentLevel) != 0)
  107. {
  108. num = (float)exp_system.GetCurrentExp() / (float)exp_system.GetNextLevelExp(currentLevel);
  109. }
  110. if (float.IsNaN(num))
  111. {
  112. num = 0f;
  113. }
  114. else if (float.IsInfinity(num))
  115. {
  116. num = 1f;
  117. }
  118. this.gauge_obj_.GetComponent<Transform>().localScale = new Vector3(num, 1f, 1f);
  119. }
  120. public Skill.Old.Data skill_data
  121. {
  122. get
  123. {
  124. return this.skill_data_;
  125. }
  126. }
  127. public YotogiSkillData skill_param_data
  128. {
  129. get
  130. {
  131. return this.param_data_;
  132. }
  133. }
  134. private Maid maid_;
  135. private Skill.Old.Data skill_data_;
  136. private YotogiSkillData param_data_;
  137. private UIButton button_;
  138. private YotogiOldSkillIcon icon_;
  139. private GameObject gauge_obj_;
  140. private GameObject name_obj_;
  141. private GameObject stargroup_obj_;
  142. private GameObject acquired_experience_obj;
  143. private GameObject cost_of_hp_obj;
  144. private IExperienceSystem result_anime_exp_system_;
  145. private Action anime_event_;
  146. }