Пример #1
0
 /// <summary>
 /// Gets the anchor id of a room.
 /// </summary>
 /// <param name="roomId">Room identifier to resolve.</param>
 /// <param name="ipAddress">The Ip address of the device where the room belongs to.</param>
 /// <param name="GetAnchorIdFromRoomCallback">The callback to be called after the room was resolved.</param>
 public void GetAnchorIdFromRoom(Int32 roomId, string ipAddress, GetAnchorIdFromRoomDelegate GetAnchorIdFromRoomCallback)
 {
     m_GetAnchorIdFromRoomCallback = GetAnchorIdFromRoomCallback;
     m_RoomId = roomId;
     RegisterHandler(MsgType.Connect, OnConnected);
     RegisterHandler(RoomSharingMsgType.AnchorIdFromRoomResponse, OnGetAnchorIdFromRoomResponse);
     Connect(ipAddress, 8888);
 }
        /// <summary>
        /// Handles the resolve room response from server.
        /// </summary>
        /// <param name="networkMessage">The resolve room response message.</param>
        private void OnGetAnchorIdFromRoomResponse(NetworkMessage networkMessage)
        {
            var response = networkMessage.ReadMessage <AnchorIdFromRoomResponseMessage>();

            if (m_GetAnchorIdFromRoomCallback != null)
            {
                m_GetAnchorIdFromRoomCallback(response.Found, response.AnchorId);
            }

            m_GetAnchorIdFromRoomCallback = null;
        }
Пример #3
0
        /// <summary>
        /// Handles the resolve room response from server.
        /// </summary>
        /// <param name="networkMessage">The resolve room response message.</param>
        private void OnGetAnchorIdFromRoomResponse(NetworkMessage networkMessage)
        {
            var response = networkMessage.ReadMessage <AnchorIdFromRoomResponseMessage>();

            if (m_GetAnchorIdFromRoomCallback != null)
            {
                m_GetAnchorIdFromRoomCallback(response.Found, response.AnchorId);
            }

            m_GetAnchorIdFromRoomCallback = null;
            Debug.Log("on get anchor id from room response: " + response.AnchorId);
        }
Пример #4
0
 /// <summary>
 /// Gets the anchor id of a room.
 /// </summary>
 /// <param name="roomId">Room identifier to resolve.</param>
 /// <param name="ipAddress">The Ip address of the device where the room belongs to.</param>
 /// <param name="GetAnchorIdFromRoomCallback">The callback to be called after the room was resolved.</param>
 public void GetAnchorIdFromRoom(Int32 roomId, string ipAddress, GetAnchorIdFromRoomDelegate GetAnchorIdFromRoomCallback)
 {
     m_GetAnchorIdFromRoomCallback = GetAnchorIdFromRoomCallback;
     m_RoomId = roomId;
     NetworkManager.singleton.client.RegisterHandler(MsgType.Connect, OnConnected);
     NetworkManager.singleton.client.RegisterHandler(RoomSharingMsgType.AnchorIdFromRoomResponse, OnGetAnchorIdFromRoomResponse);
     NetworkManager.singleton.client.RegisterHandler(MsgType.Disconnect, OnDisconnected);
     NetworkManager.singleton.client.RegisterHandler(MsgType.Error, OnError);
     // NetworkManager.singleton.networkAddress = ipAddress;
     // NetworkManager.singleton.networkPort = 8888;
     // NetworkManager.singleton.StartClient();
     Debug.Log("get anchor id from room");
     // NetworkManager.singleton.client.Connect(ipAddress, 8888);
 }