GameCenter Details

I was wondering if anyone could shed some light on GameCenter for me. I am creating my first multi-user application, and I wonder if I can capture the data and create my own interface with it ...

Basically I want to use my own user interface to show the current games that you are playing, if you are waiting for a turn or, if you want, a turn, etc. with some other details from the game. Is it possible? Or can we only access current games through the GameCenter interface?

Also, if I can hide it, or at least capture the data and skin myself. Is it possible to build an application around the GameCenter using as few GameCenter UI features as possible? I just want the user to be included in my gaming environment, and not immediately rush into GameCenter every few clicks. It makes sense?

Any insight appreciated! Thank you very much!

+3
source share
1 answer

Can you do this. The approach is to get all the data needed to display a UITableView with games in progress. To show here, the code for a fully customized gamecenter turn-based view will be long. Perhaps you understood the concept if you look at the code compressed for the table:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MatchCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];
    }

    GKTurnBasedMatch *match = [[allMyMatches objectAtIndex:indexPath.section ] objectAtIndex:indexPath.row];
    MatchCell *c = (MatchCell *)cell;
    c.match = match;
    c.delegate = self;
    if ([match.matchData length] > 0) {
        NSString *storyString = [NSString stringWithUTF8String:[match.matchData bytes]];
        c.storyText.text = storyString;
        int days = -floor([match.creationDate timeIntervalSinceNow] / (60 * 60 * 24));
        c.statusLabel.text = [NSString stringWithFormat:@"Story started %d days ago and is about %d words", days, [storyString length] / 5];
    }

    if (indexPath.section == 2) {
        [c.quitButton setTitle:@"Remove" forState:UIControlStateNormal];
        [c.quitButton setTitle:@"Remove" forState:UIControlStateNormal];
    }

    return cell;
}

iOS 5 Ray Wenderlich. , : http://www.raywenderlich.com/store/ios-5-by-tutorials This is what you get

+3

All Articles