123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- using System.Collections;
- using System.Collections.Generic;
- using LitJson;
- using ShadowStudio.Mgr;
- using ShadowStudio.Model;
- using UnityEngine;
- using UnityEngine.UI;
- public class CustomPeer : SCRtcPeer
- {
- public bool isCloseAudio =false;
- public bool isCloseVideo = false;
- public float volumn = 0.2f;
- public GameObject bigView;
- public bool isBig;
- public int Index { get; set; }
- public GameObject Quad;
- public delegate void OnChangeTexture();
- public OnChangeTexture onChangeTexture;
- public delegate void OnChangeName(string n);
- public OnChangeName onChangeName;
- public delegate void OnChangeInfo(string type, string id);
- public OnChangeInfo onChangeInfo;
-
- public override void setInfo(string type, string id,bool isOpen)
- {
- base.setInfo(type, id, isOpen);
- if (onChangeInfo != null)
- {
- onChangeInfo(type, id);
- }
- }
- public override void setName(string n)
- {
- base.setName(n);
- if (onChangeName != null)
- {
- onChangeName(n);
- }
- bool isHave=false;
- if (UserItemList.Instance != null)
- {
- for (int i = 0; i <UserItemList.Instance.PeerList.Count; i++)
- {
- if(UserItemList.Instance.PeerList[i].PeerId == n)
- {
- isHave = true;
- }
- }
- if(!isHave)
- {
- Peer peer = new Peer();
- peer.PeerId = n;
- peer.NickName = peerId;
- peer.IsOther = true;
- UserItemList.Instance.AddUserItem(peer);
- }
- }
- }
- public void changeInfo(string info, CustomPeer customPeer)
- {
- if(customPeer.cIdA == info)
- {
- cIdA = "";
-
- }
- else
- {
- cIdV = "";
- if (CustomRTC.Instance.bigNameID == customPeer.peerId)
- {
- Debug.Log("PPT2");
- CustomRTC.Instance.bigMr.material.mainTexture = CustomRTC.Instance.t2fang;
- }
- if (customPeer.isBig)
- {
- customPeer.bigView.GetComponent<BigVideoManager>().onChangeCloseInfo();
- }
- //if (bigNameID == data["data"]["peerId"].ToString())
- //{
- // Debug.Log("PPT2");
- // bigMr.material.mainTexture = t2fang;
- //}
- //if (cp.isBig)
- //{
- // cp.bigView.GetComponent<BigVideoManager>().onChangeCloseInfo();
- //}
- }
- }
- public override void setTexture(JsonData data)
- {
- base.setTexture(data);
- showVideo(data);
- if (onChangeTexture != null)
- {
- onChangeTexture();
- }
- }
- public override void changeTexture(JsonData data)
- {
- base.changeTexture(data);
- changeVideo(data);
- }
- public void changeVideo(JsonData data)
- {
- }
- public void addQuad(GameObject peerQuad)
- {
- }
- public void showVideo(JsonData data)
- {
- }
- public void OnClick()
- {
- }
- public void OnEnter()
- {
- }
- public void OnExit()
- {
- }
- public void OnDown()
- {
- }
- public void OnUp()
- {
- }
- public void Start()
- {
- }
- public void Awake()
- {
- }
- public void Update()
- {
- }
- public void OnDestroy()
- {
- }
- public void Init()
- {
- }
- public void AgoraInit(string peerid)
- {
- this.peerId = peerid;
- isAudio = false;
- isVideo = false;
- isCloseAudio = true;
- isCloseAudio = true;
- }
- }
|