RoomOtherUser.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. 
  2. using SC.XR.Unity;
  3. using System;
  4. using System.Collections.Generic;
  5. using static ScenesManager;
  6. public class RoomOtherUser : RemoteSingleton<RoomOtherUser>
  7. {
  8. public static Action<string> ShowAction;
  9. public NormalList Nlist;
  10. private void Start()
  11. {
  12. // UpdateList();
  13. }
  14. public override void initShow()
  15. {
  16. base.initShow();
  17. UpdateList();
  18. }
  19. private List<string> vs = new List<string>();
  20. public void UpdateList()
  21. {
  22. if (vs.Count > 0)
  23. {
  24. vs.Clear();
  25. }
  26. List<BaseConfig> list = new List<BaseConfig>();
  27. CustomPeerList peerlist = RemoteRtc.Instance.customPeerList;
  28. PeerConfig pconfig;
  29. for (int i = 0; i < peerlist.getPaiXuPeers().Count; i++)
  30. {
  31. CustomPeer peer = (CustomPeer)peerlist.getPeer(peerlist.getPaiXuPeers()[i]);
  32. if (!peer.isShow)
  33. {
  34. pconfig = new PeerConfig();
  35. pconfig.name = peer.name;
  36. pconfig.peer = peer;
  37. list.Add(pconfig);
  38. vs.Add(pconfig.peer.peerId);
  39. }
  40. }
  41. if (InviteDlg.Instance && InviteDlg.Instance.InvitingUnionIdList.Count > 0)
  42. {
  43. for (int i = InviteDlg.Instance.InvitingUnionIdList.Count - 1; i >= 0; i--)
  44. {
  45. if (vs.Contains(InviteDlg.Instance.InvitingUnionIdList[i].UnionId))
  46. {
  47. InviteDlg.Instance.InvitingUnionIdList.Remove(InviteDlg.Instance.InvitingUnionIdList[i]);
  48. }
  49. }
  50. for (int i = 0; i < InviteDlg.Instance.InvitingUnionIdList.Count; i++)
  51. {
  52. list.Add(InviteDlg.Instance.InvitingUnionIdList[i]);
  53. }
  54. if (peerlist.getPeers().Count + InviteDlg.Instance.InvitingUnionIdList.Count < RoomMainInfo.roomMaxPeopleNum - 1)
  55. {
  56. BaseConfig baseConfig = new BaseConfig();
  57. list.Add(baseConfig);
  58. }
  59. }
  60. else
  61. {
  62. if (peerlist.getPeers().Count < RoomMainInfo.roomMaxPeopleNum - 1 && RoomMainInfo.isCreator == "0")
  63. {
  64. BaseConfig baseConfig = new BaseConfig();
  65. list.Add(baseConfig);
  66. }
  67. }
  68. Nlist.initList(list);
  69. list.Clear();
  70. vs.Clear();
  71. }
  72. }