MaidLikabilityCtrl.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Kasizuki
  5. {
  6. public class MaidLikabilityCtrl : 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. KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
  40. Maid maid = this.m_TargetMaid;
  41. List<ManData.Data> manList = ManData.GetAllDatas(true, true);
  42. this.m_ListViewer.Show<Transform>(manList.Count, delegate(int index, Transform item)
  43. {
  44. ManData.Data data = manList[index];
  45. UILabel component2 = UTY.GetChildObject(item.gameObject, "Name", false).GetComponent<UILabel>();
  46. UILabel component3 = UTY.GetChildObject(item.gameObject, "Value", false).GetComponent<UILabel>();
  47. UISprite component4 = UTY.GetChildObject(item.gameObject, "Gauge/Gauge", false).GetComponent<UISprite>();
  48. int num = 0;
  49. ManDataType manType = data.manType;
  50. if (manType != ManDataType.主人公)
  51. {
  52. if (manType != ManDataType.傅き男1)
  53. {
  54. if (manType != ManDataType.傅き男2)
  55. {
  56. if (manType != ManDataType.傅き男3)
  57. {
  58. if (manType != ManDataType.傅き男4)
  59. {
  60. if (manType == ManDataType.傅き男5)
  61. {
  62. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男5, false);
  63. }
  64. }
  65. else
  66. {
  67. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男4, false);
  68. }
  69. }
  70. else
  71. {
  72. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男3, false);
  73. }
  74. }
  75. else
  76. {
  77. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男2, false);
  78. }
  79. }
  80. else
  81. {
  82. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  83. }
  84. }
  85. else
  86. {
  87. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, false);
  88. }
  89. num = Mathf.Clamp(num, 0, 100);
  90. component2.text = data.drawName;
  91. component3.text = num.ToString();
  92. component4.fillAmount = (float)num / 100f;
  93. });
  94. UIGrid component = this.m_ListViewer.parentItemArea.GetComponent<UIGrid>();
  95. component.enabled = true;
  96. component.Reposition();
  97. UIScrollView componentInChildren = base.GetComponentInChildren<UIScrollView>();
  98. componentInChildren.ResetPosition();
  99. }
  100. private uGUIListViewer m_ListViewer;
  101. private Maid m_TargetMaid;
  102. private bool m_IsAwaked;
  103. }
  104. }