using System.Collections; using System.Collections.Generic; using UnityEngine; public class SCRtcPeers { private Dictionary mSCRtcPeers = new Dictionary(); public virtual SCRtcPeer addPeers(string pid) { if (!mSCRtcPeers.ContainsKey(pid)) { SCRtcPeer sp = new SCRtcPeer(); sp.peerId = pid; mSCRtcPeers.Add(pid, sp); return sp; } return null; } public virtual SCRtcPeer addPeers(SCRtcPeer scp) { if (!mSCRtcPeers.ContainsKey(scp.peerId)) { SCRtcPeer sp = scp; mSCRtcPeers.Add(scp.peerId, sp); return sp; } return null; } public void updateTextures() { foreach (SCRtcPeer value in getPeers().Values) { value.updateTexture(); } } public virtual void removePeers(string name) { if (mSCRtcPeers.ContainsKey(name)) { mSCRtcPeers.Remove(name); } } public virtual Dictionary getPeers() { return mSCRtcPeers; } public virtual SCRtcPeer getPeerName(string name) { foreach(SCRtcPeer v in mSCRtcPeers.Values) { if(v.name==name) { Debug.Log("查找到===>" + name); return v; } } return null; } public virtual SCRtcPeer getPeer(string name) { if (mSCRtcPeers.ContainsKey(name)) { return mSCRtcPeers[name]; } return null; } public void initPeers() { mSCRtcPeers = new Dictionary(); } }