Google-Play-Services: Creating custom waiting room UI

前端 未结 1 1821
Happy的楠姐
Happy的楠姐 2021-01-14 15:51

I am about to implement a real-time-multiplayer for my android application with the google play games services and got some problems to listen to room updates. Iam not that

1条回答
  •  没有蜡笔的小新
    2021-01-14 15:58

    Since nobody was able to answer my question or whatever, I think it is valid to provide my result of investigation as an answer myself.

    I was able to find the important method calls, which are needed for a custom UI implementation. They are basically located in the two interfaces RoomUpdateListener and RoomStatusUpdateListener and need to be provided to the RoomConfig.Builder.

    The lifecycle of a game is like the following:

    Step 1

    • create the room via

    Games.RealTimeMultiplayer.create(mGoogleApiClient, rtmConfigBuilder.build());

    Step 2

    • RoomUpdateListener: onRoomCreated The client attempts to create a real-time room.

    Step 3

    • RoomStatusUpdateListener: onPeerJoined Called when one or more peer participants join a room.
    • RoomStatusUpdateListener: onRoomConnecting One or more participants have joined the room and have started the process of establishing peer connections
    • RoomStatusUpdateListener: onP2PConnected Client is successfully connected to a peer participant.
    • RoomStatusUpdateListener: onConnectedToRoom The client is connected to the connected set in a room.
    • RoomStatusUpdateListener: onPeersConnected Called when one or more peer participants join a room.

    Step 4

    • RoomUpdateListener: onRoomConnected All the participants in a real-time room are fully connected.

    That's it. Now the participants are connected and can send messages via Games.RealTimeMultiplayer.sendReliableMessage and the other send methods.

    0 讨论(0)
提交回复
热议问题