SupportControl.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using Blue;
  4. using TMPro;
  5. using UnityEngine.Events;
  6. public class SupportControl : AbstractController
  7. {
  8. public bool Test = false;
  9. [SerializeField] private Button Titile_Btn;
  10. [SerializeField] private Toggle ShowHide_Toggle;
  11. [SerializeField] private Button UserList_Btn;
  12. [SerializeField] private Button ShowRtcHistory_Btn;
  13. private Transform ShowRtcTrans;
  14. private FontStyle FontStyleB = FontStyle.Bold;
  15. private FontStyle FontStyleN = FontStyle.Normal;
  16. [SerializeField] private TextMeshProUGUI UserList_Text;
  17. [SerializeField] private TextMeshProUGUI ShowRtcHistory_Text;
  18. private Color colorBlue = new Color32(25,107,255,255);
  19. private Color colorWhite = new Color32(255,255,255,255);
  20. public UnityEvent OnReset = new UnityEvent();
  21. void Awake()
  22. {
  23. #if UNITY_EDITOR
  24. Test = true;
  25. #endif
  26. Init();
  27. Titile_Btn.onClick.AddListener(() =>
  28. {
  29. transform.position = ShowRtcTrans.position;
  30. Quaternion ang = Quaternion.LookRotation(OpenXRCamera.Instance.head.position - transform.position);
  31. transform.rotation = ang;
  32. transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, transform.localEulerAngles.y + 180f, transform.localEulerAngles.z);
  33. });
  34. UserList_Btn.onClick.AddListener(()=>
  35. {
  36. UserList_Text.fontStyle = (FontStyles)FontStyleB;
  37. ShowRtcHistory_Text.fontStyle = (FontStyles)FontStyleN;
  38. UserList_Text.color = colorBlue;
  39. ShowRtcHistory_Text.color = Color.white;
  40. });
  41. ShowRtcHistory_Btn.onClick.AddListener(()=>
  42. {
  43. UserList_Text.fontStyle = (FontStyles)FontStyleN;
  44. ShowRtcHistory_Text.fontStyle = (FontStyles)FontStyleB;
  45. UserList_Text.color = Color.white;
  46. ShowRtcHistory_Text.color = colorBlue;
  47. });
  48. }
  49. public void showRTC()
  50. {
  51. LangChaoRTC.Instance.showRTC(0);
  52. ScenesManager.Instance.showWindow(ScenesManager.SceneType.RoomMain);
  53. }
  54. public void Home()
  55. {
  56. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
  57. }
  58. public void Device()
  59. {
  60. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowDevice);
  61. }
  62. public void Nav()
  63. {
  64. }
  65. public void History()
  66. {
  67. //ShowRTC.Instance.gotoWindow(ScenesManager.SceneType.ShowRTCHistory);
  68. }
  69. private void Init()
  70. {
  71. ShowRtcTrans = new GameObject("ShowRtcTrans").transform;
  72. ShowRtcTrans.position = OpenXRCamera.Instance.head.position + new Vector3(-1, 0, 0);
  73. ShowRtcTrans.localEulerAngles = new Vector3(0, -90, 0);
  74. ShowRtcTrans.SetParent(OpenXRCamera.Instance.head);
  75. }
  76. private void OnEnable()
  77. {
  78. OnReset?.Invoke();
  79. }
  80. private void Update()
  81. {
  82. /*
  83. if (Test) return;
  84. OnReset?.Invoke();
  85. */
  86. }
  87. }