MaidLikabilityCtrl.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
  55. }
  56. }
  57. else
  58. {
  59. num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F本編, false);
  60. }
  61. num = Mathf.Clamp(num, 0, 100);
  62. component2.text = data.drawName;
  63. component3.text = num.ToString();
  64. component4.fillAmount = (float)num / 100f;
  65. });
  66. UIGrid component = this.m_ListViewer.parentItemArea.GetComponent<UIGrid>();
  67. component.enabled = true;
  68. component.Reposition();
  69. UIScrollView componentInChildren = base.GetComponentInChildren<UIScrollView>();
  70. componentInChildren.ResetPosition();
  71. }
  72. private uGUIListViewer m_ListViewer;
  73. private Maid m_TargetMaid;
  74. private bool m_IsAwaked;
  75. }
  76. }