FluctuationOfParameterUnit.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. using wf;
  5. public class FluctuationOfParameterUnit : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. this.bg_sprite_ = UTY.GetChildObject(base.gameObject, "BGGray", false).GetComponent<UISprite>();
  10. this.name_label_ = UTY.GetChildObject(base.gameObject, "Name", false).GetComponent<UILabel>();
  11. this.value_label_ = UTY.GetChildObject(base.gameObject, "Value", false).GetComponent<UILabel>();
  12. this.name_label_loc_ = this.name_label_.GetComponent<Localize>();
  13. }
  14. public void SetActive(bool value)
  15. {
  16. base.gameObject.SetActive(value);
  17. }
  18. public bool IsActive()
  19. {
  20. return base.gameObject.activeSelf;
  21. }
  22. public void SetBGVisible(bool value)
  23. {
  24. this.bg_sprite_.enabled = value;
  25. }
  26. public bool IsBGVisible()
  27. {
  28. return this.bg_sprite_.enabled;
  29. }
  30. public void SetTextName(string name)
  31. {
  32. this.name_label_.text = name;
  33. }
  34. public void SetTextNameTerm(string term)
  35. {
  36. Utility.SetLocalizeTerm(this.name_label_loc_, term, false);
  37. }
  38. public void SetTextValue(int value)
  39. {
  40. this.value_label_.text = "0";
  41. if (this.AnimeTime <= 0f)
  42. {
  43. string str = string.Empty;
  44. if (0 < value)
  45. {
  46. str += "+";
  47. }
  48. this.value_label_.text = str + value.ToString();
  49. }
  50. else
  51. {
  52. this.anime_event_ = delegate()
  53. {
  54. iTween.ValueTo(this.gameObject, iTween.Hash(new object[]
  55. {
  56. "from",
  57. 0,
  58. "to",
  59. value,
  60. "time",
  61. this.AnimeTime,
  62. "onupdate",
  63. "UpdateValue"
  64. }));
  65. };
  66. }
  67. }
  68. public void StartAnime()
  69. {
  70. if (this.anime_event_ != null)
  71. {
  72. this.anime_event_();
  73. this.anime_event_ = null;
  74. }
  75. }
  76. public void UpdateValue(int value)
  77. {
  78. string str = string.Empty;
  79. if (0 < value)
  80. {
  81. str += "+";
  82. }
  83. this.value_label_.text = str + value.ToString();
  84. }
  85. public float AnimeTime = 1f;
  86. private UISprite bg_sprite_;
  87. private UILabel name_label_;
  88. private UILabel value_label_;
  89. private Action anime_event_;
  90. private Localize name_label_loc_;
  91. }