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


Java TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING属性代码示例

本文整理汇总了Java中com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING属性的典型用法代码示例。如果您正苦于以下问题:Java TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING属性的具体用法?Java TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING怎么用?Java TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch的用法示例。


在下文中一共展示了TurnBasedMatch.MATCH_STATUS_AUTO_MATCHING属性的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_AUTO_MATCHING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。