MaidPropensitysCtrl.cs 1.7 KB

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