actionscript 3 - Adobe AIR Native Extension Game Kit by Vitapoly. How accept invitation? -
i’m trying make real time game. when player accepts invitation, realtimematchescontroller dispatch invite_accepted_event event. realtimematchescontroller.currentmatch null. , match_maker_found_match_event events not dispatches. game stuck @ point.
how create match, when invite_accepted_event dispatched?
here sample code
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 match public function creatematch():void{ _gamekit.realtimematchescontroller.startmatch(minplayers, maxplayers, playergroup); } private function inviteacceptedhandler(e:inviteacceptedevent):void { // how start match here? } private function matchmakerfoundmatch(e:matchevent):void { // save match _currentmatch = e.realtimematch; _currentmatch.addeventlistener(realtimematch.received_data_event, datareceivedhandler); if (_currentmatch.expectedplayercount == 0) { startgame(); } }
Comments
Post a Comment