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


Java TurnBasedMatch.MATCH_STATUS_EXPIRED屬性代碼示例

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


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

示例1: onTurnBasedMatchReceived

@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");
    }

}
 
開發者ID:dustin-graham,項目名稱:MorseWithPals,代碼行數:20,代碼來源:MainActivity.java

示例2: updateGame

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,代碼行數:33,代碼來源:MultiplayerFragment.java

示例3: updateMatch

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!");
    }

}
 
開發者ID:dustin-graham,項目名稱:MorseWithPals,代碼行數:35,代碼來源:MainActivity.java

示例4: updateMatch

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;

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

示例5: updateMatch

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();
}
 
開發者ID:NahroTo,項目名稱:Fruit-Destroyer,代碼行數:50,代碼來源:SkeletonActivity.java

示例6: updateMatch

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();
}
 
開發者ID:elyas-bhy,項目名稱:pygmy,代碼行數:49,代碼來源:GameHelper.java

示例7: updateMatch

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();
}
 
開發者ID:playgameservices,項目名稱:android-basic-samples,代碼行數:50,代碼來源:SkeletonActivity.java


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