Package apple.gamekit

Class GKTurnBasedMatch

  • All Implemented Interfaces:
    NSObject

    public class GKTurnBasedMatch
    extends NSObject
    • Constructor Detail

      • GKTurnBasedMatch

        protected GKTurnBasedMatch​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static GKTurnBasedMatch allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • findMatchForRequestWithCompletionHandler

        public static void findMatchForRequestWithCompletionHandler​(@NotNull
                                                                    @NotNull GKMatchRequest request,
                                                                    @NotNull
                                                                    @NotNull GKTurnBasedMatch.Block_findMatchForRequestWithCompletionHandler completionHandler)
        Attempt to find a turn-based match for the specified request. Error will be nil on success. Possible reasons for error: 1. Communications failure 2. Unauthenticated player
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • loadMatchWithIDWithCompletionHandler

        public static void loadMatchWithIDWithCompletionHandler​(@NotNull
                                                                @NotNull java.lang.String matchID,
                                                                @Nullable
                                                                @Nullable GKTurnBasedMatch.Block_loadMatchWithIDWithCompletionHandler completionHandler)
        load a match based on a previously known match ID API-Since: 5.0
      • loadMatchesWithCompletionHandler

        public static void loadMatchesWithCompletionHandler​(@Nullable
                                                            @Nullable GKTurnBasedMatch.Block_loadMatchesWithCompletionHandler completionHandler)
        This method retrieves the list of GKTurnBasedMatches that the current player is or has participated in. The callback’s array contains GKTurnBasedMatches
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • acceptInviteWithCompletionHandler

        public void acceptInviteWithCompletionHandler​(@Nullable
                                                      @Nullable GKTurnBasedMatch.Block_acceptInviteWithCompletionHandler completionHandler)
        If the local participant has status invited then accept the invite, otherwise returns an error API-Since: 5.0
      • activeExchanges

        @Nullable
        public @Nullable NSArray<? extends GKTurnBasedExchange> activeExchanges()
        returns the exchanges that currently await a reply from the local player API-Since: 7.0
      • completedExchanges

        @Nullable
        public @Nullable NSArray<? extends GKTurnBasedExchange> completedExchanges()
        returns the exchanges that have been completed and need to be merged by the local participant. This will be nil unless the local participant is the current turn holder for this match API-Since: 7.0
      • creationDate

        @Nullable
        public @Nullable NSDate creationDate()
      • currentParticipant

        @Nullable
        public @Nullable GKTurnBasedParticipant currentParticipant()
        This indicates the participant who has the current turn. This is set by passing the next participant into endTurnWithNextParticipant:matchData:completionHandler:
      • declineInviteWithCompletionHandler

        public void declineInviteWithCompletionHandler​(@Nullable
                                                       @Nullable GKTurnBasedMatch.Block_declineInviteWithCompletionHandler completionHandler)
        If the local participant has status invited then decline the invite, otherwise returns an error API-Since: 5.0
      • endMatchInTurnWithMatchDataCompletionHandler

        public void endMatchInTurnWithMatchDataCompletionHandler​(@NotNull
                                                                 @NotNull NSData matchData,
                                                                 @Nullable
                                                                 @Nullable GKTurnBasedMatch.Block_endMatchInTurnWithMatchDataCompletionHandler completionHandler)
        This will end the match for all participants. You must set each participant’s matchOutcome before calling this method. All completed exchanges must be resolved or canceled before calling this.
      • endMatchInTurnWithMatchDataScoresAchievementsCompletionHandler

        @Deprecated
        public void endMatchInTurnWithMatchDataScoresAchievementsCompletionHandler​(@NotNull
                                                                                   @NotNull NSData matchData,
                                                                                   @Nullable
                                                                                   @Nullable NSArray<? extends GKScore> scores,
                                                                                   @Nullable
                                                                                   @Nullable NSArray<? extends GKAchievement> achievements,
                                                                                   @Nullable
                                                                                   @Nullable GKTurnBasedMatch.Block_endMatchInTurnWithMatchDataScoresAchievementsCompletionHandler completionHandler)
        Deprecated.
        This will end the match and submit scores and achievements for all participants. Scores should be submitted for all involved players, and multiple scores may be submitted for each to different leaderboards. Earned achievements may also be submitted for any participants. You must set each participant’s matchOutcome before calling this method. All completed exchanges must be resolved or canceled before calling this. API-Since: 6.0 Deprecated-Since: 14.0
      • endTurnWithNextParticipantsTurnTimeoutMatchDataCompletionHandler

        public void endTurnWithNextParticipantsTurnTimeoutMatchDataCompletionHandler​(@NotNull
                                                                                     @NotNull NSArray<? extends GKTurnBasedParticipant> nextParticipants,
                                                                                     double timeout,
                                                                                     @NotNull
                                                                                     @NotNull NSData matchData,
                                                                                     @Nullable
                                                                                     @Nullable GKTurnBasedMatch.Block_endTurnWithNextParticipantsTurnTimeoutMatchDataCompletionHandler completionHandler)
        Ends the current player's turn. You may update the matchOutcome for any GKTurnBasedPlayerInfos that you wish to before ending the turn. This will asynchronously report error in these cases: 1. Communications problem 2. Is not current player's turn 3. Session is closed API-Since: 6.0
      • exchangeDataMaximumSize

        public long exchangeDataMaximumSize()
        maximum data allowed for exchange data API-Since: 7.0
      • exchangeMaxInitiatedExchangesPerPlayer

        public long exchangeMaxInitiatedExchangesPerPlayer()
        limit of the number of exchanges that this player can have initiated at a given time API-Since: 7.0
      • exchanges

        @Nullable
        public @Nullable NSArray<? extends GKTurnBasedExchange> exchanges()
        exchanges that are in progress on this match. Once an exchange has completed and has been resolved by merging it into the match data by the current turn holder then it will be removed from this list API-Since: 7.0
      • loadMatchDataWithCompletionHandler

        public void loadMatchDataWithCompletionHandler​(@Nullable
                                                       @Nullable GKTurnBasedMatch.Block_loadMatchDataWithCompletionHandler completionHandler)
        This method fetches the match data and exchanges for this match. This data is the state of the game at this point in time. This may update the status and/or participant properties if they have changed.
      • matchData

        @Nullable
        public @Nullable NSData matchData()
        Developer-defined data representing the current state of the game. This property is nil until loaded by loadMatchDataWithCompletionHandler: The developer can submit updated matchData by passing it into endTurnWithNextParticipant:matchData:completionHandler: or endMatchInTurnWithMatchData:completionHandler:
      • matchDataMaximumSize

        public long matchDataMaximumSize()
        Returns the maximum size for the match data. API-Since: 6.0
      • matchID

        @Nullable
        public @Nullable java.lang.String matchID()
      • message

        @Nullable
        public @Nullable java.lang.String message()
        returns the localizable message in the current locale. Setting this is equivalent to calling [self setLocalizableMessageWithKey:message arguments:nil]
      • participantQuitInTurnWithOutcomeNextParticipantsTurnTimeoutMatchDataCompletionHandler

        public void participantQuitInTurnWithOutcomeNextParticipantsTurnTimeoutMatchDataCompletionHandler​(long matchOutcome,
                                                                                                          @NotNull
                                                                                                          @NotNull NSArray<? extends GKTurnBasedParticipant> nextParticipants,
                                                                                                          double timeout,
                                                                                                          @NotNull
                                                                                                          @NotNull NSData matchData,
                                                                                                          @Nullable
                                                                                                          @Nullable GKTurnBasedMatch.Block_participantQuitInTurnWithOutcomeNextParticipantsTurnTimeoutMatchDataCompletionHandler completionHandler)
        Ends the current player's turn by quitting the match.  The caller must indicate the next player and pass in updated matchData (if used). All completed exchanges must be resolved or canceled before calling this. API-Since: 6.0
      • participantQuitOutOfTurnWithOutcomeWithCompletionHandler

        public void participantQuitOutOfTurnWithOutcomeWithCompletionHandler​(long matchOutcome,
                                                                             @Nullable
                                                                             @Nullable GKTurnBasedMatch.Block_participantQuitOutOfTurnWithOutcomeWithCompletionHandler completionHandler)
        Abandon the match when it is not the current participant's turn. In this there is no update to matchData and no need to set nextParticipant.
      • rematchWithCompletionHandler

        public void rematchWithCompletionHandler​(@Nullable
                                                 @Nullable GKTurnBasedMatch.Block_rematchWithCompletionHandler completionHandler)
        Recreate a previously existing turn based match that ended. A new match with the same set of players will be returned by the completion handler. If multiple players do this then multiple new matches will be created. Error will be nil on success. Possible reasons for error: 1. Communications failure 2. Unauthenticated player API-Since: 6.0
      • removeWithCompletionHandler

        public void removeWithCompletionHandler​(@Nullable
                                                @Nullable GKTurnBasedMatch.Block_removeWithCompletionHandler completionHandler)
        Remove a declined or completed match (one with a matchOutcome set) from the player's list of matches. If using the GKTurnBasedMatchmakerViewController UI, this will remove it from the finished sessions. The developer should not do this without user input.
      • saveCurrentTurnWithMatchDataCompletionHandler

        public void saveCurrentTurnWithMatchDataCompletionHandler​(@NotNull
                                                                  @NotNull NSData matchData,
                                                                  @Nullable
                                                                  @Nullable GKTurnBasedMatch.Block_saveCurrentTurnWithMatchDataCompletionHandler completionHandler)
        saves the matchData for the current turn without ending the turn. If other players have the game running they will receive a handleTurnEventForMatch to indicate that the matchData has changed. This is useful to initialize the game state for the first player when they take their turn or for updating the turn data due to the user taking an irreversible action within their turn. All completed exchanges must be resolved or canceled before calling this. If you are using exchanges use saveMergedMatchData instead. API-Since: 6.0
      • saveMergedMatchDataWithResolvedExchangesCompletionHandler

        public void saveMergedMatchDataWithResolvedExchangesCompletionHandler​(@NotNull
                                                                              @NotNull NSData matchData,
                                                                              @NotNull
                                                                              @NotNull NSArray<? extends GKTurnBasedExchange> exchanges,
                                                                              @Nullable
                                                                              @Nullable GKTurnBasedMatch.Block_saveMergedMatchDataWithResolvedExchangesCompletionHandler completionHandler)
        saves the merged matchData for the current turn without ending the turn and mark the supplied exchanges as resolved meaning that the data has been merged into the match data. If other players have the game running they will receive a handleTurnEventForMatch to indicate that the matchData has changed. It is required that all completed exchanges are resolved before ending a turn. Otherwise calling endTurn, participantQuitInTurnWithOutCome or endMatchInTurn will return an error API-Since: 7.0
      • sendExchangeToParticipantsDataLocalizableMessageKeyArgumentsTimeoutCompletionHandler

        public void sendExchangeToParticipantsDataLocalizableMessageKeyArgumentsTimeoutCompletionHandler​(@NotNull
                                                                                                         @NotNull NSArray<? extends GKTurnBasedParticipant> participants,
                                                                                                         @NotNull
                                                                                                         @NotNull NSData data,
                                                                                                         @NotNull
                                                                                                         @NotNull java.lang.String key,
                                                                                                         @NotNull
                                                                                                         @NotNull NSArray<java.lang.String> arguments,
                                                                                                         double timeout,
                                                                                                         @Nullable
                                                                                                         @Nullable GKTurnBasedMatch.Block_sendExchangeToParticipantsDataLocalizableMessageKeyArgumentsTimeoutCompletionHandler completionHandler)
        Send an exchange request to one or more participants. Each recipient will receive a push notification using supplied localizable message. If any of the participants have an inactive status (GKTurnBasedParticipantStatusDone) then this will return an error.  completionHandler gets passed the updated exchange with identifier, sender and recipients set API-Since: 7.0
      • sendReminderToParticipantsLocalizableMessageKeyArgumentsCompletionHandler

        public void sendReminderToParticipantsLocalizableMessageKeyArgumentsCompletionHandler​(@NotNull
                                                                                              @NotNull NSArray<? extends GKTurnBasedParticipant> participants,
                                                                                              @NotNull
                                                                                              @NotNull java.lang.String key,
                                                                                              @NotNull
                                                                                              @NotNull NSArray<java.lang.String> arguments,
                                                                                              @Nullable
                                                                                              @Nullable GKTurnBasedMatch.Block_sendReminderToParticipantsLocalizableMessageKeyArgumentsCompletionHandler completionHandler)
        Send a reminder to one or more participants. Each recipient will receive a push notification using supplied localizable message. This allows a game to send reminders that a turn or exchange request needs action. On the receiver side this will generate a turn event for the match. API-Since: 7.0
      • setLocalizableMessageWithKeyArguments

        public void setLocalizableMessageWithKeyArguments​(@NotNull
                                                          @NotNull java.lang.String key,
                                                          @Nullable
                                                          @Nullable NSArray<java.lang.String> arguments)
        If the developer wishes to display a message in GKTurnBasedMatchmakerViewController at the end of a turn or end of the match. Only the current participant can set this. Sets a localizable mesage that will be localized on the receiver side if the game is installed and on the sender side as a fallback. The key and arguments offer a subset of formated strings as follows key is a string in a Localizable.strings file for the current localization (which is set by the user’s language preference). key string can be formatted with %@ and %n$@ specifiers to take the variables specified in loc-args arguments is an array of strings that will be substituted using the format string. Notes: The localized message will be evaluated locally from these keys and sent across as well so that devices that do not have the game installed will see the message in the sender's localization The developer can access resulting string using the message property This is a similar concept to the way we handle localization for Push Notifications. See the "Local and Push Notification Programming Guide" for more details. API-Since: 7.0
      • setMessage

        public void setMessage​(@Nullable
                               @Nullable java.lang.String value)
        returns the localizable message in the current locale. Setting this is equivalent to calling [self setLocalizableMessageWithKey:message arguments:nil]
      • status

        public long status()
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.