CustomPeer.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using LitJson;
  4. using ShadowStudio.Mgr;
  5. using ShadowStudio.Model;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. public class CustomPeer : SCRtcPeer
  9. {
  10. public bool isCloseAudio =false;
  11. public bool isCloseVideo = false;
  12. public float volumn = 0.2f;
  13. public GameObject bigView;
  14. public bool isBig;
  15. public int Index { get; set; }
  16. public GameObject Quad;
  17. public delegate void OnChangeTexture();
  18. public OnChangeTexture onChangeTexture;
  19. public delegate void OnChangeName(string n);
  20. public OnChangeName onChangeName;
  21. public delegate void OnChangeInfo(string type, string id);
  22. public OnChangeInfo onChangeInfo;
  23. public override void setInfo(string type, string id,bool isOpen)
  24. {
  25. base.setInfo(type, id, isOpen);
  26. if (onChangeInfo != null)
  27. {
  28. onChangeInfo(type, id);
  29. }
  30. }
  31. public override void setName(string n)
  32. {
  33. base.setName(n);
  34. if (onChangeName != null)
  35. {
  36. onChangeName(n);
  37. }
  38. bool isHave=false;
  39. if (UserItemList.Instance != null)
  40. {
  41. for (int i = 0; i <UserItemList.Instance.PeerList.Count; i++)
  42. {
  43. if(UserItemList.Instance.PeerList[i].PeerId == n)
  44. {
  45. isHave = true;
  46. }
  47. }
  48. if(!isHave)
  49. {
  50. Peer peer = new Peer();
  51. peer.PeerId = n;
  52. peer.NickName = peerId;
  53. peer.IsOther = true;
  54. UserItemList.Instance.AddUserItem(peer);
  55. }
  56. }
  57. }
  58. public void changeInfo(string info, CustomPeer customPeer)
  59. {
  60. if(customPeer.cIdA == info)
  61. {
  62. cIdA = "";
  63. }
  64. else
  65. {
  66. cIdV = "";
  67. if (CustomRTC.Instance.bigNameID == customPeer.peerId)
  68. {
  69. Debug.Log("PPT2");
  70. CustomRTC.Instance.bigMr.material.mainTexture = CustomRTC.Instance.t2fang;
  71. }
  72. if (customPeer.isBig)
  73. {
  74. customPeer.bigView.GetComponent<BigVideoManager>().onChangeCloseInfo();
  75. }
  76. //if (bigNameID == data["data"]["peerId"].ToString())
  77. //{
  78. // Debug.Log("PPT2");
  79. // bigMr.material.mainTexture = t2fang;
  80. //}
  81. //if (cp.isBig)
  82. //{
  83. // cp.bigView.GetComponent<BigVideoManager>().onChangeCloseInfo();
  84. //}
  85. }
  86. }
  87. public override void setTexture(JsonData data)
  88. {
  89. base.setTexture(data);
  90. showVideo(data);
  91. if (onChangeTexture != null)
  92. {
  93. onChangeTexture();
  94. }
  95. }
  96. public override void changeTexture(JsonData data)
  97. {
  98. base.changeTexture(data);
  99. changeVideo(data);
  100. }
  101. public void changeVideo(JsonData data)
  102. {
  103. }
  104. public void addQuad(GameObject peerQuad)
  105. {
  106. }
  107. public void showVideo(JsonData data)
  108. {
  109. }
  110. public void OnClick()
  111. {
  112. }
  113. public void OnEnter()
  114. {
  115. }
  116. public void OnExit()
  117. {
  118. }
  119. public void OnDown()
  120. {
  121. }
  122. public void OnUp()
  123. {
  124. }
  125. public void Start()
  126. {
  127. }
  128. public void Awake()
  129. {
  130. }
  131. public void Update()
  132. {
  133. }
  134. public void OnDestroy()
  135. {
  136. }
  137. public void Init()
  138. {
  139. }
  140. public void AgoraInit(string peerid)
  141. {
  142. this.peerId = peerid;
  143. isAudio = false;
  144. isVideo = false;
  145. isCloseAudio = true;
  146. isCloseAudio = true;
  147. }
  148. }