PrivateMaidTouchParamBasicBar.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using wf;
  6. public class PrivateMaidTouchParamBasicBar : MonoBehaviour
  7. {
  8. public virtual void Awake()
  9. {
  10. if (0 < this.bar_dic_.Count)
  11. {
  12. return;
  13. }
  14. PrivateMaidTouchParamBasicBar.BarSet barSet = new PrivateMaidTouchParamBasicBar.BarSet();
  15. barSet.min = 0;
  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(PrivateMaidTouchParamBasicBar.Kind.Excite, barSet);
  20. PrivateMaidTouchParamBasicBar.BarSet barSet2 = new PrivateMaidTouchParamBasicBar.BarSet();
  21. barSet2.min = 0;
  22. barSet2.max = 300;
  23. barSet2.gauge_trans = UTY.GetChildObject(base.gameObject, "Mood/GaugeGroup/Gauge", false).transform;
  24. barSet2.num_label = UTY.GetChildObject(base.gameObject, "Mood/Value", false).GetComponent<UILabel>();
  25. this.bar_dic_.Add(PrivateMaidTouchParamBasicBar.Kind.Mood, barSet2);
  26. this.color_dic_.Add(PrivateMaidTouchParamBasicBar.GageColor.Blue, new Color(0f, 0.5f, 1f));
  27. this.color_dic_.Add(PrivateMaidTouchParamBasicBar.GageColor.Red, new Color(1f, 0f, 0f));
  28. this.color_dic_.Add(PrivateMaidTouchParamBasicBar.GageColor.Yellow, new Color(1f, 1f, 0f));
  29. this.color_dic_.Add(PrivateMaidTouchParamBasicBar.GageColor.Orange, new Color(1f, 0.5f, 0f));
  30. this.color_dic_.Add(PrivateMaidTouchParamBasicBar.GageColor.Pink, new Color(1f, 0f, 0.5f));
  31. }
  32. public void SetMaid(Maid maid)
  33. {
  34. this.maid_ = maid;
  35. }
  36. public virtual void SetCurrentMood(int cur_num, bool is_anime)
  37. {
  38. PrivateMaidTouchParamBasicBar.BarSet barSet = this.bar_dic_[PrivateMaidTouchParamBasicBar.Kind.Mood];
  39. barSet.num_label.text = cur_num.ToString();
  40. float x = (float)cur_num / (float)barSet.max;
  41. Color color;
  42. if (200 <= cur_num)
  43. {
  44. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Red];
  45. }
  46. else if (100 <= cur_num)
  47. {
  48. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Orange];
  49. }
  50. else if (50 <= cur_num)
  51. {
  52. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Yellow];
  53. }
  54. else
  55. {
  56. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Blue];
  57. }
  58. barSet.gauge_trans.GetComponent<UISprite>().color = color;
  59. Vector3 vector = new Vector3(x, 1f, 1f);
  60. if (is_anime)
  61. {
  62. Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
  63. iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
  64. }
  65. else
  66. {
  67. barSet.gauge_trans.localScale = vector;
  68. }
  69. }
  70. public void SetCurrentExcite(int cur_num, bool is_anime)
  71. {
  72. PrivateMaidTouchParamBasicBar.BarSet barSet = this.bar_dic_[PrivateMaidTouchParamBasicBar.Kind.Excite];
  73. barSet.num_label.text = cur_num.ToString();
  74. float num = (float)cur_num / (float)barSet.max;
  75. Color color;
  76. if ((double)num <= 0.3)
  77. {
  78. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Blue];
  79. }
  80. else
  81. {
  82. color = this.color_dic_[PrivateMaidTouchParamBasicBar.GageColor.Red];
  83. }
  84. barSet.gauge_trans.GetComponent<UISprite>().color = color;
  85. Vector3 vector = new Vector3(num, 1f, 1f);
  86. if (is_anime)
  87. {
  88. Hashtable args = TweenHash.EaseOutSine(TweenHash.Type.Scale, vector, 0.4f);
  89. iTween.ScaleTo(barSet.gauge_trans.gameObject, args);
  90. }
  91. else
  92. {
  93. barSet.gauge_trans.localScale = vector;
  94. }
  95. }
  96. private Dictionary<PrivateMaidTouchParamBasicBar.Kind, PrivateMaidTouchParamBasicBar.BarSet> bar_dic_ = new Dictionary<PrivateMaidTouchParamBasicBar.Kind, PrivateMaidTouchParamBasicBar.BarSet>();
  97. private Dictionary<PrivateMaidTouchParamBasicBar.GageColor, Color> color_dic_ = new Dictionary<PrivateMaidTouchParamBasicBar.GageColor, Color>();
  98. protected Maid maid_;
  99. private enum Kind
  100. {
  101. Excite,
  102. Mood
  103. }
  104. private enum GageColor
  105. {
  106. Blue,
  107. Red,
  108. Yellow,
  109. Orange,
  110. Pink
  111. }
  112. private class BarSet
  113. {
  114. public Transform gauge_trans;
  115. public UILabel num_label;
  116. public int min;
  117. public int max;
  118. }
  119. }