Reputation: 830
I've looked in the Apple GameKit Programming Guide, as well as the documentation of the GKTurnBasedParticipant to try and figure out how to implement the custom range. Apple docs say:
"Optionally, it may also use an OR operation to include a custom match outcome for your specific game. Game Center does not use the custom value; it exists to allow your game to provide additional information at the end of the match. The custom value must fit in the range provided by the GKTurnBasedMatchOutcomeCustomRange constant." ....
GKTurnBasedMatchOutcomeFourth = 9,
GKTurnBasedMatchOutcomeCustomRange = 0x00FF0000
};
typedef NSInteger GKTurnBasedMatchOutcome;*
I am not sure what to do to make a custom value or string for the outcome of the match. Any help would be appreciated!
Thanks, Tams
Upvotes: 0
Views: 214
Reputation: 21
I think you need to start from 1 rather than 0. Thus:
GKTurnBasedMatchOutcomeCustom0 = 1 | GKTurnBasedMatchOutcomeCustomRange
etc
Otherwise, the match is not considered to be over if you use GKTurnBasedMatchOutcomeCustom0
.
You may want to check it out for yourself.
Upvotes: 2
Reputation: 8050
To create a custom match outcome enum, adapt the following to your purposes:
typedef enum
{
GKTurnBasedMatchOutcomeCustom0 = 0 | GKTurnBasedMatchOutcomeCustomRange,
GKTurnBasedMatchOutcomeCustom1 = 1 | GKTurnBasedMatchOutcomeCustomRange,
GKTurnBasedMatchOutcomeCustom2 = 2 | GKTurnBasedMatchOutcomeCustomRange,
...
GKTurnBasedMatchOutcomeCustomLast = 65536 | GKTurnBasedMatchOutcomeCustomRange
} GKTurnBasedMatchOutcome_Custom;
For example, GKTurnBasedMatchOutcomeCustom1 will be equal to 0xFF0000.
Essentially, you are allowed a maximum of 0xFFFF+1 (65536 in decimal) custom match outcome states.
Upvotes: 1