Пример #1
0
        internal static void InternalMultiplayerStatusCallback(GooglePlayGames.Native.Cwrapper.CommonErrorStatus.MultiplayerStatus status, IntPtr data)
        {
            Logger.d("InternalMultiplayerStatusCallback: " + status);
            Action <GooglePlayGames.Native.Cwrapper.CommonErrorStatus.MultiplayerStatus> action = Callbacks.IntPtrToTempCallback <Action <GooglePlayGames.Native.Cwrapper.CommonErrorStatus.MultiplayerStatus> >(data);

            try
            {
                action(status);
            }
            catch (Exception exception)
            {
                Logger.e("Error encountered executing InternalMultiplayerStatusCallback. Smothering to avoid passing exception into Native: " + exception);
            }
        }
 internal void ShowRoomInboxUI(Action <RoomInboxUIResponse> callback)
 {
     C.RealTimeMultiplayerManager_ShowRoomInboxUI(mGameServices.AsHandle(),
                                                  InternalRoomInboxUICallback,
                                                  Callbacks.ToIntPtr(callback, RoomInboxUIResponse.FromPointer));
 }
Пример #3
0
 internal static void InternalIsCaptureAvailableCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "VideoManager#IsCaptureAvailableCallback", Callbacks.Type.Temporary, response, data);
 }
 internal void FetchInvitations(Action <FetchInvitationsResponse> callback)
 {
     C.RealTimeMultiplayerManager_FetchInvitations(mGameServices.AsHandle(),
                                                   InternalFetchInvitationsCallback,
                                                   Callbacks.ToIntPtr(callback, FetchInvitationsResponse.FromPointer));
 }
 internal static void InternalPlayerSelectUIcallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "RealtimeManager#PlayerSelectUICallback", Callbacks.Type.Temporary, response, data);
 }
Пример #6
0
 internal void ShowPlayerSelectUI(uint minimumPlayers, uint maxiumPlayers,
                                  bool allowAutomatching, Action <PlayerSelectUIResponse> callback)
 {
     TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_ShowPlayerSelectUI(mGameServices.AsHandle(), minimumPlayers,
                                                                                maxiumPlayers, allowAutomatching, InternalPlayerSelectUIcallback,
                                                                                Callbacks.ToIntPtr(callback, PlayerSelectUIResponse.FromPointer));
 }
Пример #7
0
        private static void InternalOnMultiplayerInvitationEventCallback(Types.MultiplayerEvent eventType, string matchId, IntPtr match, IntPtr userData)
        {
            Action <Types.MultiplayerEvent, string, GooglePlayGames.Native.PInvoke.MultiplayerInvitation> action = Callbacks.IntPtrToPermanentCallback <Action <Types.MultiplayerEvent, string, GooglePlayGames.Native.PInvoke.MultiplayerInvitation> >(userData);

            GooglePlayGames.Native.PInvoke.MultiplayerInvitation invitation = GooglePlayGames.Native.PInvoke.MultiplayerInvitation.FromPointer(match);
            try
            {
                if (action != null)
                {
                    action(eventType, matchId, invitation);
                }
            }
            catch (Exception exception)
            {
                Logger.e("Error encountered executing InternalOnMultiplayerInvitationEventCallback. Smothering to avoid passing exception into Native: " + exception);
            }
            finally
            {
                if (invitation != null)
                {
                    invitation.Dispose();
                }
            }
        }
Пример #8
0
 internal void ShowPlayerSelectUI(uint minimumPlayers, uint maxiumPlayers, bool allowAutomatching, Action <PlayerSelectUIResponse> callback)
 {
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_ShowPlayerSelectUI(this.mGameServices.AsHandle(), minimumPlayers, maxiumPlayers, allowAutomatching, new RealTimeMultiplayerManager.PlayerSelectUICallback(RealtimeManager.InternalPlayerSelectUIcallback), Callbacks.ToIntPtr <PlayerSelectUIResponse>(callback, new Func <IntPtr, PlayerSelectUIResponse>(PlayerSelectUIResponse.FromPointer)));
 }
Пример #9
0
 internal void ShowRoomInboxUI(Action <RealtimeManager.RoomInboxUIResponse> callback)
 {
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_ShowRoomInboxUI(this.mGameServices.AsHandle(), new RealTimeMultiplayerManager.RoomInboxUICallback(RealtimeManager.InternalRoomInboxUICallback), Callbacks.ToIntPtr <RealtimeManager.RoomInboxUIResponse>(callback, new Func <IntPtr, RealtimeManager.RoomInboxUIResponse>(RealtimeManager.RoomInboxUIResponse.FromPointer)));
 }
