예제 #1
0
 internal GKInviteEventListenerForwarder()
     : this(C.GKInviteEventListener_new(
                InternalDidAcceptInviteCallback,
                InternalDidRequestMatchWithRecipientsCallback))
 {
     // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
     CFType.CFRelease(this.ToPointer());
 }
예제 #2
0
 internal GKTurnBasedMatchmakerViewControllerDelegateForwarder()
     : this(C.GKTurnBasedMatchmakerViewControllerDelegate_new(
                InternalWasCancelledCallback,
                InternalDidFailWithErrorCallback,
                null /* didFindMatch is obsolete so we'll ignore it */))
 {
     // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
     CFType.CFRelease(this.ToPointer());
 }
예제 #3
0
 internal GKTurnBasedEventListenerForwarder()
     : this(C.GKTurnBasedEventListener_new(
                InternalDidRequestMatchWithOtherPlayersCallback,
                InternalMatchEndedCallback,
                InternalReceivedTurnEventForMatchCallback,
                InternalWantsToQuitMatchCallback))
 {
     // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
     CFType.CFRelease(this.ToPointer());
 }
예제 #4
0
 internal GKMatchmakerViewControllerDelegateForwarder()
     : this(C.GKMatchmakerViewControllerDelegate_new(
                InternalMatchmakerViewControllerDidFindMatchCallback,
                InternalMatchmakerViewControllerDidFindHostedPlayersCallback,
                InternalMatchmakerViewControllerWasCancelledCallback,
                InternalMatchmakerViewControllerDidFailWithErrorCallback,
                InternalMatchmakerViewControllerHostedPlayerDidAcceptCallback))
 {
     // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
     CFType.CFRelease(this.ToPointer());
 }
 internal GKMatchDelegateForwarder()
     : this(C.GKMatchDelegate_new(
                InternalMatchDidReceiveDataForRecipientCallback,
                InternalMatchDidReceiveDataCallback,
                InternalPlayerDidChangeConnectionStateCallback,
                InternalMatchDidFailWithErrorCallback,
                InternalShouldReinviteDisconnectedPlayerCallback))
 {
     // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
     CFType.CFRelease(this.ToPointer());
 }
        internal GKLocalPlayerListenerForwarder(GKInviteEventListenerForwarder inviteEventListenerForwarder,
                                                GKTurnBasedEventListenerForwarder turnBasedEventListenerForwarder)
            : this(C.GKLocalPlayerListener_new(
                       inviteEventListenerForwarder != null ? inviteEventListenerForwarder.ToPointer() : IntPtr.Zero,
                       turnBasedEventListenerForwarder != null ? turnBasedEventListenerForwarder.ToPointer() : IntPtr.Zero))
        {
            // We're using a pointer returned by a native constructor: call CFRelease to balance native ref count
            CFType.CFRelease(this.ToPointer());

            // Store the sub-forwarders.
            this.mInviteEventListenerForwarder    = inviteEventListenerForwarder;
            this.mTurnBasedEventListenerForwarder = turnBasedEventListenerForwarder;
        }
예제 #7
0
        /// <summary>
        /// Transmits data to all players connected to the match.
        /// </summary>
        /// <returns><c>true</c>, if data to all players was sent, <c>false</c> otherwise.</returns>
        /// <param name="data">Data.</param>
        /// <param name="mode">Mode.</param>
        /// <param name="error">Error.</param>
        public bool SendDataToAllPlayers(byte[] data, GKMatchSendDataMode mode, out NSError error)
        {
            Util.NullArgumentTest(data);

            IntPtr errorPtr = new IntPtr();
            bool   success  = C.GKMatch_sendDataToAllPlayers(
                SelfPtr(),
                data,
                data.Length,
                mode,
                ref errorPtr);

            error = null;
            if (PInvokeUtil.IsNotNull(errorPtr))
            {
                error = new NSError(errorPtr);
                CFType.CFRelease(errorPtr);     // balance out ref count of a pointer returned directly from native side.
            }

            return(success);
        }