2012-05-03 2 views
3

누군가 GameCenter에서 나에게 도움이되는지 궁금합니다. 내 첫 번째 멀티 플레이어 앱을 만들고 있는데 데이터를 가져 와서 내 인터페이스를 만들 수 있는지 궁금합니다 ...GameCenter 정보

기본적으로 현재 진행중인 게임을 표시하기 위해 내 UI를 사용하고 싶습니다. 당신은 당신의 차례를 기다리고 있거나 그것이 당신의 차례라면 게임의 다른 세부 사항들도 가지고 있습니다. 이것이 가능한가? 또는 GameCenter UI를 통해서만 현재 게임에 액세스 할 수 있습니까?

또한 내가 스킨을 만들거나 적어도 데이터를 가져 와서 직접 스킨을 만들 수 있다면 가능한 한 GameCenter UI를 거의 사용하지 않고 GameCenter 주변에 앱을 만들 수 있습니까? 나는 기본적으로 단지 몇 번의 클릭만으로 GameCenter에 던져지기보다는 사용자가 내 게임 환경에 동봉되기를 원합니다. 이해가 되니?

모든 통찰력을 바랍니다! 대단히 고마워!

답변

3

이 작업을 수행 할 수 있습니다. 이 방법은 진행중인 게임이있는 UITableView를 표시하는 데 필요한 모든 데이터를 가져 오는 것입니다. 여기에 전체 커스텀 턴 기반 gamecenter 뷰를위한 코드가 길어질 것입니다. 이 항목에 대한

- (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; 
} 

전체 튜토리얼 레이 Wenderlich의 튜토리얼 팀 자습서에 의해에서 iOS 5에 : 당신이 테이블에 대한 냈다 코드를 보면 아마 당신은 개념의 아이디어를 얻을. 너는 기분이 좋다면, 아프고 가서 다음 링크를 따라 가라. http://www.raywenderlich.com/store/ios-5-by-tutorials This is what you get

관련 문제