ScheduleRoomInfo.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ScheduleRoomInfo : MonoBehaviour
  5. {
  6. public int RoomIndex
  7. {
  8. get
  9. {
  10. return this.roomIndex;
  11. }
  12. }
  13. private void Awake()
  14. {
  15. this.panel_RoomInfo = base.gameObject.GetComponent<UIPanel>();
  16. this.sprite_CheckMark = UTY.GetChildObject(base.gameObject, "BG/Sprite_CheckMark", false).GetComponent<UISprite>();
  17. this.uitex_Thumbnail = UTY.GetChildObject(base.gameObject, "BG/Sprite_Thumbnail", false).GetComponent<UITexture>();
  18. this.label_RoomName = UTY.GetChildObject(base.gameObject, "BG/BG/Label_Name", false).GetComponent<UILabel>();
  19. this.label_RoomNumber = UTY.GetChildObject(base.gameObject, "BG/BG/Label_Number", false).GetComponent<UILabel>();
  20. this.uiButton = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UIButton>();
  21. this.grid_Rank = UTY.GetChildObject(base.gameObject, "BG/Grid_Value/Parent_Rank/Grid_Star", false).GetComponent<UIGrid>();
  22. this.grid_StaffNum = UTY.GetChildObject(base.gameObject, "BG/Grid_Value/Parent_StafNum/Grid_Star", false).GetComponent<UIGrid>();
  23. this.uiButton.onClick.Add(new EventDelegate(new EventDelegate.Callback(this.ButtonOnClick)));
  24. }
  25. private void Start()
  26. {
  27. this.SetActiveCheckMark(false);
  28. }
  29. public void SetData(ScheduleRoomCtrl scheduleRoomCtrl, int index, ScheduleRoomCtrl.BGInfo bg_info)
  30. {
  31. this.m_ScheduleRoomCtrl = scheduleRoomCtrl;
  32. this.roomIndex = index;
  33. this.bg_info = bg_info;
  34. this.uitex_Thumbnail.mainTexture = bg_info.texIcon;
  35. this.label_RoomName.text = bg_info.stageName;
  36. this.label_RoomNumber.text = (this.roomIndex + 1).ToString();
  37. this.SetStarNum(this.grid_Rank, 2);
  38. this.SetStarNum(this.grid_StaffNum, 3);
  39. }
  40. private void SetStarNum(UIGrid grid, int num)
  41. {
  42. List<Transform> childList = grid.GetChildList();
  43. int num2 = 0;
  44. foreach (Transform transform in childList)
  45. {
  46. transform.gameObject.SetActive(num2 < num);
  47. num2++;
  48. }
  49. }
  50. public void SetActiveCheckMark(bool active)
  51. {
  52. this.sprite_CheckMark.gameObject.SetActive(active);
  53. }
  54. private void ButtonOnClick()
  55. {
  56. this.m_ScheduleRoomCtrl.SetSecelctRoomIndex(this.roomIndex);
  57. }
  58. private void Update()
  59. {
  60. if (this.sprite_CheckMark.gameObject.activeSelf)
  61. {
  62. if (this.panel_RoomInfo.alpha != 1f)
  63. {
  64. this.panel_RoomInfo.alpha = 1f;
  65. }
  66. }
  67. else if (this.panel_RoomInfo.alpha != 0.75f)
  68. {
  69. this.panel_RoomInfo.alpha = 0.75f;
  70. }
  71. }
  72. private ScheduleRoomCtrl m_ScheduleRoomCtrl;
  73. private UITexture uitex_Thumbnail;
  74. private UILabel label_RoomName;
  75. private UILabel label_RoomNumber;
  76. private UISprite sprite_CheckMark;
  77. private UIPanel panel_RoomInfo;
  78. private UIButton uiButton;
  79. private UIGrid grid_Rank;
  80. private UIGrid grid_StaffNum;
  81. private ScheduleRoomCtrl.BGInfo bg_info;
  82. private int roomIndex;
  83. }