ClassUnit.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System;
  2. using MaidStatus;
  3. using UnityEngine;
  4. using wf;
  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. Utility.SetLocalizeTerm(this.class_name_, data.termName, false);
  60. }
  61. public void SetYotogiClassType(int class_type)
  62. {
  63. this.job_class_type_ = int.MinValue;
  64. this.yotogi_class_type_ = class_type;
  65. this.class_name_.text = YotogiClass.GetData(class_type).drawName;
  66. this.class_level_.text = "0";
  67. }
  68. public void UpdateInfo()
  69. {
  70. if (this.job_class_type_ != -2147483648)
  71. {
  72. this.class_change_panel_.SetInfoData(this.job_class_type_);
  73. }
  74. else if (this.yotogi_class_type_ != -2147483648)
  75. {
  76. this.class_change_panel_.SetInfoDataYotogi(this.yotogi_class_type_);
  77. }
  78. }
  79. private void OnSelect()
  80. {
  81. if (this.select_event_ != null && this.button_.isSelected)
  82. {
  83. this.select_event_(this);
  84. }
  85. }
  86. public int maid_class_type
  87. {
  88. get
  89. {
  90. return this.job_class_type_;
  91. }
  92. }
  93. public int yotogi_class_type
  94. {
  95. get
  96. {
  97. return this.yotogi_class_type_;
  98. }
  99. }
  100. public UIWFTabButton button
  101. {
  102. get
  103. {
  104. return this.button_;
  105. }
  106. }
  107. public UIWFTabPanel tab_panel
  108. {
  109. get
  110. {
  111. return this.tab_panel_;
  112. }
  113. }
  114. private Action<ClassUnit> select_event_;
  115. private UIWFTabPanel tab_panel_;
  116. private UIWFTabButton button_;
  117. private UILabel class_name_;
  118. private UILabel class_level_;
  119. private int job_class_type_;
  120. private int yotogi_class_type_;
  121. private ClassChangePanel class_change_panel_;
  122. }