我使用的是基于回合制的多人游戏。 玩家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);
}
});
日志:
E/Volley﹕ [2816] a.a: Unexpected response code 400 for https://www.googleapis.com/games/v1/turnbasedmatches/ChEKCQixqozpwBoQAhACGAAgARDEt9LOpreWivoB/finish?language=en_GB
E/cc﹕ Failed to finish match: null
W/cc﹕ {"code":400,"errors":[{"message":"Invalid participantId with value 108607338309210360902.","domain":"global","reason":"invalid"}]}
使用像示例中的finishMatch,SkeletonActivity.java正在运行,但不会产生胜利者:
Games.TurnBasedMultiplayer.finishMatch(getApiClient(), mMatch.getMatchId()
答案 0 :(得分:0)
myOponent参与者ID