MaidPropensitysCtrl.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using MaidStatus;
  3. using UnityEngine;
  4. using wf;
  5. namespace Kasizuki
  6. {
  7. public class MaidPropensitysCtrl : NGUIWindow, IStatusCtrl<Maid>
  8. {
  9. protected override void Awake()
  10. {
  11. base.Awake();
  12. this.m_ListViewer = base.GetComponent<uGUIListViewer>();
  13. this.m_IsAwaked = true;
  14. }
  15. public void SetData(Maid maid)
  16. {
  17. if (maid == null)
  18. {
  19. NDebug.Warning("情報を表示するメイドにnullが指定されました。");
  20. return;
  21. }
  22. this.m_TargetMaid = maid;
  23. this.UpdateNGUILabel();
  24. }
  25. public void UpdateMaidInfo()
  26. {
  27. if (this.m_TargetMaid == null)
  28. {
  29. NDebug.Warning("情報を表示するメイドがnullでした。SetMaid( Maid )関数で、情報を表示するメイドを指定してください。");
  30. return;
  31. }
  32. this.UpdateNGUILabel();
  33. }
  34. private void UpdateNGUILabel()
  35. {
  36. if (!this.m_IsAwaked)
  37. {
  38. base.gameObject.SetActive(true);
  39. }
  40. Maid targetMaid = this.m_TargetMaid;
  41. Status status = targetMaid.status;
  42. Propensity.Data[] propensitys = status.propensitys.GetValueArray();
  43. this.m_ListViewer.Show<Transform>(propensitys.Length, delegate(int index, Transform item)
  44. {
  45. Propensity.Data data = propensitys[index];
  46. UILabel componentInChildren2 = item.GetComponentInChildren<UILabel>();
  47. componentInChildren2.text = data.drawName;
  48. Utility.SetLocalizeTerm(componentInChildren2, data.termName, false);
  49. });
  50. UIGrid component = this.m_ListViewer.parentItemArea.GetComponent<UIGrid>();
  51. component.enabled = true;
  52. component.Reposition();
  53. UIScrollView componentInChildren = base.GetComponentInChildren<UIScrollView>();
  54. componentInChildren.ResetPosition();
  55. }
  56. private uGUIListViewer m_ListViewer;
  57. private Maid m_TargetMaid;
  58. private bool m_IsAwaked;
  59. }
  60. }