123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- 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();
- /// <summary>
- /// 选择的问题类型
- /// </summary>
- 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<IRTCService>().CreatRoom();
- this.GetService<ISignallingService>().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<IRTCService>().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();
- }
- /// <summary>
- /// 选择问题
- /// </summary>
- /// <param name="question"></param>
- 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
- }
|