YotogiParamBasicBar.cs 5.2 KB

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