YotogiOldParamBasicBar.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using wf;
  6. public class YotogiOldParamBasicBar : MonoBehaviour
  7. {
  8. public virtual void Awake()
  9. {
  10. if (0 < this.bar_dic_.Count)
  11. {
  12. return;
  13. }
  14. YotogiOldParamBasicBar.BarSet barSet = new YotogiOldParamBasicBar.BarSet();
  15. barSet.min = -100;
  16. barSet.max = 300;
  17. barSet.gauge_trans = UTY.GetChildObject(base.gameObject, "Excited/GaugeGroup/Gauge", false).transform;
  18. barSet.num_label = UTY.GetChildObject(base.gameObject, "Excited/Value", false).GetComponent<UILabel>();
  19. this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Excite, barSet);
  20. YotogiOldParamBasicBar.BarSet barSet2 = new YotogiOldParamBasicBar.BarSet();
  21. barSet2.min = 0;
  22. barSet2.max = 100;
  23. barSet2.gauge_trans = UTY.GetChildObject(base.gameObject, "Mind/GaugeGroup/Gauge", false).transform;
  24. barSet2.num_label = UTY.GetChildObject(base.gameObject, "Mind/Value", false).GetComponent<UILabel>();
  25. this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Mind, barSet2);
  26. YotogiOldParamBasicBar.BarSet barSet3 = new YotogiOldParamBasicBar.BarSet();
  27. barSet3.min = 0;
  28. barSet3.max = 100;
  29. barSet3.gauge_trans = UTY.GetChildObject(base.gameObject, "Reason/GaugeGroup/Gauge", false).transform;
  30. barSet3.num_label = UTY.GetChildObject(base.gameObject, "Reason/Value", false).GetComponent<UILabel>();
  31. this.bar_dic_.Add(YotogiOldParamBasicBar.Kind.Reason, barSet3);
  32. this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Blue, new Color(0f, 0.5f, 1f));
  33. this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Red, new Color(1f, 0f, 0f));
  34. this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Yellow, new Color(1f, 1f, 0f));
  35. this.color_dic_.Add(YotogiOldParamBasicBar.GageColor.Orange, new Color(1f, 0.5f, 0f));
  36. }
  37. public void SetMaid(Maid maid)
  38. {
  39. this.maid_ = maid;
  40. }
  41. public void SetMaxMind(int max_num)
  42. {
  43. this.bar_dic_[YotogiOldParamBasicBar.Kind.Mind].max = max_num;
  44. }
  45. public void SetMaxReason(int max_num)
  46. {
  47. this.bar_dic_[YotogiOldParamBasicBar.Kind.Reason].max = max_num;
  48. }
  49. public virtual void SetCurrentExcite(int cur_num, bool is_anime)
  50. {
  51. YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Excite];
  52. barSet.num_label.text = cur_num.ToString();
  53. float num = (float)(cur_num + barSet.min * -1) / (float)barSet.max;
  54. num -= 0.333333343f;
  55. Color color;
  56. if (200 <= cur_num)
  57. {
  58. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
  59. }
  60. else if (100 <= cur_num)
  61. {
  62. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Orange];
  63. }
  64. else if (0 <= cur_num)
  65. {
  66. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Yellow];
  67. }
  68. else
  69. {
  70. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
  71. }
  72. barSet.gauge_trans.GetComponent<UISprite>().color = color;
  73. Vector3 vector = new Vector3(num, 1f, 1f);
  74. if (is_anime)
  75. {
  76. Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
  77. iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
  78. }
  79. else
  80. {
  81. barSet.gauge_trans.localScale = vector;
  82. }
  83. }
  84. public void SetCurrentMind(int cur_num, bool is_anime)
  85. {
  86. YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Mind];
  87. barSet.num_label.text = cur_num.ToString();
  88. float num = (float)cur_num / (float)barSet.max;
  89. Color color;
  90. if ((double)num <= 0.3)
  91. {
  92. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
  93. }
  94. else
  95. {
  96. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
  97. }
  98. barSet.gauge_trans.GetComponent<UISprite>().color = color;
  99. Vector3 vector = new Vector3(num, 1f, 1f);
  100. if (is_anime)
  101. {
  102. Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
  103. iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
  104. }
  105. else
  106. {
  107. barSet.gauge_trans.localScale = vector;
  108. }
  109. }
  110. public void SetCurrentReason(int cur_num, bool is_anime)
  111. {
  112. YotogiOldParamBasicBar.BarSet barSet = this.bar_dic_[YotogiOldParamBasicBar.Kind.Reason];
  113. barSet.num_label.text = cur_num.ToString();
  114. float num = (float)cur_num / (float)barSet.max;
  115. Color color;
  116. if ((double)num <= 0.3)
  117. {
  118. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Red];
  119. }
  120. else
  121. {
  122. color = this.color_dic_[YotogiOldParamBasicBar.GageColor.Blue];
  123. }
  124. barSet.gauge_trans.GetComponent<UISprite>().color = color;
  125. Vector3 vector = new Vector3(num, 1f, 1f);
  126. if (is_anime)
  127. {
  128. Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
  129. iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
  130. }
  131. else
  132. {
  133. barSet.gauge_trans.localScale = vector;
  134. }
  135. }
  136. private Dictionary<YotogiOldParamBasicBar.Kind, YotogiOldParamBasicBar.BarSet> bar_dic_ = new Dictionary<YotogiOldParamBasicBar.Kind, YotogiOldParamBasicBar.BarSet>();
  137. private Dictionary<YotogiOldParamBasicBar.GageColor, Color> color_dic_ = new Dictionary<YotogiOldParamBasicBar.GageColor, Color>();
  138. protected Maid maid_;
  139. private enum Kind
  140. {
  141. Excite,
  142. Mind,
  143. Reason
  144. }
  145. private enum GageColor
  146. {
  147. Blue,
  148. Red,
  149. Yellow,
  150. Orange
  151. }
  152. private class BarSet
  153. {
  154. public Transform gauge_trans;
  155. public UILabel num_label;
  156. public int min;
  157. public int max;
  158. }
  159. }