当前位置: 首页>>代码示例>>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;未经允许,请勿转载。