2012-12-11 2 views
0

나는 Game Center 용 게임을 개발 해왔다. 게임의멀티 플레이어 게임에서 데이터를 동기화하는 방법 (게임 센터 이모)

설명 : - 게임은 5 타일 맵 (하나의 타일 맵 중 하나 선수 (개시)에 의해 무작위로 선택된다) 때문에

한 플레이어는 게임의 개시이다. 초 기자가 선택한 타일 맵을 두 번째 플레이어에게 보냅니다.이 타일 맵은 두 번째 플레이어 측에서 그려집니다. (이 시점에서 두 플레이어는 같은 타일 맵을 사용합니다)

초대장을 보내 게임을 시작할 때 플레이어에게.

하지만 "automatch"로 게임을 시작하면 초보자가 될 사람을 찾을 수 없습니다 (임의로 선택한 타일 맵을 보낼 사람).

는이 코드에 의해 하나의 플레이어 개시를 만든

: game-에서 나는 자동 매치를 해제 할 수있는 방법 데이터 동기화가 "자동 게임"에서 가능하지 않다

isThisInvited_Player = YES; 
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_INVITATION_ACCEPTED object:nil]; 


- (void)authenticationChanged {  

    if ([GKLocalPlayer localPlayer].isAuthenticated && !userAuthenticated) { 
     userAuthenticated = TRUE; 

    [GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite) { 

     isThisInvited_Player = YES; 
     self.pendingInvite = acceptedInvite; 
     self.pendingPlayersToInvite = playersToInvite; 
     [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_INVITATION_ACCEPTED object:nil]; 

    }; 

} else if (![GKLocalPlayer localPlayer].isAuthenticated && userAuthenticated) { 
    userAuthenticated = FALSE; 
} 

} 

있다면, 제발 말해, (재생) 버튼을 센터 뷰 컨트롤러.

답변

1

두 명의 플레이어를 playerID별로 정렬 한 다음 초기화 된 플레이어의 첫 번째 플레이어를 정렬 자로 지정할 수 있습니다.

+0

완벽한 솔루션입니다 ...... –

관련 문제