SupportControl.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. this.GetService<IRTCService>().CreatRoom();
  52. LangChaoRTC.Instance.showRTC(0);
  53. ScenesManager.Instance.showWindow(ScenesManager.SceneType.RoomMain);
  54. }
  55. public void Home()
  56. {
  57. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
  58. }
  59. public void Device()
  60. {
  61. ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowDevice);
  62. }
  63. public void Nav()
  64. {
  65. }
  66. public void History()
  67. {
  68. //ShowRTC.Instance.gotoWindow(ScenesManager.SceneType.ShowRTCHistory);
  69. }
  70. private void Init()
  71. {
  72. ShowRtcTrans = new GameObject("ShowRtcTrans").transform;
  73. ShowRtcTrans.position = OpenXRCamera.Instance.head.position + new Vector3(-1, 0, 0);
  74. ShowRtcTrans.localEulerAngles = new Vector3(0, -90, 0);
  75. ShowRtcTrans.SetParent(OpenXRCamera.Instance.head);
  76. }
  77. private void OnEnable()
  78. {
  79. OnReset?.Invoke();
  80. }
  81. private void Update()
  82. {
  83. /*
  84. if (Test) return;
  85. OnReset?.Invoke();
  86. */
  87. }
  88. }