using UnityEngine; using UnityEngine.UI; using Blue; using TMPro; using UnityEngine.Events; using Newtonsoft.Json; using LitJson; using Newtonsoft.Json.Linq; public class SupportControl : AbstractController { public bool Test = false; [SerializeField] private Button Titile_Btn; [SerializeField] private Toggle ShowHide_Toggle; [SerializeField] private Button UserList_Btn; [SerializeField] private Button ShowRtcHistory_Btn; private Transform ShowRtcTrans; private FontStyle FontStyleB = FontStyle.Bold; private FontStyle FontStyleN = FontStyle.Normal; [SerializeField] private TextMeshProUGUI UserList_Text; [SerializeField] private TextMeshProUGUI ShowRtcHistory_Text; private Color colorBlue = new Color32(25,107,255,255); private Color colorWhite = new Color32(255,255,255,255); public UnityEvent OnReset = new UnityEvent(); /// /// 选择的问题类型 /// public QuestionEnum Question; public GameObject questionPanel; public GameObject allotPanel; void Awake() { #if UNITY_EDITOR Test = true; #endif Init(); Titile_Btn.onClick.AddListener(() => { transform.position = ShowRtcTrans.position; Quaternion ang = Quaternion.LookRotation(OpenXRCamera.Instance.head.position - transform.position); transform.rotation = ang; transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, transform.localEulerAngles.y + 180f, transform.localEulerAngles.z); }); UserList_Btn.onClick.AddListener(()=> { UserList_Text.fontStyle = (FontStyles)FontStyleB; ShowRtcHistory_Text.fontStyle = (FontStyles)FontStyleN; UserList_Text.color = colorBlue; ShowRtcHistory_Text.color = Color.white; }); ShowRtcHistory_Btn.onClick.AddListener(()=> { UserList_Text.fontStyle = (FontStyles)FontStyleN; ShowRtcHistory_Text.fontStyle = (FontStyles)FontStyleB; UserList_Text.color = Color.white; ShowRtcHistory_Text.color = colorBlue; }); Question = QuestionEnum.NetWork; } public void showRTC() { this.GetService().CreatRoom(); this.GetService().GetContacts(); //ShowRTC.Instance.gotoWindow(ScenesManager.SceneType.ShowRTCRoomMain); } public void showRTC_Old() { LangChaoRTC.Instance.showRTC(0); ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowRoom); ShowRoom.Instance.gotoWindow(ScenesManager.SceneType.RoomMain); } public void Home() { if (allotPanel.gameObject.activeSelf) LeaveRoom(); InitPanel(true); ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose); } public void Device() { ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowDevice); } public void Nav() { } public void History() { //ShowRTC.Instance.gotoWindow(ScenesManager.SceneType.ShowRTCHistory); } public void ApplyingForAssistance() { // 如果在房间 直接申请远程协助 // 否则直接创建 switch (RTCRoomManager.Instance.rtcState) { case RTCEnum.OFF: this.GetService().CreatRoom(); break; case RTCEnum.Online: case RTCEnum.ExpertOnline: case RTCEnum.ConterlOnline: case RTCEnum.ALLOnline: RTCRoomManager.Instance.OnLocalUserJoined(); break; default: break; } } public void LeaveRoom() { RTCRoomManager.Instance.LeaveChannel(); } /// /// 选择问题 /// /// public void SettingQuest(int question) { this.Question = (QuestionEnum)question; RTCRoomManager.Instance.question = this.Question; } private void Init() { ShowRtcTrans = new GameObject("ShowRtcTrans").transform; ShowRtcTrans.position = OpenXRCamera.Instance.head.position + new Vector3(-1, 0, 0); ShowRtcTrans.localEulerAngles = new Vector3(0, -90, 0); ShowRtcTrans.SetParent(OpenXRCamera.Instance.head); } private void OnEnable() { OnReset?.Invoke(); InitPanel(true); } private void Update() { /* if (Test) return; OnReset?.Invoke(); */ } private void OnDisable() { } private void InitPanel(bool state) { questionPanel.SetActive(state); allotPanel.SetActive(!state); } } public enum QuestionEnum { NetWork =1, Host=2, Storage=3 }