com.google.android.gms.games.multiplayer.Participant Java Examples
The following examples show how to use
com.google.android.gms.games.multiplayer.Participant.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RealTimeMultiplayer.java From godot-gpgs with MIT License | 5 votes |
public void sendBroadcastMessage(String msg) { for (Participant participant: participants) { String participantId = participant.getParticipantId(); if (!participantId.equals(myId)) { sendReliableMessage(msg, participantId); } } }
Example #2
Source File: RoomController.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override public void onRoomConnected(final int statusCode, final Room room) { Logger.log("room connected, status ok: " + (statusCode == GamesStatusCodes.STATUS_OK)); if (statusCode != GamesStatusCodes.STATUS_OK) { die(false, Config.thesaurus.localize("disconnect-game-services-error")); return; } RoomController.this.room = room; session.setVariant(room.getVariant()); String playerId = room.getParticipantId(Games.Players.getCurrentPlayerId(multiplayer.client)); for (Participant participant : room.getParticipants()) { if (participant.getStatus() != Participant.STATUS_JOINED) continue; if (participant.getParticipantId().equals(playerId)) { me = new MultiplayerParticipant(participant); } else { others.add(new MultiplayerParticipant(participant)); } } all.put(me.getId(), me); for (MultiplayerParticipant p : others) { all.put(p.getId(), p); } publicOthers = new ObjectSet<IParticipant>(others); publicAll = new ObjectMap<String, IParticipant>(all); multiplayer.updateInvites(); Logger.log(" - room: " + RoomController.this.toString(room)); }
Example #3
Source File: DrawingActivity.java From 8bitartist with Apache License 2.0 | 5 votes |
@Override public void onConnectedToRoom(Room room) { Log.d(TAG, "onConnectedRoRoom: " + room); mRoom = room; // Add self to participants mMyPersistentId = mRoom.getParticipantId( Games.Players.getCurrentPlayerId(mGoogleApiClient)); Participant me = mRoom.getParticipant(mMyPersistentId); onParticipantConnected(me); updateTurnIndices(); updateViewVisibility(); }
Example #4
Source File: DrawingParticipant.java From 8bitartist with Apache License 2.0 | 5 votes |
/** * Initialize for a remote (RTMP) player */ public DrawingParticipant(Participant participant) { isLocal = false; this.messagingId = participant.getParticipantId(); this.persistentId = participant.getParticipantId(); this.displayName = participant.getDisplayName(); this.iconImageUri = participant.getIconImageUri(); this.score = 0; }
Example #5
Source File: MainActivity.java From android-basic-samples with Apache License 2.0 | 5 votes |
void updatePeerScoresDisplay() { ((TextView) findViewById(R.id.score0)).setText( getString(R.string.score_label, formatScore(mScore))); int[] arr = { R.id.score1, R.id.score2, R.id.score3 }; int i = 0; if (mRoomId != null) { for (Participant p : mParticipants) { String pid = p.getParticipantId(); if (pid.equals(mMyId)) { continue; } if (p.getStatus() != Participant.STATUS_JOINED) { continue; } int score = mParticipantScore.containsKey(pid) ? mParticipantScore.get(pid) : 0; ((TextView) findViewById(arr[i])).setText(formatScore(score) + " - " + p.getDisplayName()); ++i; } } for (; i < arr.length; ++i) { ((TextView) findViewById(arr[i])).setText(""); } }
Example #6
Source File: MultiplayerParticipant.java From dice-heroes with GNU General Public License v3.0 | 4 votes |
public MultiplayerParticipant(Participant participant) { this.participant = participant; }
Example #7
Source File: DrawingActivity.java From 8bitartist with Apache License 2.0 | 4 votes |
/** * RTMP Participant joined, register the DrawingParticipant if the Participant is connected. * * @param p the Participant from the Real-Time Multiplayer match. */ private void onParticipantConnected(Participant p) { if (p.isConnectedToRoom()) { onParticipantConnected(new DrawingParticipant(p)); } }
Example #8
Source File: Match.java From chess with Apache License 2.0 | 4 votes |
public ArrayList<Participant> getParticipants() { return turnBasedMatch.getParticipants(); }