EditViewReset.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using UnityEngine;
  3. public class EditViewReset : MonoBehaviour
  4. {
  5. private void Awake()
  6. {
  7. this.m_goViewReset = UTY.GetChildObject(base.gameObject, "ViewReset", false);
  8. this.m_uiViewReset = this.m_goViewReset.GetComponent<UIButton>();
  9. this.m_goAutoCam = UTY.GetChildObject(base.gameObject, "AutoCam", false);
  10. this.m_uiAutoCam = this.m_goAutoCam.GetComponent<UIButton>();
  11. this.m_goEyeToCam = UTY.GetChildObject(base.gameObject, "EyeToCam", false);
  12. this.m_uiEyeToCam = this.m_goEyeToCam.GetComponent<UIButton>();
  13. EventDelegate.Add(this.m_uiViewReset.onClick, new EventDelegate.Callback(this.OnClickViewReset));
  14. EventDelegate.Add(this.m_uiAutoCam.onClick, new EventDelegate.Callback(this.OnClickAutoCam));
  15. EventDelegate.Add(this.m_uiEyeToCam.onClick, new EventDelegate.Callback(this.OnClickEyeToCam));
  16. this.UpdateAutoEyeCam();
  17. }
  18. private void Start()
  19. {
  20. if (SceneEdit.Instance.IsVRComMode)
  21. {
  22. this.m_uiAutoCam.disabledColor.a = 0.5f;
  23. this.m_uiViewReset.disabledColor = this.m_uiAutoCam.disabledColor;
  24. this.m_uiViewReset.SetState(UIButtonColor.State.Disabled, true);
  25. this.m_uiViewReset.isEnabled = false;
  26. this.m_uiAutoCam.SetState(UIButtonColor.State.Disabled, true);
  27. this.m_uiAutoCam.isEnabled = false;
  28. }
  29. }
  30. public void SetOnClickCallBack(EditViewReset.OnClick f_dgViewReset, EditViewReset.OnClick f_dgAutoCam, EditViewReset.OnClick f_dgEyeToCam)
  31. {
  32. this.m_dgOnViewReset = f_dgViewReset;
  33. this.m_dgOnAutoCam = f_dgAutoCam;
  34. this.m_dgOnEyeToCam = f_dgEyeToCam;
  35. }
  36. public void Show()
  37. {
  38. this.m_goViewReset.SetActive(true);
  39. this.m_goAutoCam.SetActive(true);
  40. this.m_goEyeToCam.SetActive(true);
  41. }
  42. public void Close()
  43. {
  44. this.m_goViewReset.SetActive(false);
  45. this.m_goAutoCam.SetActive(false);
  46. this.m_goEyeToCam.SetActive(false);
  47. }
  48. public void SetVisibleAutoCam(bool f_bVisible)
  49. {
  50. this.m_bVisibleAutoCam = f_bVisible;
  51. this.UpdateAutoEyeCam();
  52. }
  53. public bool GetVisibleAutoCam()
  54. {
  55. return this.m_bVisibleAutoCam;
  56. }
  57. public void SetVisibleEyeToCam(bool f_bVisible)
  58. {
  59. this.m_bVisibleEyeToCam = f_bVisible;
  60. this.UpdateAutoEyeCam();
  61. }
  62. public bool GetVisibleEyeToCam()
  63. {
  64. return this.m_bVisibleEyeToCam;
  65. }
  66. private void UpdateAutoEyeCam()
  67. {
  68. this.m_uiAutoCam.defaultColor = new Color(1f, 1f, 1f, (!this.m_bVisibleAutoCam) ? 0.2f : 1f);
  69. this.m_uiEyeToCam.defaultColor = new Color(1f, 1f, 1f, (!this.m_bVisibleEyeToCam) ? 0.2f : 1f);
  70. }
  71. private void OnClickViewReset()
  72. {
  73. if (this.m_dgOnViewReset != null)
  74. {
  75. this.m_dgOnViewReset();
  76. }
  77. }
  78. private void OnClickAutoCam()
  79. {
  80. if (this.m_dgOnAutoCam != null)
  81. {
  82. this.m_dgOnAutoCam();
  83. }
  84. }
  85. private void OnClickEyeToCam()
  86. {
  87. if (this.m_dgOnEyeToCam != null)
  88. {
  89. this.m_dgOnEyeToCam();
  90. }
  91. }
  92. private void Update()
  93. {
  94. }
  95. private GameObject m_goViewReset;
  96. private UIButton m_uiViewReset;
  97. private GameObject m_goAutoCam;
  98. private UIButton m_uiAutoCam;
  99. private GameObject m_goEyeToCam;
  100. private UIButton m_uiEyeToCam;
  101. private EditViewReset.OnClick m_dgOnViewReset;
  102. private EditViewReset.OnClick m_dgOnAutoCam;
  103. private EditViewReset.OnClick m_dgOnEyeToCam;
  104. private bool m_bVisibleAutoCam;
  105. private bool m_bVisibleEyeToCam;
  106. public delegate void OnClick();
  107. }