当前位置: 首页>>代码示例>>Java>>正文


Java Room类代码示例

本文整理汇总了Java中com.google.android.gms.games.multiplayer.realtime.Room的典型用法代码示例。如果您正苦于以下问题:Java Room类的具体用法?Java Room怎么用?Java Room使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Room类属于com.google.android.gms.games.multiplayer.realtime包,在下文中一共展示了Room类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
    Log.d(TAG, "onConnectedToRoom.");

    //get participants and my ID:
    mParticipants = room.getParticipants();
    mMyId = room.getParticipantId(Games.Players.getCurrentPlayerId(mGoogleApiClient));
    
     // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
     if(mRoomId==null)
      mRoomId = room.getRoomId();

    // print out the list of participants (for debug purposes)
    Log.d(TAG, "Room ID: " + mRoomId);
    Log.d(TAG, "My ID " + mMyId);
    Log.d(TAG, "<< CONNECTED TO ROOM>>");
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:18,代码来源:Example.java

示例2: onRoomCreated

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onRoomCreated(int statusCode, Room room) {
    Log.d("ROOM", "onRoomCreated(" + statusCode + ", " + room + ")");
    if (statusCode != GamesCallbackStatusCodes.OK) {
        Log.e("ROOM", "*** Error: onRoomCreated, status " + statusCode);
        showGameError();
        return;
    }

    creator = true;

    // save room ID so we can leave cleanly before the game starts.
    mRoomId = room.getRoomId();
    SpaceRace.messageManager.setRoom(room);

    // show the waiting room UI
    showWaitingRoom(room);
}
 
开发者ID:Augugrumi,项目名称:SpaceRace,代码行数:19,代码来源:AbsRoomActivity.java

示例3: showWaitingRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
void showWaitingRoom(Room room) {
    // minimum number of players required for our game
    // For simplicity, we require everyone to join the game before we start it
    // (this is signaled by Integer.MAX_VALUE).

    final int MIN_PLAYERS = Integer.MAX_VALUE;
    mRealTimeMultiplayerClient.getWaitingRoomIntent(room, MIN_PLAYERS)
            .addOnSuccessListener(new OnSuccessListener<Intent>() {
                @Override
                public void onSuccess(Intent intent) {
                    // show waiting room UI
                    startActivityForResult(intent, RC_WAITING_ROOM);
                }
            })
            .addOnFailureListener(createFailureListener("There was a problem getting the waiting room!"));
}
 
开发者ID:Augugrumi,项目名称:SpaceRace,代码行数:17,代码来源:AbsRoomActivity.java

示例4: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
    Log.d("ROOM", "onConnectedToRoom.");

    //get participants and my ID:
    mParticipants = room.getParticipants();
    mMyId = room.getParticipantId(mPlayerId);

    // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
    if (mRoomId == null) {
        mRoomId = room.getRoomId();
    }

    // print out the list of participants (for debug purposes)
    Log.d("ROOM", "Room ID: " + mRoomId);
    Log.d("ROOM", "My ID " + mMyId);
    Log.d("ROOM", "<< CONNECTED TO ROOM>>");
}
 
开发者ID:Augugrumi,项目名称:SpaceRace,代码行数:19,代码来源:AbsRoomActivity.java

示例5: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
    Log.d(TAG, "onConnectedToRoom.");

    //get participants and my ID:
    participants = room.getParticipants();
    myId = room.getParticipantId(Games.Players.getCurrentPlayerId(googleApiClient));

     // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
     if (roomId == null) roomId = room.getRoomId();

    // print out the list of participants (for debug purposes)
    Log.d(TAG, "Room ID: " + roomId);
    Log.d(TAG, "My ID " + myId);
    Log.d(TAG, "<< CONNECTED TO ROOM>>");
}
 
开发者ID:kloder-games,项目名称:godot-gpgs,代码行数:17,代码来源:RealTimeMultiplayer.java

示例6: getRealTimeWaitingRoomIntent

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
public final android.content.Intent getRealTimeWaitingRoomIntent(Room paramRoom, int paramInt)
{
  // Byte code:
  //   0: aload_0
  //   1: invokevirtual 149	com/google/android/gms/internal/fl:bQ	()Landroid/os/IInterface;
  //   4: checkcast 151	com/google/android/gms/internal/fp
  //   7: aload_1
  //   8: invokeinterface 133 1 0
  //   13: checkcast 710	com/google/android/gms/games/multiplayer/realtime/RoomEntity
  //   16: iload_2
  //   17: invokeinterface 713 3 0
  //   22: astore_3
  //   23: aload_3
  //   24: areturn
  //   25: ldc 169
  //   27: ldc_w 256
  //   30: invokestatic 259	com/google/android/gms/internal/fn:c	(Ljava/lang/String;Ljava/lang/String;)V
  //   33: aconst_null
  //   34: areturn
  //
  // Exception table:
  //   from	to	target	type
  //   0	23	25	android/os/RemoteException
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:25,代码来源:fl.java

示例7: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
    Log.d(LOG_TAG, "onConnectedToRoom.");

    // get room ID, participants and my ID:
    mRoomId = room.getRoomId();
    mParticipants = room.getParticipants();
    mMyId = room.getParticipantId(Games.Players.getCurrentPlayerId(mGoogleApiClient));

    // print out the list of participants (for debug purposes)
    Log.d(LOG_TAG, "Room ID: " + mRoomId);
    Log.d(LOG_TAG, "My ID " + mMyId);
    Log.d(LOG_TAG, "Is mParticipants null " + (mParticipants == null));

    Log.d(LOG_TAG, "<< CONNECTED TO ROOM>>");
}
 
