本文整理汇总了Java中com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch.getTurnStatus方法的典型用法代码示例。如果您正苦于以下问题:Java TurnBasedMatch.getTurnStatus方法的具体用法?Java TurnBasedMatch.getTurnStatus怎么用?Java TurnBasedMatch.getTurnStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
的用法示例。
在下文中一共展示了TurnBasedMatch.getTurnStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void processResult(TurnBasedMultiplayer.UpdateMatchResult result) {
TurnBasedMatch match = result.getMatch();
dismissSpinner();
if (!checkStatusCode(match, result.getStatus().getStatusCode())) {
return;
}
if (match.canRematch()) {
askForRematch();
}
isDoingTurn = (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN);
if (isDoingTurn) {
updateMatch(match);
return;
}
setViewVisibility();
}
示例2: onTurnBasedMatchReceived
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
@Override
public void onTurnBasedMatchReceived(TurnBasedMatch match) {
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
if (status != TurnBasedMatch.MATCH_STATUS_CANCELED &&
status != TurnBasedMatch.MATCH_STATUS_EXPIRED &&
status != TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING &&
status != TurnBasedMatch.MATCH_STATUS_COMPLETE) {
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN) {
directUserToPlayGamesGUI("Received Match Update. It's your turn!");
} else if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN) {
Toast.makeText(this, "Next Player's turn. We'll notify you when it's your turn again.", Toast.LENGTH_LONG).show();
} else if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_INVITED) {
Toast.makeText(this, "Player invitations have been sent", Toast.LENGTH_LONG).show();
}
} else if (status == TurnBasedMatch.MATCH_STATUS_COMPLETE) {
directUserToPlayGamesGUI("You have a game that just finished. Click 'View' to see the results");
}
}
示例3: onUpdateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void onUpdateMatch(TurnBasedMatch match) {
dismissSpinner();
if (match.canRematch()) {
askForRematch();
}
isDoingTurn = (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN);
if (isDoingTurn) {
updateMatch(match);
return;
}
setViewVisibility();
}
示例4: processResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
private void processResult(TurnBasedMultiplayer.LeaveMatchResult result) {
TurnBasedMatch match = result.getMatch();
if (!checkStatusCode(match, result.getStatus().getStatusCode())) {
return;
}
isDoingTurn = (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN);
showWarning("Left", "You've left this match.");
}
示例5: 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);
}
}
示例6: processResult
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
private void processResult(TurnBasedMultiplayer.UpdateMatchResult result) {
TurnBasedMatch match = result.getMatch();
int status = result.getStatus().getStatusCode();
if (status != GamesStatusCodes.STATUS_OK && status != GamesStatusCodes.STATUS_NETWORK_ERROR_OPERATION_DEFERRED) {
return;
}
int turnStatus = match.getTurnStatus();
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN) {
playTurn(match);
} else if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
EventBus.getDefault().post(new GameEndedEvent(false));
}
}
示例7: onTurnBasedMatchUpdated
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void onTurnBasedMatchUpdated(int statusCode, TurnBasedMatch match) {
if (!checkStatusCode(match, statusCode)) {
return;
}
if (match.canRematch()) {
askForRematch();
}
isDoingTurn = (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN);
if (isDoingTurn) {
updateMatch(match);
return;
}
}
示例8: onTurnBasedMatchLeft
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void onTurnBasedMatchLeft(int statusCode, TurnBasedMatch match) {
if (!checkStatusCode(match, statusCode)) {
return;
}
isDoingTurn = (match.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN);
showWarning("Left", "You've left this match.");
}
示例9: updateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void updateMatch(TurnBasedMatch match) {
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
switch (status) {
case TurnBasedMatch.MATCH_STATUS_CANCELED:
showWarning("Canceled!", "This game was canceled!");
return;
case TurnBasedMatch.MATCH_STATUS_EXPIRED:
showWarning("Expired!", "This game is expired. So sad!");
return;
case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
showWarning("Waiting for auto-match...",
"We're still waiting for an automatch partner.");
return;
case TurnBasedMatch.MATCH_STATUS_COMPLETE:
directUserToPlayGamesGUI("This game is complete. Click 'View' to see results");
return;
}
// OK, it's active. Check on turn status.
switch (turnStatus) {
case TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN:
launchRound(match);
return;
case TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN:
// Should return results.
showWarning("Alas...", "It's not your turn.");
break;
case TurnBasedMatch.MATCH_TURN_STATUS_INVITED:
showWarning("Good inititative!",
"Still waiting for invitations.\n\nBe patient!");
}
}
示例10: fillLocalStates
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
private GameData.Builder fillLocalStates(TurnBasedMatch turnBasedMatch, GameData.Builder gameData) {
boolean isMyTurn = turnBasedMatch.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN;
boolean turnIsBlack = gameData.getTurn() == PlayGameData.Color.BLACK;
boolean iAmBlack = isMyTurn && turnIsBlack || (!isMyTurn && !turnIsBlack);
PlayGameData.GameConfiguration.Builder gameConfiguration = gameData.getGameConfigurationBuilder();
PlayGameData.GoPlayer.Builder blackPlayer = gameConfiguration.getBlackBuilder();
PlayGameData.GoPlayer.Builder whitePlayer = gameConfiguration.getWhiteBuilder();
blackPlayer.setIsLocal(iAmBlack);
whitePlayer.setIsLocal(!iAmBlack);
Log.d(TAG, String.format("black: %s", blackPlayer));
Log.d(TAG, String.format("white %s", whitePlayer));
return gameData;
}
示例11: updateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void updateMatch(TurnBasedMatch match) {
mMatch = match;
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
switch (status) {
case TurnBasedMatch.MATCH_STATUS_CANCELED:
showWarning("Canceled!", "This game was canceled!");
return;
case TurnBasedMatch.MATCH_STATUS_EXPIRED:
showWarning("Expired!", "This game is expired. So sad!");
return;
case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
showWarning("Waiting for auto-match...",
"We're still waiting for an automatch partner.");
return;
case TurnBasedMatch.MATCH_STATUS_COMPLETE:
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
showWarning(
"Complete!",
"This game is over!");
break;
}
// Note that in this state, you must still call "Finish" yourself,
// so we allow this to continue.
showWarning("Complete!",
"This game is over! You can only finish it now.");
}
// OK, it's active. Check on turn status.
switch (turnStatus) {
case TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN:
mTurnData = GameModelWrapper.convertFromByteArray(mMatch.getData());
reversi.setOnlineMatchScreen();
return;
case TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN:
// Should return results.
showWarning("Alas...", "It's not your turn.");
break;
case TurnBasedMatch.MATCH_TURN_STATUS_INVITED:
showWarning("Good inititative!",
"Still waiting for invitations.\n\nBe patient!");
}
mTurnData = null;
}
示例12: updateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void updateMatch(TurnBasedMatch match) {
mMatch = match;
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
switch (status) {
case TurnBasedMatch.MATCH_STATUS_CANCELED:
showWarning("Canceled!", "This game was canceled!");
return;
case TurnBasedMatch.MATCH_STATUS_EXPIRED:
showWarning("Expired!", "This game is expired. So sad!");
return;
case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
showWarning("Waiting for auto-match...",
"We're still waiting for an automatch partner.");
return;
case TurnBasedMatch.MATCH_STATUS_COMPLETE:
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
showWarning(
"Complete!",
"This game is over; someone finished it, and so did you! There is nothing to be done.");
break;
}
// Note that in this state, you must still call "Finish" yourself,
// so we allow this to continue.
showWarning("Complete!",
"This game is over; someone finished it! You can only finish it now.");
}
// OK, it's active. Check on turn status.
switch (turnStatus) {
case TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN:
mTurnData = SkeletonTurn.unpersist(mMatch.getData());
setGameplayUI();
return;
case TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN:
// Should return results.
showWarning("Alas...", "It's not your turn.");
break;
case TurnBasedMatch.MATCH_TURN_STATUS_INVITED:
showWarning("Good inititative!",
"Still waiting for invitations.\n\nBe patient!");
}
mTurnData = null;
setViewVisibility();
}
示例13: updateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void updateMatch(TurnBasedMatch match) {
mMatch = match;
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
switch (status) {
case TurnBasedMatch.MATCH_STATUS_CANCELED:
showWarning("Canceled!", "This game was canceled!");
return;
case TurnBasedMatch.MATCH_STATUS_EXPIRED:
showWarning("Expired!", "This game is expired. So sad!");
return;
case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
showWarning("Waiting for auto-match...",
"We're still waiting for an automatch partner.");
return;
case TurnBasedMatch.MATCH_STATUS_COMPLETE:
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
showWarning(
"Complete!",
"This game is over; someone finished it, and so did you! There is nothing to be done.");
break;
}
// Note that in this state, you must still call "Finish" yourself,
// so we allow this to continue.
showWarning("Complete!",
"This game is over; someone finished it! You can only finish it now.");
}
// OK, it's active. Check on turn status.
switch (turnStatus) {
case TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN:
mTurnData = TurnData.unpersist(mMatch.getData());
setGameplayUI();
return;
case TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN:
// Should return results.
showWarning("Alas...", "It's not your turn.");
break;
case TurnBasedMatch.MATCH_TURN_STATUS_INVITED:
showWarning("Good inititative!",
"Still waiting for invitations.\n\nBe patient!");
}
mTurnData = null;
mContext.setViewVisibility();
}
示例14: updateMatch
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
public void updateMatch(TurnBasedMatch match) {
mMatch = match;
int status = match.getStatus();
int turnStatus = match.getTurnStatus();
switch (status) {
case TurnBasedMatch.MATCH_STATUS_CANCELED:
showWarning("Canceled!", "This game was canceled!");
return;
case TurnBasedMatch.MATCH_STATUS_EXPIRED:
showWarning("Expired!", "This game is expired. So sad!");
return;
case TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING:
showWarning("Waiting for auto-match...",
"We're still waiting for an automatch partner.");
return;
case TurnBasedMatch.MATCH_STATUS_COMPLETE:
if (turnStatus == TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE) {
showWarning("Complete!",
"This game is over; someone finished it, and so did you! " +
"There is nothing to be done.");
break;
}
// Note that in this state, you must still call "Finish" yourself,
// so we allow this to continue.
showWarning("Complete!",
"This game is over; someone finished it! You can only finish it now.");
}
// OK, it's active. Check on turn status.
switch (turnStatus) {
case TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN:
mTurnData = SkeletonTurn.unpersist(mMatch.getData());
setGameplayUI();
return;
case TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN:
// Should return results.
showWarning("Alas...", "It's not your turn.");
break;
case TurnBasedMatch.MATCH_TURN_STATUS_INVITED:
showWarning("Good inititative!",
"Still waiting for invitations.\n\nBe patient!");
}
mTurnData = null;
setViewVisibility();
}
示例15: handleMatchStatusComplete
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch; //导入方法依赖的package包/类
private void handleMatchStatusComplete(@NonNull TurnBasedMatch turnBasedMatch) {
boolean myTurn = turnBasedMatch.getTurnStatus() == TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN;
if (myTurn && turnBasedMatch.getStatus() == TurnBasedMatch.MATCH_STATUS_COMPLETE) {
TurnBasedMultiplayer.finishMatch(googleApiClient, turnBasedMatch.getMatchId());
}
}