CustomPeerList.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using ShadowStudio.Mgr;
  2. using ShadowStudio.Model;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. public class CustomPeerList : SCRtcPeers
  7. {
  8. public GameObject peerQuad;
  9. public override void removePeers(string pid)
  10. {
  11. CustomPeer p = (CustomPeer)getPeer(pid);
  12. if(PopPeerView.Instance)
  13. {
  14. for (int j = 0; j < PopPeerView.Instance.bigList.Count; j++)
  15. {
  16. if (PopPeerView.Instance.bigList[j].cPeer.peerId == pid)
  17. {
  18. PopPeerView.Instance.bigList[j].closeView();
  19. }
  20. }
  21. }
  22. if(RoomMain.Instance.userId == pid)
  23. {
  24. bool isBigShow=false;
  25. foreach (CustomPeer peer in getPeers().Values)
  26. {
  27. if (!peer.isShow&& pid!=peer.peerId)
  28. {
  29. isBigShow = true;
  30. RoomMain.Instance.setBigView(peer.tex, peer.peerId);
  31. }
  32. }
  33. if(!isBigShow)
  34. {
  35. RoomMain.Instance.setBigView(RemoteRtc.Instance.NoUser,"nouser");
  36. }
  37. }
  38. Debug.Log("删除=====》");
  39. if(UserItemList.Instance!=null&& UserItemList.Instance.PeerList!=null)
  40. {
  41. for (int i = 0; i < UserItemList.Instance.PeerList.Count; i++)
  42. {
  43. if (UserItemList.Instance.PeerList[i].PeerId == p.name)
  44. {
  45. UserItemList.Instance.DeleteUserItem(UserItemList.Instance.PeerList[i].PeerId);
  46. break;
  47. }
  48. }
  49. }
  50. base.removePeers(pid);
  51. }
  52. public override SCRtcPeer addPeers(string pid)
  53. {
  54. CustomPeer p = new CustomPeer();
  55. p.peerId = pid;
  56. base.addPeers(p);
  57. return p;
  58. }
  59. }