12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SCRtcPeers
- {
- private Dictionary<string, SCRtcPeer> mSCRtcPeers = new Dictionary<string, SCRtcPeer>();
- 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<string, SCRtcPeer> getPeers()
- {
- return mSCRtcPeers;
- }
- public virtual SCRtcPeer getPeer(string name)
- {
- if (mSCRtcPeers.ContainsKey(name))
- {
- return mSCRtcPeers[name];
- }
- return null;
- }
- public void initPeers()
- {
- mSCRtcPeers = new Dictionary<string, SCRtcPeer>();
- }
- }
|