Actionscript 3 AdobeAIR原生扩展游戏套件,由Vitapoly提供。如何接受邀请?
我正在尝试制作实时游戏。当玩家接受邀请时,realTimeMatchesController将发送一个INVITE\u ACCEPTED\u事件。但是realTimeMatchesController.currentMatch为空。和MATCH\u MAKER\u发现\u MATCH\u事件事件未分派。所以游戏就停留在这一点上 如何在发送INVITE_ACCEPTED_事件时创建匹配 下面是示例代码Actionscript 3 AdobeAIR原生扩展游戏套件,由Vitapoly提供。如何接受邀请?,actionscript-3,air,game-center,air-native-extension,Actionscript 3,Air,Game Center,Air Native Extension,我正在尝试制作实时游戏。当玩家接受邀请时,realTimeMatchesController将发送一个INVITE\u ACCEPTED\u事件。但是realTimeMatchesController.currentMatch为空。和MATCH\u MAKER\u发现\u MATCH\u事件事件未分派。所以游戏就停留在这一点上 如何在发送INVITE_ACCEPTED_事件时创建匹配 下面是示例代码 public function GameCenter() { if (!GameKit.is
public function GameCenter()
{
if (!GameKit.isSupported)
{
return;
}
_gamekit = GameKit.instance;
_gamekit.addEventListener(GameKit.LOCAL_PLAYER_AUTHENTICATED_EVENT, localPlayerAuthenticated);
_gamekit.addEventListener(GameKit.LOCAL_PLAYER_NOT_AUTHENTICATED_EVENT, localPlayerNotAuthenticated);
_gamekit.authenticateLocalPlayer();
_gamekit.realTimeMatchesController.addEventListener(RealTimeMatchesController.INVITE_PLAYERS_EVENT, invitePlayersHandler);
_gamekit.realTimeMatchesController.addEventListener(RealTimeMatchesController.INVITE_ACCEPTED_EVENT, inviteAcceptedHandler);
_gamekit.realTimeMatchesController.init();
_gamekit.realTimeMatchesController.addEventListener(RealTimeMatchesController.MATCH_MAKER_CANCELLED_EVENT, matchMakerCancelled);
_gamekit.realTimeMatchesController.addEventListener(RealTimeMatchesController.MATCH_MAKER_FAILED_EVENT, matchMakerFailed);
_gamekit.realTimeMatchesController.addEventListener(RealTimeMatchesController.MATCH_MAKER_FOUND_MATCH_EVENT, matchMakerFoundMatch);
}
// inviter create the match
public function createMatch():void{
_gamekit.realTimeMatchesController.startMatch(minPlayers, maxPlayers, playerGroup);
}
private function inviteAcceptedHandler(e:InviteAcceptedEvent):void
{
// how to start a match here?
}
private function matchMakerFoundMatch(e:MatchEvent):void
{
// save the match
_currentMatch = e.realTimeMatch;
_currentMatch.addEventListener(RealTimeMatch.RECEIVED_DATA_EVENT, dataReceivedHandler);
if (_currentMatch.expectedPlayerCount == 0)
{
startGame();
}
}