RoomMainForms.cs 20 KB

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