ClassUnit.cs 3.1 KB

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