【问题标题】:Turn-based Multiplayer Game cannot finish in Google Play Game Services回合制多人游戏无法在 Google Play 游戏服务中完成
【发布时间】:2014-10-04 08:25:53
【问题描述】:

我正在使用基于回合的多人游戏。 玩家 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"}]}

在示例 SkeletonActivity.java 中使用 finishMatch 可以正常工作,但不会产生获胜者:

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

【问题讨论】:

    标签: android google-play-services google-play-games


    【解决方案1】:

    好吧,我搞砸了 nubers。必须设置参与者 ID,类似于 p_1 而不是数字

    myOponentParticipantId

    【讨论】:

      猜你喜欢
      • 2014-03-07
      • 1970-01-01
      • 2015-05-22
      • 2016-06-24
      • 2014-09-17
      • 2014-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多