JinRuRenwu.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using XRTool.Util;
  6. public class JinRuRenwu : MonoBehaviour
  7. {
  8. public GameObject TaskGo;
  9. public GameObject PaiZhaoGo;
  10. public GameObject Video;
  11. public GameObject Model;
  12. public GameObject Image;
  13. public GameObject Text;
  14. public List<GameObject> updateList;
  15. public GameObject kong;
  16. private void OnEnable()
  17. {
  18. //RoadManager.Instance.gameObject.SetActive(true);
  19. updateListRef();
  20. TimerMgr.Instance.CreateTimer(()=> {
  21. kong.SetActive(!kong.activeSelf);
  22. },0.01f,6);
  23. }
  24. private void OnDisable()
  25. {
  26. //RoadManager.Instance.gameObject.SetActive(false);
  27. }
  28. public void showAll()
  29. {
  30. Text.SetActive(true);
  31. Image.SetActive(true);
  32. Model.SetActive(true);
  33. Video.SetActive(true);
  34. PaiZhaoGo.SetActive(true);
  35. }
  36. public void showText()
  37. {
  38. Text.SetActive(!Text.activeSelf);
  39. Text.transform.SetAsFirstSibling();
  40. }
  41. public void showImage()
  42. {
  43. Image.SetActive(!Image.activeSelf);
  44. Text.transform.SetAsFirstSibling();
  45. }
  46. public void showModel()
  47. {
  48. Model.SetActive(!Model.activeSelf);
  49. Text.transform.SetAsFirstSibling();
  50. }
  51. public void showVideo()
  52. {
  53. Video.SetActive(!Video.activeSelf);
  54. Text.transform.SetAsFirstSibling();
  55. }
  56. public void GotoPaiZhao()
  57. {
  58. PaiZhaoGo.SetActive(!PaiZhaoGo.activeSelf);
  59. Text.transform.SetAsFirstSibling();
  60. }
  61. public void GotoTask()
  62. {
  63. TaskGo.SetActive(!TaskGo.activeSelf);
  64. }
  65. public void updateListRef()
  66. {
  67. for (int i = updateList.Count-1; i >=0; i--)
  68. {
  69. if ((updateList[i].GetComponent<ContentSizeFitter>()))
  70. {
  71. updateList[i].GetComponent<ContentSizeFitter>().SetLayoutVertical();
  72. updateList[i].GetComponent<ContentSizeFitter>().SetLayoutHorizontal();
  73. }
  74. if (updateList[i].GetComponent<HorizontalLayoutGroup>())
  75. {
  76. updateList[i].GetComponent<HorizontalLayoutGroup>().SetLayoutHorizontal();
  77. updateList[i].GetComponent<HorizontalLayoutGroup>().CalculateLayoutInputHorizontal();
  78. }
  79. if ((updateList[i].GetComponent<VerticalLayoutGroup>()))
  80. {
  81. updateList[i].GetComponent<VerticalLayoutGroup>().SetLayoutVertical();
  82. updateList[i].GetComponent<VerticalLayoutGroup>().CalculateLayoutInputVertical();
  83. }
  84. }
  85. }
  86. }