Exemplo n.º 1
0
    void OnFileAdded(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
    {
        string pathInCamfi = args[0].ToString();
        //Debug.Log("拍照成功,其Url: " + pathInCamfi);
        HTTPRequest request = new HTTPRequest(new Uri(CamfiServerInfo.CamFiGetRawDataByEnCodeUrlStr(UrlEncode(pathInCamfi))), HTTPMethods.Get, GetRawDataFinished);

        request.Send();
    }
 void OnConnected(BestHTTP.SocketIO.Socket socket, BestHTTP.SocketIO.Packet packet, object[] args)
 {
     IsConnected = true;
     if (Connected != null)
     {
         Connected(this, null);
     }
 }
Exemplo n.º 3
0
 private void OnConnected(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     if (PlayerPrefs.HasKey("Nick"))
     {
         this.Nick = PlayerPrefs.GetString("Nick", "NickName");
         this.Join();
     }
     else
     {
         this.State = States.WaitForNick;
     }
     this.AddMessage("connected");
 }
Exemplo n.º 4
0
 private void OnFrame(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     if (this.State == States.Joined)
     {
         if (this.FrameTexture == null)
         {
             this.FrameTexture = new Texture2D(0, 0, TextureFormat.RGBA32, false);
             this.FrameTexture.filterMode = FilterMode.Point;
         }
         byte[] data = packet.Attachments[0];
         this.FrameTexture.LoadImage(data);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Called when a "connect" event received to the root namespace
        /// </summary>
        private void OnTransportOpen(Socket socket, Packet packet, params object[] args)
        {
            // If this is not the root namespace, then we send a connect message to the server
            if (this.Namespace != "/")
                (Manager as IManager).SendPacket(new Packet(TransportEventTypes.Message, SocketIOEventTypes.Connect, this.Namespace, string.Empty));

            // and we are no open
            IsOpen = true;
        }
Exemplo n.º 6
0
 public EventTable(BestHTTP.SocketIO.Socket socket)
 {
     this.Socket = socket;
 }
Exemplo n.º 7
0
 void OnLiveshowData(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     //print(packet.AttachmentCount);
 }
Exemplo n.º 8
0
 void OnLiveshowError(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     Debug.LogWarning("实时取景发送错误");
 }
Exemplo n.º 9
0
 void OnCameraRemove(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     Debug.LogWarning("CamFi丢失相机连接");
     _connectCameraSuccess = false;
     _onBreakCameraAction.Invoke();
 }
Exemplo n.º 10
0
 private void OnConnections(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     this.connections = Convert.ToInt32(args[0]);
 }
Exemplo n.º 11
0
 void OnDisConnected(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     Debug.LogWarning("与CamFi的SokectIO连接 断开");
     _connectCamfiSuccess = false;
     _onBreakCamfiAction.Invoke();
 }
Exemplo n.º 12
0
 void OnConnected(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     Debug.LogWarning("与CamFi的SokectIO连接建立");
     _connectCamfiSuccess = true;
     _onConnectCamfiAction.Invoke();
 }
Exemplo n.º 13
0
        /// <summary>
        /// Internal function to remove a Socket instance from this manager.
        /// </summary>
        /// <param name="socket"></param>
        void IManager.Remove(Socket socket)
        {
            Namespaces.Remove(socket.Namespace);
            Sockets.Remove(socket);

            if (Sockets.Count == 0)
                Close();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Returns with the specified namespace
        /// </summary>
        public Socket GetSocket(string nsp)
        {
            if (string.IsNullOrEmpty(nsp))
                throw new ArgumentNullException("Namespace parameter is null or empty!");

            /*if (nsp[0] != '/')
                nsp = "/" + nsp;*/

            Socket socket = null;
            if (!Namespaces.TryGetValue(nsp, out socket))
            {
                // No socket found, create one
                socket = new Socket(nsp, this);

                Namespaces.Add(nsp, socket);
                Sockets.Add(socket);

                (socket as ISocket).Open();
            }

            return socket;
        }
Exemplo n.º 15
0
 private void OnError(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     this.AddMessage($"--ERROR - {args[0].ToString()}");
 }
Exemplo n.º 16
0
 void OnCameraAdd(BestHTTP.SocketIO.Socket socket, Packet packet, params object[] args)
 {
     Debug.LogWarning("CamFi连接了相机");
     _connectCameraSuccess = true;
     _onConnectCameraAction.Invoke();
 }
 void OnConnected(BestHTTP.SocketIO.Socket socket, BestHTTP.SocketIO.Packet packet, object[] args)
 {
     Debug.Log("Connected to socket server");
 }
 /// <summary>
 /// Internal function to remove a Socket instance from this manager.
 /// </summary>
 /// <param name="socket"></param>
 void IManager.Remove(Socket socket)
 {
     Namespaces.Remove(socket.Namespace);
     Sockets.Remove(socket);
 }