public override void Dispose()
        {
            Logger.Debug("Dispose SenderManager");

            TcpSender?.Dispose();
            UdpSender?.Dispose();
        }
Example #2
0
 public void Dispose()
 {
     frameProducer?.Dispose();
     dataExtractor?.Dispose();
     landmarkExtractor?.Dispose();
     udpSender?.Dispose();
 }
 public void Dispose()
 {
     if (!m_Disposed)
     {
         Stop();
         if (m_UdpSender != null)
         {
             m_UdpSender.Dispose();
             m_UdpSender = null;
         }
         m_Disposed = true;
     }
 }
Example #4
0
        /// <summary>
        /// 初始化anchor
        /// </summary>
        /// <param name="msgSetAnchor"></param>
        private void SetAnchors(LiveMessageSetAnchor msgSetAnchor)
        {
            //Debug.Log("Init Anchor!");
            anchorController.ClearAllAnchorInfo(true);

            anchorController.serverHost = msgSetAnchor.anchorData.serverHost;
            anchorController.serverPort = msgSetAnchor.anchorData.serverPort;
            anchorController.appId      = msgSetAnchor.anchorData.appId;
            anchorController.roomId     = msgSetAnchor.anchorData.roomId;

            this.useUDP  = msgSetAnchor.anchorData.useUDP;
            this.udpPort = msgSetAnchor.anchorData.serverPortUDP;


            // 开始记录日志
            if (currentLogName != null)
            {
                Debug.Log("Has Old Log! " + currentLogName);
                logManager.StopLog(currentLogName);
            }
            currentLogName = "SendSync_" + msgSetAnchor.anchorData.logIndex;

            for (int i = 0; i < msgSetAnchor.anchorData.anchorNameList.Count; i++)
            {
                string  anchorName = msgSetAnchor.anchorData.anchorNameList[i];
                Vector3 pos        = msgSetAnchor.anchorData.anchorPosition[i].ToVector3();
                Vector3 forward    = msgSetAnchor.anchorData.anchorForward[i].ToVector3();

                // 创建新anchor
                GameObject obj = new GameObject(anchorName);
                obj.transform.position = pos;
                if (msgSetAnchor.anchorData.sendRotation)
                {
                    obj.transform.eulerAngles = forward;
                }
                else
                {
                    obj.transform.forward = forward;
                }

                //Debug.Log("Add Anchor[" + anchorName + "] at " + pos + " | " + forward);

                anchorController.AddAnchorObject(anchorName, obj);
            }

            anchorController.ShowAllMark(false);

            if (useUDP)
            {
                if (sender != null)
                {
                    sender.Dispose();
                }

                sender = new UdpSender(udpPort, UdpMode.Unicast, liveIp, null);
                sender.Init();
            }

            // 设置完毕之后,回传结果给PC
            SendSetAnchorResult();
        }