當前位置: 首頁>>代碼示例>>Java>>正文


Java TurnBasedMatch.getData方法代碼示例

本文整理匯總了Java中com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch.getData方法的典型用法代碼示例。如果您正苦於以下問題:Java TurnBasedMatch.getData方法的具體用法?Java TurnBasedMatch.getData怎麽用?Java TurnBasedMatch.getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch的用法示例。


在下文中一共展示了TurnBasedMatch.getData方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	gameHelper.onActivityResult(requestCode, resultCode, data);

	if (requestCode == RC_LOOK_AT_MATCHES) {
		// Returning from the 'Select Match' dialog

		if (resultCode != Activity.RESULT_OK) {
			// user canceled
			return;
		}

		TurnBasedMatch match = data.getParcelableExtra(Multiplayer.EXTRA_TURN_BASED_MATCH);

		if (match.getData() == null)
		    startMatch(match);
		else
			updateMatch(match);

		Log.d(TAG, "Match = " + match);
	}

	
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:26,代碼來源:AndroidLauncher.java

示例2: processResult

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的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);
}
 
開發者ID:NahroTo,項目名稱:Fruit-Destroyer,代碼行數:17,代碼來源:SkeletonActivity.java

示例3: getGameData

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
private GameData getGameData(@NonNull TurnBasedMatch turnBasedMatch) {
  byte[] data = turnBasedMatch.getData();
  if (data == null) {
    // When a crash happens during game creation, the TurnBasedMatch contains a null game
    // that can't be recovered, and would prevent starting the app.
    return null;
  }

  handleMatchStatusComplete(turnBasedMatch);
  try {
    GameData gameData = GameData.parseFrom(data);
    gameData = handleBackwardCompatibility(turnBasedMatch, gameData);
    return gameData;
  } catch (InvalidProtocolBufferException exception) {
    throw new RuntimeException(exception);
  }
}
 
開發者ID:cauchymop,項目名稱:goblob,代碼行數:18,代碼來源:AndroidGameRepository.java

示例4: processResult

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的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);
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:15,代碼來源:AndroidLauncher.java

示例5: onResult

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的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);

}
 
開發者ID:simoneapp,項目名稱:S3-16-simone,代碼行數:29,代碼來源:MatchInitiatedCallback.java

示例6: startNewGame

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的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());
    }
}
 
開發者ID:dbaelz,項目名稱:NotAlways42,代碼行數:15,代碼來源:MultiplayerFragment.java

示例7: updateGame

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
private void updateGame(TurnBasedMatch match) {
    int status = match.getStatus();
    int turnStatus = match.getTurnStatus();

    switch (status) {
        case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
            Toast.makeText(mActivity, mActivity.getString(R.string.multiplayer_match_automatching), Toast.LENGTH_SHORT).show();
            return;
        case TurnBasedMatch.MATCH_STATUS_EXPIRED:
            Toast.makeText(mActivity, mActivity.getString(R.string.multiplayer_match_expired), Toast.LENGTH_SHORT).show();
            return;
        case TurnBasedMatch.MATCH_STATUS_CANCELED:
            Toast.makeText(mActivity, mActivity.getString(R.string.multiplayer_match_canceled), Toast.LENGTH_SHORT).show();
            return;
        case TurnBasedMatch.MATCH_STATUS_COMPLETE:
            if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
                Toast.makeText(mActivity, mActivity.getString(R.string.multiplayer_match_complete), Toast.LENGTH_SHORT).show();
                EventBus.getDefault().post(new GameEndedEvent(false));
            }
            break;
        default:
    }

    if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN) {
        playTurn(match);
    } else {
        mData = new MultiplayerData(match.getData());
        mPlayer1Name.setText(mData.getPlayer1Name());
        mPlayer2Name.setText(mData.getPlayer2Name());
        changeRoundIndicators(mData);
        mLayoutInput.setVisibility(View.GONE);
    }
}
 
開發者ID:dbaelz,項目名稱:NotAlways42,代碼行數:34,代碼來源:MultiplayerFragment.java

示例8: onTurnBasedMatchInitiated

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
public void onTurnBasedMatchInitiated(int statusCode, TurnBasedMatch match) {
	if (!checkStatusCode(match, statusCode)) {
		return;
	}

	if (match.getData() != null) {
		// This is a game that has already started, so just start it
		updateMatch(match);
		return;
	}

	mContext.startMatch(match);
}
 
開發者ID:elyas-bhy,項目名稱:pygmy,代碼行數:14,代碼來源:GameHelper.java

示例9: onTurnBasedMatchInitiated

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
@Override
public void onTurnBasedMatchInitiated(int statusCode, TurnBasedMatch match) {
    //start the game activity and pass the match in
    if (!checkStatusCode(match, statusCode)) {
        return;
    }

    if (match.getData() != null) {
        // This is a game that has already started, so I'll just start
        updateMatch(match);
        return;
    }

    launchRound(match);
}
 
開發者ID:dustin-graham,項目名稱:MorseWithPals,代碼行數:16,代碼來源:MainActivity.java

示例10: onInitiateMatch

import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //導入方法依賴的package包/類
private void onInitiateMatch(TurnBasedMatch match) {
  dismissSpinner();

  if (match.getData() != null) {
    // This is a game that has already started, so I'll just start
    updateMatch(match);
    return;
  }

  startMatch(match);
}
 
開發者ID:playgameservices,項目名稱:android-basic-samples,代碼行數:12,代碼來源:SkeletonActivity.java


注:本文中的com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch.getData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。