AttributeViewer.cs 1.6 KB

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