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


Java LeaderboardScoreBuffer.getCount方法代码示例

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


在下文中一共展示了LeaderboardScoreBuffer.getCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: aj

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
aj(DataHolder arg2)
{
  super(localObject1, localDataHolder);
  this.jY = new Status(localDataHolder.getStatusCode());
  LeaderboardScoreBuffer localLeaderboardScoreBuffer = new LeaderboardScoreBuffer(localDataHolder);
  try
  {
    if (localLeaderboardScoreBuffer.getCount() > 0)
      this.uq = ((d)localLeaderboardScoreBuffer.get(0).freeze());
    else
      this.uq = null;
    return;
  }
  finally
  {
    localLeaderboardScoreBuffer.close();
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:19,代码来源:fl.java

示例2: MainActivity

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
public MainActivity() {
	aHelper = new GameHelper(this);
	aHelper.enableDebugLog(true, "MYTAG");

	// create a listener for getting raw data back from leaderboard
	theLeaderboardListener = new OnLeaderboardScoresLoadedListener() {

		@Override
		public void onLeaderboardScoresLoaded(int statusCode,
				LeaderboardBuffer leaderboard, LeaderboardScoreBuffer scores) {

			for (int i = 0; i < scores.getCount(); i++) {
				System.out.println(scores.get(i)
						.getScoreHolderDisplayName()
						+ " : "
						+ scores.get(i).getDisplayScore());
			}
		}
	};
}
 
开发者ID:bitbrain,项目名称:plox,代码行数:21,代码来源:MainActivity.java

示例3: scoresToJsonString

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
private String scoresToJsonString( LeaderboardScoreBuffer scores ) {

        int scoresNb = scores.getCount();
        JSONArray jsonScores = new JSONArray();
        for ( int i = 0; i < scoresNb; ++i ) {
            LeaderboardScore score = scores.get(i);
            JSONObject jsonScore = new JSONObject();
            try {
                jsonScore.put("value", score.getRawScore());
                jsonScore.put("rank", score.getRank());

                Player player = score.getScoreHolder();
                JSONObject jsonPlayer = new JSONObject();
                jsonPlayer.put("id", player.getPlayerId());
                jsonPlayer.put("displayName", player.getDisplayName());
                jsonPlayer.put("picture", player.getIconImageUri());

                jsonScore.put("player", jsonPlayer);

                jsonScores.put( jsonScore );

            } catch( JSONException e ) {}
        }
        return jsonScores.toString();

    }
 
开发者ID:freshplanet,项目名称:ANE-Google-Play-Game-Services,代码行数:27,代码来源:ExtensionContext.java

示例4: MainActivity

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
public MainActivity() {
	aHelper = new GameHelper(this);
	aHelper.enableDebugLog(true, "MYTAG");

	// create a listener for getting raw data back from leaderboard
	theLeaderboardListener = new OnLeaderboardScoresLoadedListener() {

		@Override
		public void onLeaderboardScoresLoaded(int statusCode,
				LeaderboardBuffer leaderboard, LeaderboardScoreBuffer scores) {
			System.out.println("In call back");

			for (int i = 0; i < scores.getCount(); i++) {
				System.out.println(scores.get(i)
						.getScoreHolderDisplayName()
						+ " : "
						+ scores.get(i).getDisplayScore());
			}
		}
	};
}
 
开发者ID:bitbrain,项目名称:acid-snake,代码行数:22,代码来源:MainActivity.java

示例5: onResult

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
public void onResult( Leaderboards.LoadScoresResult scoresResult ) {


        LeaderboardScoreBuffer scores = scoresResult.getScores();

        if( scores.getCount() == currentBufferSize ) {
            Extension.context.onLeaderboardLoaded(scores);
        }
        else {
            currentBufferSize = scores.getCount();
            Games.Leaderboards.loadMoreScores( Extension.context.getApiClient(), scores, 25, PageDirection.NEXT ).setResultCallback( this );
        }

    }
 
开发者ID:freshplanet,项目名称:ANE-Google-Play-Game-Services,代码行数:15,代码来源:ScoresLoadedListener.java

示例6: fetchLeaderboardEntriesSync

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
private boolean fetchLeaderboardEntriesSync(String leaderBoardId, int limit, boolean relatedToPlayer,
                                            IFetchLeaderBoardEntriesResponseListener callback) {
    if (!isSessionActive())
        return false;

    if (gpgsLeaderboardIdMapper != null)
        leaderBoardId = gpgsLeaderboardIdMapper.mapToGsId(leaderBoardId);

    Leaderboards.LoadScoresResult scoresResult =
            (relatedToPlayer ?
                    Games.Leaderboards.loadTopScores(mGoogleApiClient, leaderBoardId,
                            LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC,
                            MathUtils.clamp(limit, 1, 25), forceRefresh).await()
                    :
                    Games.Leaderboards.loadPlayerCenteredScores(mGoogleApiClient, leaderBoardId,
                            LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC,
                            MathUtils.clamp(limit, 1, 25), forceRefresh).await());

    if (!scoresResult.getStatus().isSuccess()) {
        Gdx.app.log(GAMESERVICE_ID, "Failed to fetch leaderboard entries:" +
                scoresResult.getStatus().getStatusMessage());
        callback.onLeaderBoardResponse(null);
        return false;
    }

    LeaderboardScoreBuffer scores = scoresResult.getScores();

    Array<ILeaderBoardEntry> gpgsLbEs = new Array<ILeaderBoardEntry>(scores.getCount());
    String playerDisplayName = getPlayerDisplayName();

    for (LeaderboardScore score : scores) {
        GpgsLeaderBoardEntry gpgsLbE = new GpgsLeaderBoardEntry();

        gpgsLbE.userDisplayName = score.getScoreHolderDisplayName();
        gpgsLbE.currentPlayer = gpgsLbE.userDisplayName.equalsIgnoreCase(playerDisplayName);
        gpgsLbE.formattedValue = score.getDisplayScore();
        gpgsLbE.scoreRank = score.getDisplayRank();
        gpgsLbE.userId = score.getScoreHolder().getPlayerId();
        gpgsLbE.sortValue = score.getRawScore();
        gpgsLbE.scoreTag = score.getScoreTag();

        gpgsLbEs.add(gpgsLbE);
    }

    scores.release();

    callback.onLeaderBoardResponse(gpgsLbEs);

    return true;
}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:51,代码来源:GpgsClient.java

示例7: onLeaderboardScoresLoaded

import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入方法依赖的package包/类
public void onLeaderboardScoresLoaded(int statusCode,
		LeaderboardBuffer leaderboard, LeaderboardScoreBuffer scores) {
	boolean found = false;
	if (statusCode == GamesClient.STATUS_OK && mGLView != null && mGLView.mRenderer != null) {
		String mId = mGamesClient.getCurrentPlayerId();
		Log.i(TAG, "onLeaderboardScoresLoaded: ");
		for (int i = 0; i < scores.getCount(); ++i) {
			LeaderboardScore score = scores.get(i);
			LeaderboardScore fScore = score.freeze();
			if (fScore.getScoreHolder().getPlayerId().equals(mId)) {
				found = true;
				Log.i(TAG, "Found me at position " + i);
				mGLView.mRenderer.setMyStats(fScore.getDisplayRank(), fScore.getDisplayScore(), (int)fScore.getRawScore());
				if (i > 0) {
					Log.i(TAG, "Found prev ");
					LeaderboardScore prevScore = scores.get(i-1).freeze();
					mGLView.mRenderer.setPrevPlayer(prevScore.getDisplayRank(), prevScore.getDisplayScore());
				}
				else {
					mGLView.mRenderer.setPrevPlayer("", "");
				}
				if (i < scores.getCount()-1) {
					Log.i(TAG, "Found next ");
					LeaderboardScore nextScore = scores.get(i+1).freeze();
					mGLView.mRenderer.setNextPlayer(nextScore.getDisplayRank(), nextScore.getDisplayScore());
				}
				else {
					mGLView.mRenderer.setNextPlayer("", "");
				}
				break;
			}
		}
		if (!found) {
			mGLView.mRenderer.setMyStats("", "", -1);
		}
	}
	else {
		Toast.makeText(this, "Error retrieving scores " + statusCode, Toast.LENGTH_SHORT).show();
	}
	leaderboard.close();
	scores.close();

}
 
开发者ID:d3alek,项目名称:TheHunt---Interactive-graphical-platform-for-AI-Experiments,代码行数:44,代码来源:TheHunt.java


注:本文中的com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer.getCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。