开发者ID:TylerCarberry,项目名称:2048-Battles,代码行数:17,代码来源:MultiplayerActivity.java

示例8: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
       Log.d(TAG, "onConnectedToRoom.");

       // get room ID, participants and my ID:
       mRoomId = room.getRoomId();
       mParticipants = room.getParticipants();
       mMyId = room.getParticipantId(Games.Players.getCurrentPlayerId(getApiClient()));

       // print out the list of participants (for debug purposes)
       //Log.d(TAG, "Room ID: " + mRoomId);
       //Log.d(TAG, "My ID " + mMyId);
       //Log.d(TAG, "<< CONNECTED TO ROOM>>");
       gmsGameVariantNumber = room.getVariant();        
       
       if(isServer()) {
       	imFirstType = -1;
       	sendFirstTypeForStart();
       }
       sendMyStats();
}
 
开发者ID:spdd,项目名称:chessonline,代码行数:22,代码来源:DroidFish.java

示例9: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
  Log.d(TAG, "onConnectedToRoom.");

  //get participants and my ID:
  mParticipants = room.getParticipants();
  mMyId = room.getParticipantId(mPlayerId);

  // save room ID if its not initialized in onRoomCreated() so we can leave cleanly before the game starts.
  if (mRoomId == null) {
    mRoomId = room.getRoomId();
  }

  // print out the list of participants (for debug purposes)
  Log.d(TAG, "Room ID: " + mRoomId);
  Log.d(TAG, "My ID " + mMyId);
  Log.d(TAG, "<< CONNECTED TO ROOM>>");
}
 
开发者ID:playgameservices,项目名称:android-basic-samples,代码行数:19,代码来源:MainActivity.java

示例10: onConnectedToRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onConnectedToRoom(Room room) {
  mParticipants = room.getParticipants();
  mMyId = room.getParticipantId(Games.Players.getCurrentPlayerId(gHelper.getApiClient()));
  updateRoom(room);
  String opponent_player_id;

  SecureRandom rdm = new SecureRandom();
  String sRdm = new BigInteger(130, rdm).toString(32);

  if (mParticipants.get(0).getParticipantId() == mMyId) {
    if (mParticipants.get(1).getPlayer() == null)
      opponent_player_id = sRdm;
    else
      opponent_player_id = mParticipants.get(1).getPlayer().getPlayerId();
  } else {
    if (mParticipants.get(0).getPlayer() == null)
      opponent_player_id = sRdm;
    else
      opponent_player_id = mParticipants.get(0).getPlayer().getPlayerId();
  }
  if (meSentInvitation)
    AchievementsManager.getInstance().checkSocialAchievements(opponent_player_id);
}
 
开发者ID:alcacoop,项目名称:it.alcacoop.fourinaline,代码行数:25,代码来源:BaseGServiceApplication.java

示例11: showWaitingRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
void showWaitingRoom(Room room) {
    // minimum number of players required for our game
    // For simplicity, we require everyone to join the game before we start it
    // (this is signaled by Integer.MAX_VALUE).
    final int MIN_PLAYERS = Integer.MAX_VALUE;
    Intent i = Games.RealTimeMultiplayer.getWaitingRoomIntent(mGoogleApiClient, room, MIN_PLAYERS);

    // show waiting room UI
    startActivityForResult(i, RC_WAITING_ROOM);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:11,代码来源:Example.java

示例12: onRoomCreated

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onRoomCreated(int statusCode, Room room) {
    Log.d(TAG, "onRoomCreated(" + statusCode + ", " + room + ")");
    if (statusCode != GamesStatusCodes.STATUS_OK) {
        Log.e(TAG, "*** Error: onRoomCreated, status " + statusCode);
        showGameError();
        return;
    }

   // save room ID so we can leave cleanly before the game starts.
    mRoomId = room.getRoomId();

    // show the waiting room UI
    showWaitingRoom(room);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:16,代码来源:Example.java

示例13: onRoomConnected

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onRoomConnected(int statusCode, Room room) {
    Log.d(TAG, "onRoomConnected(" + statusCode + ", " + room + ")");
    if (statusCode != GamesStatusCodes.STATUS_OK) {
        Log.e(TAG, "*** Error: onRoomConnected, status " + statusCode);
        showGameError();
        return;
    }
    updateRoom(room);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:11,代码来源:Example.java

示例14: onJoinedRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
@Override
public void onJoinedRoom(int statusCode, Room room) {
    Log.d(TAG, "onJoinedRoom(" + statusCode + ", " + room + ")");
    if (statusCode != GamesStatusCodes.STATUS_OK) {
        Log.e(TAG, "*** Error: onRoomConnected, status " + statusCode);
        showGameError();
        return;
    }

    // show the waiting room UI
    showWaitingRoom(room);
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:13,代码来源:Example.java

示例15: updateRoom

import com.google.android.gms.games.multiplayer.realtime.Room; //导入依赖的package包/类
void updateRoom(Room room) {
    if (room != null) {
        mParticipants = room.getParticipants();
    }
    if (mParticipants != null) {
        updatePeerScoresDisplay();
    }
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:9,代码来源:Example.java


注:本文中的com.google.android.gms.games.multiplayer.realtime.Room类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。