YotogiParamBasicBar.cs 5.3 KB

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