/// <summary>
        /// Accepts the request.
        /// </summary>
        /// <param name="player">Player to accept the request from.</param>
        public void AcceptRequest(string endpointId)
        {
            NearbyPlayer player = NearbyPlayer.FindByEndpointId(endpointId);

            PlayGamesPlatform.Nearby.AcceptConnectionRequest(
                player.EndpointId,
                ConnectionData(),
                this);
            playerHandler(player, true);
        }
Beispiel #2
0
        /// <summary>
        /// Raises the message received event.
        /// </summary>
        /// <param name="remoteEndpointId">Remote endpoint identifier.</param>
        /// <param name="data">Data payload of the message.</param>
        /// <param name="isReliableMessage">If set to <c>true</c> is reliable message.</param>
        public void OnMessageReceived(string remoteEndpointId, byte[] data, bool isReliableMessage)
        {
            Debug.Log("RECEIVED Message from " + remoteEndpointId);
            NearbyPlayer sender = NearbyPlayer.FindByEndpointId(remoteEndpointId);

            if (messageHandler != null)
            {
                messageHandler(sender, data);
            }
            else
            {
                Debug.Log("Messagehandler not set, ignoring!");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Raises the remote endpoint disconnected event.
        /// </summary>
        /// <param name="remoteEndpointId">Remote endpoint identifier.</param>
        public void OnRemoteEndpointDisconnected(string remoteEndpointId)
        {
            NearbyPlayer player = NearbyPlayer.FindByEndpointId(remoteEndpointId);

            playerHandler(player, false);
        }