ClassUnit.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System;
  2. using I2.Loc;
  3. using MaidStatus;
  4. using UnityEngine;
  5. public class ClassUnit : MonoBehaviour
  6. {
  7. public void Awake()
  8. {
  9. this.button_ = base.GetComponentInChildren<UIWFTabButton>();
  10. this.class_name_ = UTY.GetChildObject(base.gameObject, "ClassName", false).GetComponent<UILabel>();
  11. this.class_level_ = UTY.GetChildObject(base.gameObject, "Level/Value", false).GetComponent<UILabel>();
  12. EventDelegate.Add(this.button_.onSelect, new EventDelegate.Callback(this.OnSelect));
  13. this.job_class_type_ = (this.yotogi_class_type_ = int.MinValue);
  14. }
  15. public void SetOnSelectEvent(Action<ClassUnit> event_delgate)
  16. {
  17. this.select_event_ = event_delgate;
  18. }
  19. public void SetClassChangePanel(ClassChangePanel class_change_panel)
  20. {
  21. this.class_change_panel_ = class_change_panel;
  22. }
  23. public void UpdateMaidData(Maid maid)
  24. {
  25. if (this.job_class_type_ != -2147483648)
  26. {
  27. if (maid.status.jobClass.Contains(this.job_class_type_))
  28. {
  29. ClassData<JobClass.Data> classData = maid.status.jobClass.Get(this.job_class_type_);
  30. this.class_level_.text = classData.level.ToString();
  31. this.class_level_.transform.parent.gameObject.SetActive(true);
  32. }
  33. else
  34. {
  35. this.class_level_.transform.parent.gameObject.SetActive(false);
  36. }
  37. }
  38. else if (this.yotogi_class_type_ != -2147483648)
  39. {
  40. if (maid.status.yotogiClass.Contains(this.yotogi_class_type_))
  41. {
  42. ClassData<YotogiClass.Data> classData2 = maid.status.yotogiClass.Get(this.yotogi_class_type_);
  43. this.class_level_.text = classData2.level.ToString();
  44. this.class_level_.transform.parent.gameObject.SetActive(true);
  45. }
  46. else
  47. {
  48. this.class_level_.transform.parent.gameObject.SetActive(false);
  49. }
  50. }
  51. }
  52. public void SetJobClassType(int class_type)
  53. {
  54. this.yotogi_class_type_ = int.MinValue;
  55. this.job_class_type_ = class_type;
  56. JobClass.Data data = JobClass.GetData(class_type);
  57. this.class_name_.text = data.drawName;
  58. this.class_level_.text = "0";
  59. Localize component = this.class_name_.GetComponent<Localize>();
  60. if (component != null && GameUty.supportMultiLanguage)
  61. {
  62. component.SetTerm(data.termName);
  63. }
  64. }
  65. public void SetYotogiClassType(int class_type)
  66. {
  67. this.job_class_type_ = int.MinValue;
  68. this.yotogi_class_type_ = class_type;
  69. this.class_name_.text = YotogiClass.GetData(class_type).drawName;
  70. this.class_level_.text = "0";
  71. }
  72. public void UpdateInfo()
  73. {
  74. if (this.job_class_type_ != -2147483648)
  75. {
  76. this.class_change_panel_.SetInfoData(this.job_class_type_);
  77. }
  78. else if (this.yotogi_class_type_ != -2147483648)
  79. {
  80. this.class_change_panel_.SetInfoDataYotogi(this.yotogi_class_type_);
  81. }
  82. }
  83. private void OnSelect()
  84. {
  85. if (this.select_event_ != null && this.button_.isSelected)
  86. {
  87. this.select_event_(this);
  88. }
  89. }
  90. public int maid_class_type
  91. {
  92. get
  93. {
  94. return this.job_class_type_;
  95. }
  96. }
  97. public int yotogi_class_type
  98. {
  99. get
  100. {
  101. return this.yotogi_class_type_;
  102. }
  103. }
  104. public UIWFTabButton button
  105. {
  106. get
  107. {
  108. return this.button_;
  109. }
  110. }
  111. public UIWFTabPanel tab_panel
  112. {
  113. get
  114. {
  115. return this.tab_panel_;
  116. }
  117. }
  118. private Action<ClassUnit> select_event_;
  119. private UIWFTabPanel tab_panel_;
  120. private UIWFTabButton button_;
  121. private UILabel class_name_;
  122. private UILabel class_level_;
  123. private int job_class_type_;
  124. private int yotogi_class_type_;
  125. private ClassChangePanel class_change_panel_;
  126. }