本文整理汇总了Java中com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer.InitiateMatchResult方法的典型用法代码示例。如果您正苦于以下问题:Java TurnBasedMultiplayer.InitiateMatchResult方法的具体用法?Java TurnBasedMultiplayer.InitiateMatchResult怎么用?Java TurnBasedMultiplayer.InitiateMatchResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer
的用法示例。
在下文中一共展示了TurnBasedMultiplayer.InitiateMatchResult方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: quickMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
@Override
public void quickMatch() {
Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
1, 1, 0);
TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder()
.setAutoMatchCriteria(autoMatchCriteria).build();
// Start the match
ResultCallback<TurnBasedMultiplayer.InitiateMatchResult> cb = new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() {
@Override
public void onResult(TurnBasedMultiplayer.InitiateMatchResult result) {
processResult(result);
}
};
Games.TurnBasedMultiplayer.createMatch(gameHelper.getApiClient(), tbmc).setResultCallback(cb);
}
示例2: onQuickMatchClicked
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
public void onQuickMatchClicked(View view) {
Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
1, 1, 0);
TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder()
.setAutoMatchCriteria(autoMatchCriteria).build();
showSpinner();
// Start the match
ResultCallback<TurnBasedMultiplayer.InitiateMatchResult> cb = new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() {
@Override
public void onResult(TurnBasedMultiplayer.InitiateMatchResult result) {
processResult(result);
}
};
Games.TurnBasedMultiplayer.createMatch(mGoogleApiClient, tbmc).setResultCallback(cb);
}
示例3: processResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
private void processResult(TurnBasedMultiplayer.InitiateMatchResult result) {
TurnBasedMatch match = result.getMatch();
dismissSpinner();
if (!checkStatusCode(match, result.getStatus().getStatusCode())) {
return;
}
if (match.getData() != null) {
// This is a game that has already started, so I'll just start
updateMatch(match);
return;
}
startMatch(match);
}
示例4: processResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
private void processResult(TurnBasedMultiplayer.InitiateMatchResult result) {
TurnBasedMatch match = result.getMatch();
if (!checkStatusCode(match, result.getStatus().getStatusCode()))
return;
if (match.getData() != null) {
// This is a game that has already started, so I'll just start
updateMatch(match);
return;
}
startMatch(match);
}
示例5: onResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
@Override
public void onResult(TurnBasedMultiplayer.InitiateMatchResult result) {
// Check if the status code is not success.
Status status = result.getStatus();
if (!status.isSuccess()) {
Log.d("##MACHINITIATEDCALLBACK","errore!");
return;
}
TurnBasedMatch match = result.getMatch();
// If this player is not the first player in this match, continue.
if (match.getData() != null) {
Log.d("##MACHINITIATEDCALLBACK","WAITING FOR MY TURN");
return;
}
// Otherwise, this is the first player. Initialize the game state.
Log.d("##MACHINITIATEDCALLBACK","GAME STARTED");
//initGame(match);
// Let the player take the first turn
Log.d("##MACHINITIATEDCALLBACK","showTurnUi");
//showTurnUI(match);
}
示例6: acceptInvitation
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
public final PendingResult<TurnBasedMultiplayer.InitiateMatchResult> acceptInvitation(GoogleApiClient paramGoogleApiClient, final String paramString)
{
return paramGoogleApiClient.b(new b(paramString)
{
protected void a(fl paramAnonymousfl)
{
paramAnonymousfl.e(this, paramString);
}
});
}
示例7: createMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
public final PendingResult<TurnBasedMultiplayer.InitiateMatchResult> createMatch(GoogleApiClient paramGoogleApiClient, final TurnBasedMatchConfig paramTurnBasedMatchConfig)
{
return paramGoogleApiClient.b(new b(paramTurnBasedMatchConfig)
{
protected void a(fl paramAnonymousfl)
{
paramAnonymousfl.a(this, paramTurnBasedMatchConfig);
}
});
}
示例8: rematch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
public final PendingResult<TurnBasedMultiplayer.InitiateMatchResult> rematch(GoogleApiClient paramGoogleApiClient, final String paramString)
{
return paramGoogleApiClient.b(new b(paramString)
{
protected void a(fl paramAnonymousfl)
{
paramAnonymousfl.d(this, paramString);
}
});
}
示例9: D
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
public TurnBasedMultiplayer.InitiateMatchResult D(final Status paramStatus)
{
return new TurnBasedMultiplayer.InitiateMatchResult()
{
public TurnBasedMatch getMatch()
{
return null;
}
public Status getStatus()
{
return paramStatus;
}
};
}
示例10: startNewGame
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMultiplayer; //导入方法依赖的package包/类
private void startNewGame(TurnBasedMultiplayer.InitiateMatchResult result) {
TurnBasedMatch match = result.getMatch();
int status = result.getStatus().getStatusCode();
if (status != GamesStatusCodes.STATUS_OK && status != GamesStatusCodes.STATUS_NETWORK_ERROR_OPERATION_DEFERRED) {
return;
}
// Initial setup
if (match.getData() == null) {
MultiplayerData initialData = initDataAndUI(match);
takeTurn(match.getMatchId(), initialData.toBytes(), initialData.getPlayer2ID());
}
}