Пример #10
0
 internal void SendReliableMessage(NativeRealTimeRoom room, MultiplayerParticipant participant, byte[] data, Action <CommonErrorStatus.MultiplayerStatus> callback)
 {
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_SendReliableMessage(this.mGameServices.AsHandle(), room.AsPointer(), participant.AsPointer(), data, PInvokeUtilities.ArrayToSizeT <byte>(data), new RealTimeMultiplayerManager.SendReliableMessageCallback(RealtimeManager.InternalSendReliableMessageCallback), Callbacks.ToIntPtr((Delegate)callback));
 }
Пример #11
0
 private static IntPtr ToCallbackPointer(Action <RealtimeManager.RealTimeRoomResponse> callback)
 {
     return(Callbacks.ToIntPtr <RealtimeManager.RealTimeRoomResponse>(callback, new Func <IntPtr, RealtimeManager.RealTimeRoomResponse>(RealtimeManager.RealTimeRoomResponse.FromPointer)));
 }
Пример #12
0
 internal void LeaveRoom(NativeRealTimeRoom room, Action <CommonErrorStatus.ResponseStatus> callback)
 {
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_LeaveRoom(this.mGameServices.AsHandle(), room.AsPointer(), new RealTimeMultiplayerManager.LeaveRoomCallback(RealtimeManager.InternalLeaveRoomCallback), Callbacks.ToIntPtr((Delegate)callback));
 }
Пример #13
0
 internal static void InternalFetchCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback("EventManager#FetchCallback", Callbacks.Type.Temporary, response, data);
 }
Пример #14
0
 internal void Fetch(Types.DataSource source, string eventId, Action <EventManager.FetchResponse> callback)
 {
     GooglePlayGames.Native.Cwrapper.EventManager.EventManager_Fetch(this.mServices.AsHandle(), source, eventId, new GooglePlayGames.Native.Cwrapper.EventManager.FetchCallback(EventManager.InternalFetchCallback), Callbacks.ToIntPtr <EventManager.FetchResponse>(callback, new Func <IntPtr, EventManager.FetchResponse>(EventManager.FetchResponse.FromPointer)));
 }
 internal static void InternalOnRoomConnectedSetChangedCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "RealTimeEventListenerHelper#InternalOnRoomConnectedSetChangedCallback",
         Callbacks.Type.Permanent, response, data);
 }
Пример #16
0
 internal void ShowWaitingRoomUI(NativeRealTimeRoom room, uint minimumParticipantsBeforeStarting, Action <RealtimeManager.WaitingRoomUIResponse> callback)
 {
     Misc.CheckNotNull <NativeRealTimeRoom>(room);
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_ShowWaitingRoomUI(this.mGameServices.AsHandle(), room.AsPointer(), minimumParticipantsBeforeStarting, new RealTimeMultiplayerManager.WaitingRoomUICallback(RealtimeManager.InternalWaitingRoomUICallback), Callbacks.ToIntPtr <RealtimeManager.WaitingRoomUIResponse>(callback, new Func <IntPtr, RealtimeManager.WaitingRoomUIResponse>(RealtimeManager.WaitingRoomUIResponse.FromPointer)));
 }
Пример #17
0
 internal void ShowInboxUI(Action <MatchInboxUIResponse> callback)
 {
     TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_ShowMatchInboxUI(mGameServices.AsHandle(),
                                                                              InternalMatchInboxUICallback,
                                                                              Callbacks.ToIntPtr <MatchInboxUIResponse>(callback, MatchInboxUIResponse.FromPointer));
 }
Пример #18
0
 internal void FetchInvitations(Action <RealtimeManager.FetchInvitationsResponse> callback)
 {
     RealTimeMultiplayerManager.RealTimeMultiplayerManager_FetchInvitations(this.mGameServices.AsHandle(), new RealTimeMultiplayerManager.FetchInvitationsCallback(RealtimeManager.InternalFetchInvitationsCallback), Callbacks.ToIntPtr <RealtimeManager.FetchInvitationsResponse>(callback, new Func <IntPtr, RealtimeManager.FetchInvitationsResponse>(RealtimeManager.FetchInvitationsResponse.FromPointer)));
 }
