RoomMainForms.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. using LitJson;
  2. using SUIFW;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. using UnityEngine.Video;
  9. using XRTool.Util;
  10. public class RoomMainForms : BaseUIForms
  11. {
  12. public static RoomMainForms Instance;
  13. public static string NOUSER = "nouser";
  14. public static string userId;
  15. public bool isSendAudio = true;
  16. public bool isSendVideo = true;
  17. public bool isCloseView = true;
  18. public RawImage bigView;
  19. public RawImage selfVideo;
  20. public RawImage jieTuBG;
  21. public RectTransform TempObj;
  22. public Button selfVideoBtn;
  23. public Button uploadBtn;
  24. public Button switchBtn;
  25. public Button guaDuanBtn;
  26. public Button inviteBtn;
  27. public Button audioOpenBtn;
  28. public Button audioCloseBtn;
  29. public Button videoOpenBtn;
  30. public Button videoCloseBtn;
  31. public Text titleRoomName;
  32. public Text titleRoomNum;
  33. public Text titleRoomPeopleCount;
  34. public Button openCoordinateBtn;
  35. public Button closeCoordinateBtn;
  36. public GameObject AllUserBtn;
  37. public GameObject AllNeedHideUI;
  38. public GameObject AllNeedShowUI;
  39. public bool isOpen = false;
  40. public Text userNumText;
  41. public bool isSwithVideo = false;
  42. public GameObject UpFilePop;
  43. public Button upImageBtn;
  44. public Button upVideoBtn;
  45. public Button cancelBtn;
  46. public GameObject Invite;
  47. private void Awake()
  48. {
  49. Instance = this;
  50. WSHandler.Rtc.onRtcState += onRtcState;
  51. WSHandler.Rtc.OnChangeOwner += ChangeOwner;
  52. guaDuanBtn.onClick.AddListener(ClickOnGuaDuan);
  53. audioOpenBtn.onClick.AddListener(() => { sendAudio(true); });
  54. audioCloseBtn.onClick.AddListener(() => { sendAudio(false); });
  55. videoOpenBtn.onClick.AddListener(() => { sendVideo(true); });
  56. videoCloseBtn.onClick.AddListener(() => { sendVideo(false); });
  57. openCoordinateBtn.onClick.AddListener(ClickOnOpenCoordinate);
  58. closeCoordinateBtn.onClick.AddListener(ClickOnCloseCoordinate);
  59. switchBtn.onClick.AddListener(Swith);
  60. selfVideoBtn.onClick.AddListener(CkickOnSelfVideoBtn);
  61. upImageBtn.onClick.AddListener(CallAndroidImage);
  62. upVideoBtn.onClick.AddListener(CallAndroidVideo);
  63. cancelBtn.onClick.AddListener(ClickOnCanel);
  64. uploadBtn.onClick.AddListener(ClickOnUpFileBtn);
  65. inviteBtn.onClick.AddListener(ClickInviteBtn);
  66. }
  67. private void Start()
  68. {
  69. OpenBlack();
  70. }
  71. private void Update()
  72. {
  73. if (userId != NOUSER)
  74. {
  75. if (isOpen)
  76. {
  77. if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
  78. {
  79. Debug.Log(Input.GetTouch(0).position.x + "AAA" + Input.GetTouch(0).position.y);
  80. Debug.Log(Screen.width + "BBB" + Screen.height);
  81. string x = (Input.GetTouch(0).position.x / Screen.width).ToString();
  82. string y = ((Screen.height - Input.GetTouch(0).position.y) / Screen.height).ToString();
  83. Debug.Log(x + "CCC" + y);
  84. WSHandler.Rtc.coordinate(10000, x, y, userId);
  85. }
  86. }
  87. else
  88. {
  89. if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
  90. {
  91. Debug.Log(Input.GetTouch(0).position.x + "DDD" + Input.GetTouch(0).position.y);
  92. Debug.Log(Screen.width + "EEE" + Screen.height);
  93. string x = (Input.GetTouch(0).position.x / Screen.width).ToString();
  94. string y = ((Screen.height - Input.GetTouch(0).position.y) / Screen.height).ToString();
  95. Debug.Log(x + "FFF" + y);
  96. WSHandler.Rtc.coordinate(10001, x, y, userId);
  97. }
  98. }
  99. }
  100. }
  101. private void OnEnable()
  102. {
  103. Screen.orientation = ScreenOrientation.LandscapeLeft;
  104. }
  105. private void OnDisable()
  106. {
  107. Screen.orientation = ScreenOrientation.Portrait;
  108. }
  109. #region 窗体生命周期
  110. public override void Display()
  111. {
  112. base.Display();
  113. Init();
  114. }
  115. public override void Redisplay()
  116. {
  117. base.Redisplay();
  118. }
  119. public override void Freeze()
  120. {
  121. base.Freeze();
  122. }
  123. public override void Hiding()
  124. {
  125. base.Hiding();
  126. }
  127. #endregion
  128. public void Init()
  129. {
  130. AllNeedHideUI.SetActive(true);
  131. isSwithVideo = false;
  132. setBigView(RemoteRtc.Instance.NoUser, NOUSER);
  133. AllUserBtn.SetActive(false);
  134. if (!string.IsNullOrEmpty(RoomMainInfo.RoomOwner))
  135. {
  136. titleRoomName.text = RoomMainInfo.RoomOwner;
  137. }
  138. titleRoomPeopleCount.text = "房间人数:" + RoomMainInfo.roomPeopleNum + "/" + RoomMainInfo.roomMaxPeopleNum;
  139. userNumText.text = (RoomMainInfo.roomPeopleNum - 1).ToString();
  140. titleRoomNum.text = "房间号:" + RoomMainInfo.roomNum;
  141. AgoraVideoAudioManager.Instance.SetChinnelName(RoomMainInfo.roomNum);
  142. AgoraVideoAudioManager.Instance.JoinChannel();
  143. isSendAudio = CustomInfo.isSendAudio;
  144. isSendVideo = CustomInfo.isSendVideo;
  145. isCloseView = CustomInfo.isCloseView;
  146. if (isSendAudio)
  147. {
  148. TimerMgr.Instance.CreateTimer(() => {
  149. RemoteRtc.Instance.sendMic(true);
  150. }, 1f);
  151. }
  152. if (isSendVideo)
  153. {
  154. TimerMgr.Instance.CreateTimer(() => {
  155. RemoteRtc.Instance.startCamera();
  156. RemoteRtc.Instance.sendVideo(true);
  157. }, 1f);
  158. }
  159. change();
  160. isOpen = false;
  161. openCoordinateBtn.gameObject.SetActive(true);
  162. closeCoordinateBtn.gameObject.SetActive(false);
  163. if (RoomOtherUser.Instance)
  164. {
  165. RoomOtherUser.Instance.UpdateList();
  166. }
  167. if (RoomFile.Instance)
  168. {
  169. RoomFile.Instance.Init();
  170. }
  171. // if (UserInfo.systemDatas == null|| UserInfo.systemDatas.Camera==1)
  172. StartCoroutine(ShowLoacalVideo(2f));
  173. }
  174. IEnumerator ShowLoacalVideo( float times)
  175. {
  176. yield return new WaitForSeconds(times);
  177. AgoraVideoAudioManager.Instance.ShowLocalView(selfVideo);
  178. }
  179. public void ShowOneVideo()
  180. {
  181. // AgoraVideoAudioManager.Instance.ShowOneView(bigView);
  182. }
  183. public void ShowUserBtns()
  184. {
  185. AllUserBtn.SetActive(true);
  186. }
  187. public void HideUserBtns()
  188. {
  189. AllUserBtn.SetActive(false);
  190. }
  191. private void ChangeOwner(JsonData data)
  192. {
  193. string peerId = data["data"]["peerId"].ToString();
  194. string nickName = data["data"]["nickName"].ToString();
  195. string isCreator = data["data"]["isCreator"].ToString();
  196. if (peerId == UserInfo.UnionId && isCreator == "1")
  197. {
  198. RoomMainInfo.isCreator = "0";
  199. RoomMainInfo.RoomOwner = "用户" + nickName + "的房间";
  200. //if (FileList.Instance && RoomFile.Instance)
  201. //{
  202. // if (FileList.Instance.transform.childCount > 0)
  203. // {
  204. // RoomFile.Instance.ShowClearBtn();
  205. // }
  206. //}
  207. }
  208. titleRoomName.text = "用户" + nickName + "的房间";
  209. titleRoomPeopleCount.text = "房间人数:" + RoomMainInfo.roomPeopleNum + "/" + 10;
  210. RoomOtherUser.Instance.UpdateList();
  211. }
  212. public void setBigView(Texture tex, string id)
  213. {
  214. if (id != NOUSER)
  215. {
  216. CustomPeer cPeer = (CustomPeer)RemoteRtc.Instance.customPeerList.getPeer(id);
  217. if (cPeer.isCloseVideo || !cPeer.isVideo)
  218. {
  219. ClickOnCloseCoordinate();
  220. tex = RemoteRtc.Instance.NoView;
  221. }
  222. RoomOtherUser.ShowAction?.Invoke(id);
  223. }
  224. userId = id;
  225. // bigView.texture = tex;
  226. }
  227. private string dcetype;
  228. private void onRtcState(string str)
  229. {
  230. if (!string.IsNullOrEmpty(RoomMainInfo.RoomOwner))
  231. {
  232. titleRoomName.text = RoomMainInfo.RoomOwner;
  233. }
  234. titleRoomPeopleCount.text = "房间人数:" + RoomMainInfo.roomPeopleNum + "/" + RoomMainInfo.roomMaxPeopleNum;
  235. userNumText.text = (RoomMainInfo.roomPeopleNum - 1).ToString();
  236. titleRoomNum.text = "房间号:" + RoomMainInfo.roomNum;
  237. switch (str)
  238. {
  239. case "closeProducer":
  240. if (dcetype == "video")
  241. {
  242. RemoteRtc.Instance.me.cIdV = "";
  243. }
  244. else
  245. {
  246. RemoteRtc.Instance.me.cIdA = "";
  247. }
  248. break;
  249. }
  250. }
  251. void change()
  252. {
  253. if (isSendVideo)
  254. {
  255. videoOpenBtn.gameObject.SetActive(false);
  256. videoCloseBtn.gameObject.SetActive(true);
  257. }
  258. else
  259. {
  260. videoOpenBtn.gameObject.SetActive(true);
  261. videoCloseBtn.gameObject.SetActive(false);
  262. }
  263. if (isSendAudio)
  264. {
  265. audioOpenBtn.gameObject.SetActive(false);
  266. audioCloseBtn.gameObject.SetActive(true);
  267. }
  268. else
  269. {
  270. audioOpenBtn.gameObject.SetActive(true);
  271. audioCloseBtn.gameObject.SetActive(false);
  272. }
  273. }
  274. public void LeaveRoom()
  275. {
  276. WSHandler.roomRtcCloes();
  277. WSHandler.Office.ChangeUserType(UserInfo.BusyType);
  278. CloseOrReturnUIForms();
  279. UIManager.GetInstance().ShowUIForms(SysConst.MainPanelForms);
  280. if (isswitch)
  281. {
  282. OpenBlack();
  283. }
  284. //if (InviteDlg.Instance)
  285. //{
  286. // InviteDlg.Instance.InvitingUnionIdList.Clear();
  287. //}
  288. if (RoomFile.Instance)
  289. {
  290. RoomFile.Instance.ClearAllFileItem();
  291. }
  292. AgoraVideoAudioManager.Instance.LeaveChannel();
  293. }
  294. public void CkickOnSelfVideoBtn()
  295. {
  296. isSwithVideo = !isSwithVideo;
  297. if (isSwithVideo)
  298. {
  299. SwitchVideoBig();
  300. }
  301. else
  302. {
  303. SwitchVideoSmall();
  304. }
  305. }
  306. private void SwitchVideoBig()
  307. {
  308. bigView.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, 47.51f, 889f);
  309. bigView.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 169.6f, 500f);
  310. selfVideo.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
  311. selfVideo.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0);
  312. selfVideo.rectTransform.anchorMin = Vector2.zero;
  313. selfVideo.rectTransform.anchorMax = Vector2.one;
  314. selfVideo.transform.SetAsFirstSibling();
  315. }
  316. private void SwitchVideoSmall()
  317. {
  318. selfVideo.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, 47.51f, 889f);
  319. selfVideo.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 169.6f, 500f);
  320. bigView.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 0);
  321. bigView.rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 0);
  322. bigView.rectTransform.anchorMin = Vector2.zero;
  323. bigView.rectTransform.anchorMax = Vector2.one;
  324. bigView.transform.SetAsFirstSibling();
  325. }
  326. private void ClickOnOpenCoordinate()
  327. {
  328. //if (userId == NOUSER || bigView.texture == RemoteRtc.Instance.NoUser || bigView.texture == RemoteRtc.Instance.NoView)
  329. //{
  330. // return;
  331. //}
  332. if(userId == NOUSER || bigView.texture== AgoraVideoAudioManager.Instance.bg)
  333. {
  334. return;
  335. }
  336. else
  337. {
  338. isOpen = true;
  339. openCoordinateBtn.gameObject.SetActive(false);
  340. closeCoordinateBtn.gameObject.SetActive(true);
  341. }
  342. }
  343. public void ClickOnCloseCoordinate()
  344. {
  345. isOpen = false;
  346. openCoordinateBtn.gameObject.SetActive(true);
  347. closeCoordinateBtn.gameObject.SetActive(false);
  348. }
  349. private void ClickOnGuaDuan()
  350. {
  351. ShowUIForms(SysConst.PopForms);
  352. PopForms.Instance.ShowPublic(PopType.PopTwo, RtcStrConfig.roomPeopleLeave, "确定", () => { LeaveRoom(); }, "取消");
  353. }
  354. private void CallAndroidImage()
  355. {
  356. NativeGallery.GetVideoFromGallery((string path) => {
  357. Debug.Log("Video path: " + path);
  358. test.path = path;
  359. WSHandler.Rtc.uploadCert();
  360. if (RoomMainForms.Instance)
  361. {
  362. RoomMainForms.Instance.ClickOnCanel();
  363. }
  364. });
  365. //if (test.Instance)
  366. //{
  367. // test.Instance.CallAndroidImage();
  368. //}
  369. }
  370. private void CallAndroidVideo()
  371. {
  372. NativeGallery.GetImageFromGallery((string path) => {
  373. Debug.Log("Image path: " + path);
  374. test.path = path;
  375. WSHandler.Rtc.uploadCert();
  376. if (RoomMainForms.Instance)
  377. {
  378. RoomMainForms.Instance.ClickOnCanel();
  379. }
  380. });
  381. //if (test.Instance)
  382. //{
  383. // test.Instance.CallAndroidVideo();
  384. //}
  385. }
  386. private void ClickOnUpFileBtn()
  387. {
  388. UpFilePop.SetActive(true);
  389. }
  390. public void ClickOnCanel()
  391. {
  392. UpFilePop.SetActive(false);
  393. }
  394. public void ClickInviteBtn()
  395. {
  396. Invite.SetActive(true);
  397. InviteDlg.Instance.ShowHistory();
  398. }
  399. public WebCamTexture webTex;
  400. private string deviceName;
  401. private bool isswitch = true;
  402. IEnumerator CallCamera()
  403. {
  404. isswitch = true;
  405. yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
  406. if (Application.HasUserAuthorization(UserAuthorization.WebCam))
  407. {
  408. WebCamDevice[] devices = WebCamTexture.devices;
  409. deviceName = devices[1].name;
  410. if (webTex != null)
  411. {
  412. webTex.Stop();
  413. webTex = null;
  414. }
  415. //设置摄像机摄像的区域
  416. webTex = new WebCamTexture(deviceName, 1920, 1080, CustomInfo.FPS);
  417. RemoteRtc.Instance.meshRender.texture = webTex;
  418. selfVideo.texture = webTex;
  419. webTex.Play();//开始摄像
  420. }
  421. }
  422. IEnumerator CallCamera1()
  423. {
  424. isswitch = false;
  425. yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
  426. if (Application.HasUserAuthorization(UserAuthorization.WebCam))
  427. {
  428. WebCamDevice[] devices = WebCamTexture.devices;
  429. deviceName = devices[0].name;
  430. if (webTex != null)
  431. {
  432. webTex.Stop();
  433. webTex = null;
  434. }
  435. //设置摄像机摄像的区域
  436. webTex = new WebCamTexture(deviceName, 1920, 1080, CustomInfo.FPS);
  437. RemoteRtc.Instance.meshRender.texture = webTex;
  438. selfVideo.texture = webTex;
  439. webTex.Play();//开始摄像
  440. }
  441. }
  442. public void Swith()
  443. {
  444. AgoraVideoAudioManager.Instance.SwitchCamera(isswitch);
  445. isswitch = !isswitch;
  446. if (isswitch)
  447. {
  448. OpenBlack();
  449. }
  450. else
  451. {
  452. OpenFront();
  453. }
  454. }
  455. public void OpenFront()
  456. {
  457. //StopCoroutine(CallCamera1());
  458. //StartCoroutine(CallCamera());
  459. //RemoteRtc.Instance.meshRender.transform.localEulerAngles = new Vector3(180.0f, 0.0f, -180.0f);
  460. //selfVideo.transform.localEulerAngles = new Vector3(180.0f, 0.0f, -180.0f);
  461. }
  462. public void OpenBlack()
  463. {
  464. //StopCoroutine(CallCamera());
  465. //StartCoroutine(CallCamera1());
  466. //RemoteRtc.Instance.meshRender.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
  467. //selfVideo.transform.localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
  468. }
  469. public void ShowRoomissolvePop()
  470. {
  471. ShowUIForms(SysConst.PopForms);
  472. PopForms.Instance.ShowPublic(PopType.PopOne, RtcStrConfig.roomdissolve, "知道了");
  473. }
  474. public void sendVideo( bool state)
  475. {
  476. if(state)
  477. openVideoEffect();
  478. else
  479. closeVideoEffect();
  480. AgoraVideoAudioManager.Instance.EnableLocalVideo(state);
  481. //if (RemoteRtc.Instance.me.cIdV == "")
  482. //{
  483. // dcetype = "video";
  484. // RemoteRtc.Instance.startCamera();
  485. // RemoteRtc.Instance.sendVideo(true);
  486. // RemoteRtc.Instance.me.cIdV = "";
  487. // openVideoEffect();
  488. // AgoraVideoAudioManager.Instance.EnableLocalVideo(true);
  489. //}
  490. //else
  491. //{
  492. // dcetype = "video";
  493. // WSHandler.Rtc.closeProducer(RemoteRtc.Instance.me.cIdV);
  494. // RemoteRtc.Instance.stopCamera();
  495. // RemoteRtc.Instance.sendVideo(false);
  496. // closeVideoEffect();
  497. // AgoraVideoAudioManager.Instance.EnableLocalVideo(false);
  498. //}
  499. /*
  500. * 时间的跨度再次越过了半年
  501. */
  502. }
  503. public void sendAudio( bool state)
  504. {
  505. if(state)
  506. {
  507. openAudioEffect();
  508. }
  509. else
  510. {
  511. closeAudioEffect();
  512. }
  513. AgoraVideoAudioManager.Instance.EnableLoacalAudio(state);
  514. //if (RemoteRtc.Instance.me.cIdA != "")
  515. //{
  516. // dcetype = "audio";
  517. // WSHandler.Rtc.closeProducer(RemoteRtc.Instance.me.cIdA);
  518. // RemoteRtc.Instance.sendMic(false);
  519. // RemoteRtc.Instance.me.cIdA = "";
  520. // closeAudioEffect();
  521. // AgoraVideoAudioManager.Instance.EnableLoacalAudio(false);
  522. //}
  523. //else
  524. //{
  525. // dcetype = "audio";
  526. // RemoteRtc.Instance.sendMic(true);
  527. // openAudioEffect();
  528. // AgoraVideoAudioManager.Instance.EnableLoacalAudio(true);
  529. //}
  530. }
  531. private void closeVideoEffect()
  532. {
  533. isSendVideo = false;
  534. videoOpenBtn.gameObject.SetActive(true);
  535. videoCloseBtn.gameObject.SetActive(false);
  536. }
  537. private void openVideoEffect()
  538. {
  539. isSendVideo = true;
  540. videoOpenBtn.gameObject.SetActive(false);
  541. videoCloseBtn.gameObject.SetActive(true);
  542. }
  543. private void closeAudioEffect()
  544. {
  545. isSendAudio = false;
  546. audioOpenBtn.gameObject.SetActive(true);
  547. audioCloseBtn.gameObject.SetActive(false);
  548. }
  549. private void openAudioEffect()
  550. {
  551. isSendAudio = true;
  552. audioOpenBtn.gameObject.SetActive(false);
  553. audioCloseBtn.gameObject.SetActive(true);
  554. }
  555. public void CkickOnJieTuBtn()
  556. {
  557. if (!AgoraVideoAudioManager.Instance.isVideoStream)
  558. return;
  559. AllNeedHideUI.SetActive(false);
  560. //if (isSwithVideo)
  561. //{
  562. //
  563. // selfVideo.gameObject.SetActive(false);
  564. // jieTuBG.texture = selfVideo.texture;
  565. //}
  566. //else
  567. //{
  568. // bigView.gameObject.SetActive(false);
  569. //
  570. // jieTuBG.texture = bigView.texture;
  571. //}
  572. Texture2D texture;
  573. if (isSwithVideo)
  574. {
  575. texture = selfVideo.texture as Texture2D;
  576. jieTuBG.rectTransform.localEulerAngles = selfVideo.rectTransform.localEulerAngles;
  577. }
  578. else
  579. {
  580. texture = bigView.texture as Texture2D;
  581. jieTuBG.rectTransform.localEulerAngles = bigView.rectTransform.localEulerAngles;
  582. }
  583. // 创建一个新的2D纹理
  584. Texture2D newTexture = new Texture2D(texture.width, texture.height, TextureFormat.RGB24, false);
  585. // 将截图复制到新的2D纹理中
  586. newTexture.SetPixels(texture.GetPixels());
  587. newTexture.Apply();
  588. jieTuBG.texture = newTexture;
  589. bigView.gameObject.SetActive(false);
  590. selfVideo.gameObject.SetActive(false);
  591. jieTuBG.gameObject.SetActive(true);
  592. }
  593. public void ShowShotsAllBtn()
  594. {
  595. AllNeedShowUI.SetActive(true);
  596. }
  597. public void JieTuWancheng()
  598. {
  599. AllNeedHideUI.SetActive(true);
  600. AllNeedShowUI.SetActive(false);
  601. if (!bigView.gameObject.activeSelf)
  602. {
  603. bigView.gameObject.SetActive(true);
  604. }
  605. if (!selfVideo.gameObject.activeSelf)
  606. {
  607. selfVideo.gameObject.SetActive(true);
  608. }
  609. jieTuBG.gameObject.SetActive(false);
  610. }
  611. private void OnDestroy()
  612. {
  613. WSHandler.Rtc.onRtcState -= onRtcState;
  614. }
  615. }