Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 基于回合的多人游戏无法在Google Play游戏服务中完成_Android_Google Play Services_Google Play Games - Fatal编程技术网

Android 基于回合的多人游戏无法在Google Play游戏服务中完成

Android 基于回合的多人游戏无法在Google Play游戏服务中完成,android,google-play-services,google-play-games,Android,Google Play Services,Google Play Games,我正在使用基于回合的多人游戏。 玩家1开始游戏,玩家2结束游戏。但我总是犯错误 这是玩家2的代码: String playerId = Games.Players.getCurrentPlayerId(getApiClient()); String myOponentId = mMatch.getParticipantId(playerId); opponentResult = new ParticipantResult(myOponentId, Par

我正在使用基于回合的多人游戏。 玩家1开始游戏,玩家2结束游戏。但我总是犯错误

这是玩家2的代码:

String playerId = Games.Players.getCurrentPlayerId(getApiClient());
String myOponentId = mMatch.getParticipantId(playerId);

opponentResult = new ParticipantResult(myOponentId,
                    ParticipantResult.MATCH_RESULT_WIN, 1);
            creatorResult = new ParticipantResult(playerId,
                    ParticipantResult.MATCH_RESULT_LOSS, 2);

Games.TurnBasedMultiplayer.finishMatch(getApiClient(), mMatch.getMatchId(),mMatch.getData(), creatorResult,opponentResult )
                .setResultCallback(new ResultCallback<TurnBasedMultiplayer.UpdateMatchResult>() {
                    @Override
                    public void onResult(TurnBasedMultiplayer.UpdateMatchResult result) {
                        processResult(result);
                    }
                });
在示例SkeletonActivity.java中使用finishMatch是可行的,但不会产生赢家:

Games.TurnBasedMultiplayer.finishMatch(getApiClient(), mMatch.getMatchId()

好吧,我把核弹搞糟了。必须设置参与者ID,该ID类似于p_1,而不是数字

Myoponent参与者ID

Games.TurnBasedMultiplayer.finishMatch(getApiClient(), mMatch.getMatchId()