Android 基于回合的多人游戏无法在Google Play游戏服务中完成
我正在使用基于回合的多人游戏。 玩家1开始游戏,玩家2结束游戏。但我总是犯错误 这是玩家2的代码: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
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()