Пример #19
0
 internal static void InternalTurnBasedMatchesCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "TurnBasedManager#TurnBasedMatchesCallback", Callbacks.Type.Temporary, response, data);
 }
        internal static void InternalOnDataReceived(IntPtr room, IntPtr participant, IntPtr data, UIntPtr dataLength, bool isReliable, IntPtr userData)
        {
            Logger.d("Entering InternalOnDataReceived: " + userData.ToInt64());
            Action <NativeRealTimeRoom, MultiplayerParticipant, byte[], bool> action = Callbacks.IntPtrToPermanentCallback <Action <NativeRealTimeRoom, MultiplayerParticipant, byte[], bool> >(userData);

            using (NativeRealTimeRoom room2 = NativeRealTimeRoom.FromPointer(room))
            {
                using (MultiplayerParticipant participant2 = MultiplayerParticipant.FromPointer(participant))
                {
                    if (action != null)
                    {
                        byte[] destination = null;
                        if (dataLength.ToUInt64() != 0L)
                        {
                            destination = new byte[dataLength.ToUInt32()];
                            Marshal.Copy(data, destination, 0, (int)dataLength.ToUInt32());
                        }
                        try
                        {
                            action(room2, participant2, destination, isReliable);
                        }
                        catch (Exception exception)
                        {
                            Logger.e("Error encountered executing InternalOnDataReceived. Smothering to avoid passing exception into Native: " + exception);
                        }
                    }
                }
            }
        }
 internal static void InternalFetchInvitationsCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "RealtimeManager#InternalFetchInvitationsCallback",
         Callbacks.Type.Temporary, response, data);
 }
 internal void SetOnAuthStartedCallback(AuthStartedCallback callback)
 {
     C.GameServices_Builder_SetOnAuthActionStarted(SelfPtr(), InternalAuthStartedCallback,
                                                   Callbacks.ToIntPtr(callback));
 }
 internal void SendReliableMessage(NativeRealTimeRoom room, MultiplayerParticipant participant,
                                   byte[] data, Action <Status.MultiplayerStatus> callback)
 {
     C.RealTimeMultiplayerManager_SendReliableMessage(mGameServices.AsHandle(),
                                                      room.AsPointer(), participant.AsPointer(), data, PInvokeUtilities.ArrayToSizeT(data),
                                                      InternalSendReliableMessageCallback, Callbacks.ToIntPtr(callback));
 }
Пример #24
0
 internal void SetOnMessageReceivedCallback(OnMessageReceived callback)
 {
     MessageListenerHelper.MessageListenerHelper_SetOnMessageReceivedCallback(SelfPtr(), InternalOnMessageReceivedCallback, Callbacks.ToIntPtr(callback));
 }
 internal static void InternalRoomInboxUICallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "RealtimeManager#InternalRoomInboxUICallback",
         Callbacks.Type.Temporary, response, data);
 }
Пример #26
0
 internal void SetOnDisconnectedCallback(Action <long, string> callback)
 {
     MessageListenerHelper.MessageListenerHelper_SetOnDisconnectedCallback(SelfPtr(), InternalOnDisconnectedCallback, Callbacks.ToIntPtr(callback));
 }
Пример #27
0
 internal static void InternalCaptureCapabilitiesCallback(IntPtr response, IntPtr data)
 {
     Callbacks.PerformInternalCallback(
         "VideoManager#CaptureCapabilitiesCallback", Callbacks.Type.Temporary, response, data);
 }
 private static void InternalIntentHandler(IntPtr intent, IntPtr userData)
 {
     Callbacks.PerformInternalCallback("AndroidPlatformConfiguration#InternalIntentHandler",
                                       Callbacks.Type.Permanent, intent, userData);
 }
 internal void SetOptionalIntentHandlerForUI(Action <IntPtr> intentHandler)
 {
     Misc.CheckNotNull(intentHandler);
     C.AndroidPlatformConfiguration_SetOptionalIntentHandlerForUI(SelfPtr(),
                                                                  InternalIntentHandler, Callbacks.ToIntPtr(intentHandler));
 }
Пример #30
0
 internal void GetAllTurnbasedMatches(Action <TurnBasedMatchesResponse> callback)
 {
     TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_FetchMatches(this.mGameServices.AsHandle(), new TurnBasedMultiplayerManager.TurnBasedMatchesCallback(TurnBasedManager.InternalTurnBasedMatchesCallback), Callbacks.ToIntPtr <TurnBasedMatchesResponse>(callback, new Func <IntPtr, TurnBasedMatchesResponse>(TurnBasedMatchesResponse.FromPointer)));
 }