ScheduleRoomCtrl.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class ScheduleRoomCtrl : MonoBehaviour
  6. {
  7. public void Init(ScheduleMgr scheduleMgr, ScheduleCtrl scheduleCtrl, GameObject goPanel)
  8. {
  9. this.m_scheduleMgr = scheduleMgr;
  10. this.m_scheduleCtrl = scheduleCtrl;
  11. this.m_goPanel = goPanel;
  12. this.m_MaidViewer = UTY.GetChildObject(goPanel, "SelectedMaidViewer", false);
  13. }
  14. public void ClickRoomScheduleClose()
  15. {
  16. this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.Task);
  17. this.m_MaidViewer.SetActive(true);
  18. }
  19. public void CreateTaskViewer()
  20. {
  21. if (!this.m_bInit)
  22. {
  23. this.CreateRoomListInfo();
  24. this.m_bInit = true;
  25. }
  26. this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.Room);
  27. this.m_MaidViewer.SetActive(false);
  28. if (this.content_parent_grid_ == null)
  29. {
  30. this.content_parent_grid_ = UTY.GetChildObject(this.viewer, "Content/Parent", false).GetComponent<UIGrid>();
  31. }
  32. this.content_parent_grid_.repositionNow = true;
  33. this.m_goPanel.SetActive(true);
  34. this.SetSecelctRoomIndex(0);
  35. }
  36. private void CreateRoomListInfo()
  37. {
  38. this.content_parent_grid_ = UTY.GetChildObject(this.viewer, "Content/Parent", false).GetComponent<UIGrid>();
  39. this.m_listBg = ScheduleRoomCtrl.CreateBGList(true);
  40. int num = 0;
  41. foreach (ScheduleRoomCtrl.PVBInfo pvbinfo in this.m_listBg)
  42. {
  43. GameObject gameObject = Utility.CreatePrefab(this.content_parent_grid_.gameObject, "SceneDaily/Schedule/Prefab/RoomInfo", true);
  44. ScheduleRoomInfo component = gameObject.GetComponent<ScheduleRoomInfo>();
  45. component.SetData(this, num, (ScheduleRoomCtrl.BGInfo)pvbinfo);
  46. this.roomInfoList.Add(component);
  47. num++;
  48. if (num >= 12)
  49. {
  50. break;
  51. }
  52. }
  53. UIButton component2 = UTY.GetChildObject(this.viewer, "Panel/RoomSettingEnd", false).GetComponent<UIButton>();
  54. EventDelegate.Add(component2.onClick, new EventDelegate.Callback(this.ClickRoomScheduleClose));
  55. }
  56. public void CloseTask()
  57. {
  58. this.m_goPanel.SetActive(false);
  59. }
  60. public void DeleteRoomList()
  61. {
  62. if (this.roomInfoList == null)
  63. {
  64. return;
  65. }
  66. foreach (ScheduleRoomInfo scheduleRoomInfo in this.roomInfoList)
  67. {
  68. if (scheduleRoomInfo.gameObject != null)
  69. {
  70. UnityEngine.Object.Destroy(scheduleRoomInfo.gameObject);
  71. }
  72. }
  73. this.roomInfoList.Clear();
  74. }
  75. public void SetSecelctRoomIndex(int index)
  76. {
  77. this.selectRoomIndex = index;
  78. foreach (ScheduleRoomInfo scheduleRoomInfo in this.roomInfoList)
  79. {
  80. if (scheduleRoomInfo.RoomIndex == this.selectRoomIndex)
  81. {
  82. scheduleRoomInfo.SetActiveCheckMark(true);
  83. }
  84. else
  85. {
  86. scheduleRoomInfo.SetActiveCheckMark(false);
  87. }
  88. }
  89. }
  90. public static List<ScheduleRoomCtrl.PVBInfo> CreateBGList(bool is_level_check)
  91. {
  92. return new List<ScheduleRoomCtrl.PVBInfo>();
  93. }
  94. private ScheduleMgr m_scheduleMgr;
  95. private ScheduleCtrl m_scheduleCtrl;
  96. private GameObject viewer;
  97. private GameObject m_goPanel;
  98. private GameObject m_MaidViewer;
  99. private List<ScheduleRoomInfo> roomInfoList = new List<ScheduleRoomInfo>();
  100. private bool m_bInit;
  101. public List<ScheduleRoomCtrl.PVBInfo> m_listBg = new List<ScheduleRoomCtrl.PVBInfo>();
  102. private UIGrid content_parent_grid_;
  103. private int selectRoomIndex;
  104. public class BGInfo : ScheduleRoomCtrl.PVBInfo
  105. {
  106. public string strBGFileName;
  107. public Vector3 vPos;
  108. public float fRot;
  109. public string stageName;
  110. }
  111. public class PVBInfo
  112. {
  113. public string strIconName;
  114. public Texture2D texIcon;
  115. }
  116. }