public void SendReliableMessage(byte[] messageData, string roomId, string recipientParticipantId, Action <ReliableMessageSentCallback> callback) { var javaRequestBuilder = new AN_JavaRequestBuilder(JavaClassName, "SendReliableMessage"); javaRequestBuilder.AddArgument(HashCode); javaRequestBuilder.AddArgument(Convert.ToBase64String(messageData)); javaRequestBuilder.AddArgument(roomId); javaRequestBuilder.AddArgument(recipientParticipantId); javaRequestBuilder.AddCallback(callback); javaRequestBuilder.Invoke(); }
/// <summary> /// Starts up BillingClient setup process asynchronously. /// You will be notified through the <see cref="AN_iBillingClientStateListener"/> /// listener when the setup process is complete. /// </summary> /// <param name="listener">The listener to notify when the setup process is complete.</param> public void StartConnection(AN_iBillingClientStateListener listener) { var javaRequestBuilder = new AN_JavaRequestBuilder(k_NativeBillingClient, "StartConnection"); javaRequestBuilder.AddArgument(HashCode); javaRequestBuilder.AddCallback <SA_Result>(listener.OnBillingSetupFinished); javaRequestBuilder.AddCallback <SA_Result>(result => { listener.OnBillingServiceDisconnected(); }); javaRequestBuilder.Invoke(); }
/// <summary> /// Builds a new <see cref="AN_RoomConfig"/> object. /// </summary> /// <returns>a new <see cref="AN_RoomConfig"/> object.</returns> public AN_RoomConfig Build() { //MakeBuilder var javaRequestBuilder = new AN_JavaRequestBuilder(k_RoomConfigJavaClass, "MakeBuilder"); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomUpdateCallback.OnRoomCreated(result.StatusCode, result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomUpdateCallback.OnJoinedRoom(result.StatusCode, result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomUpdateCallback.OnLeftRoom(result.StatusCode, result.RoomId); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomUpdateCallback.OnRoomConnected(result.StatusCode, result.Room); }); var builderHashCode = javaRequestBuilder.Invoke <int>(); //SetRealTimeMessageReceivedListener if (m_RealTimeMessageReceivedListener != null) { javaRequestBuilder = new AN_JavaRequestBuilder(k_RoomConfigJavaClass, "SetRealTimeMessageReceivedListener"); javaRequestBuilder.AddArgument(builderHashCode); javaRequestBuilder.AddCallback <AN_RealTimeMessage>(message => { m_RealTimeMessageReceivedListener.OnRealTimeMessageReceived(message); }); javaRequestBuilder.Invoke(); } //RoomStatusUpdateCallback if (m_RoomStatusUpdateCallback != null) { javaRequestBuilder = new AN_JavaRequestBuilder(k_RoomConfigJavaClass, "RoomStatusUpdateCallback"); javaRequestBuilder.AddArgument(builderHashCode); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnRoomConnecting(result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnRoomAutoMatching(result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeerInvitedToRoom(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeerDeclined(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeerJoined(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeerLeft(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnConnectedToRoom(result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnDisconnectedFromRoom(result.Room); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeersConnected(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnPeersDisconnected(result.Room, result.ParticipantIds); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnP2PConnected(result.ParticipantId); }); javaRequestBuilder.AddCallback <RoomUpdate>(result => { m_RoomStatusUpdateCallback.OnP2PDisconnected(result.ParticipantId); }); javaRequestBuilder.Invoke(); } //Builder Data javaRequestBuilder = new AN_JavaRequestBuilder(k_RoomConfigJavaClass, "BuildRoomConfig"); javaRequestBuilder.AddArgument(builderHashCode); javaRequestBuilder.AddArgument(JsonUtility.ToJson(this)); var configHashCode = javaRequestBuilder.Invoke <int>(); return(new AN_RoomConfig(configHashCode)); }