Deciding who is player one and two in a round based game with Google Play Game Services

前端 未结 2 1379
独厮守ぢ
独厮守ぢ 2021-01-17 23:39

I have a round-based Multiplayer game for Android that has been working over XMPP before, and I want to switch to Google Play Game Services. In the old version, there was an

2条回答
  •  天涯浪人
    2021-01-18 00:32

    I have solved the problem by comparing the player ids (which are random for each game):

    String myid = mActiveRoom.getParticipantId(client.getCurrentPlayerId());
    String remoteId = null;
    
    ArrayList ids = mActiveRoom.getParticipantIds();
    for(int i=0; i 0 );
    

提交回复
热议问题