YotogiParamBasicBar.cs 4.8 KB

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