AttributeViewer.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using UnityEngine;
  5. public class AttributeViewer : MonoBehaviour
  6. {
  7. public void Awake()
  8. {
  9. if (this.seiheki_table_ != null)
  10. {
  11. return;
  12. }
  13. this.updateStatusInfo = false;
  14. this.seiheki_table_ = UTY.GetChildObject(base.gameObject, "Contents/Attribute/AttributeUnitParent", false).GetComponent<UITable>();
  15. List<Transform> childList = this.seiheki_table_.GetChildList();
  16. for (int i = 0; i < childList.Count; i++)
  17. {
  18. childList[i].gameObject.SetActive(false);
  19. }
  20. this.seiheki_table_.Reposition();
  21. }
  22. public void OnEnable()
  23. {
  24. this.UpdateStatusInfo();
  25. }
  26. public void UpdateStatusInfo()
  27. {
  28. this.Awake();
  29. if (this.updateStatusInfo)
  30. {
  31. return;
  32. }
  33. this.updateStatusInfo = true;
  34. Status status = GameMain.Instance.CharacterMgr.GetMaid(0).status;
  35. List<Transform> childList = this.seiheki_table_.GetChildList();
  36. for (int i = 0; i < childList.Count; i++)
  37. {
  38. childList[i].gameObject.SetActive(false);
  39. }
  40. int num = 0;
  41. foreach (Propensity.Data data in status.propensitys.GetValueArray())
  42. {
  43. if (childList.Count <= num)
  44. {
  45. break;
  46. }
  47. childList[num].gameObject.SetActive(true);
  48. UILabel componentInChildren = childList[num].gameObject.GetComponentInChildren<UILabel>();
  49. if (!(componentInChildren == null))
  50. {
  51. componentInChildren.text = data.drawName;
  52. num++;
  53. }
  54. }
  55. }
  56. private Maid maid_;
  57. private UITable seiheki_table_;
  58. private bool updateStatusInfo;
  59. }