private static NativeEndpointDiscoveryListenerHelper ToDiscoveryListener(IDiscoveryListener listener) { listener = (IDiscoveryListener) new NativeNearbyConnectionsClient.OnGameThreadDiscoveryListener(listener); NativeEndpointDiscoveryListenerHelper discoveryListenerHelper = new NativeEndpointDiscoveryListenerHelper(); discoveryListenerHelper.SetOnEndpointFound((Action <long, NativeEndpointDetails>)((localClientId, endpoint) => listener.OnEndpointFound(endpoint.ToDetails()))); discoveryListenerHelper.SetOnEndpointLostCallback((Action <long, string>)((localClientId, lostEndpointId) => listener.OnEndpointLost(lostEndpointId))); return(discoveryListenerHelper); }
private static NativeEndpointDiscoveryListenerHelper ToDiscoveryListener( IDiscoveryListener listener) { listener = new OnGameThreadDiscoveryListener(listener); var helper = new NativeEndpointDiscoveryListenerHelper(); helper.SetOnEndpointFound((localClientId, endpoint) => listener.OnEndpointFound(endpoint.ToDetails())); helper.SetOnEndpointLostCallback((localClientId, lostEndpointId) => listener.OnEndpointLost(lostEndpointId)); return(helper); }
private static NativeEndpointDiscoveryListenerHelper ToDiscoveryListener(IDiscoveryListener listener) { listener = new OnGameThreadDiscoveryListener(listener); NativeEndpointDiscoveryListenerHelper nativeEndpointDiscoveryListenerHelper = new NativeEndpointDiscoveryListenerHelper(); nativeEndpointDiscoveryListenerHelper.SetOnEndpointFound(delegate(long localClientId, NativeEndpointDetails endpoint) { listener.OnEndpointFound(endpoint.ToDetails()); }); nativeEndpointDiscoveryListenerHelper.SetOnEndpointLostCallback(delegate(long localClientId, string lostEndpointId) { listener.OnEndpointLost(lostEndpointId); }); return(nativeEndpointDiscoveryListenerHelper); }