本文整理汇总了Java中com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer类的典型用法代码示例。如果您正苦于以下问题:Java LeaderboardScoreBuffer类的具体用法?Java LeaderboardScoreBuffer怎么用?Java LeaderboardScoreBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LeaderboardScoreBuffer类属于com.google.android.gms.games.leaderboard包,在下文中一共展示了LeaderboardScoreBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: z
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public Leaderboards.LoadScoresResult z(final Status paramStatus)
{
return new Leaderboards.LoadScoresResult()
{
public Leaderboard getLeaderboard()
{
return null;
}
public LeaderboardScoreBuffer getScores()
{
return new LeaderboardScoreBuffer(DataHolder.empty(14));
}
public Status getStatus()
{
return paramStatus;
}
public void release()
{
}
};
}
示例2: 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();
}
}
示例3: s
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
s(DataHolder paramDataHolder1, DataHolder arg3)
{
super(paramDataHolder1, localDataHolder2);
DataHolder localDataHolder1;
LeaderboardBuffer localLeaderboardBuffer = new LeaderboardBuffer(localDataHolder1);
try
{
if (localLeaderboardBuffer.getCount() > 0)
this.uh = ((com.google.android.gms.games.leaderboard.a)((Leaderboard)localLeaderboardBuffer.get(0)).freeze());
else
this.uh = null;
}
finally
{
localLeaderboardBuffer.close();
}
this.ui = new LeaderboardScoreBuffer(localDataHolder2);
}
示例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) {
for (int i = 0; i < scores.getCount(); i++) {
System.out.println(scores.get(i)
.getScoreHolderDisplayName()
+ " : "
+ scores.get(i).getDisplayScore());
}
}
};
}
示例5: 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();
}
示例6: 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());
}
}
};
}
示例7: loadMoreScores
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
@Deprecated
public final void loadMoreScores(final OnLeaderboardScoresLoadedListener paramOnLeaderboardScoresLoadedListener, LeaderboardScoreBuffer paramLeaderboardScoreBuffer, int paramInt1, int paramInt2)
{
this.te.a(new a.c()
{
public void a(Leaderboards.LoadScoresResult paramAnonymousLoadScoresResult)
{
int i = paramAnonymousLoadScoresResult.getStatus().getStatusCode();
paramOnLeaderboardScoresLoadedListener.onLeaderboardScoresLoaded(i, paramAnonymousLoadScoresResult.getLeaderboard(), paramAnonymousLoadScoresResult.getScores());
}
}
, paramLeaderboardScoreBuffer, paramInt1, paramInt2);
}
示例8: loadMoreScores
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public final PendingResult<Leaderboards.LoadScoresResult> loadMoreScores(GoogleApiClient paramGoogleApiClient, final LeaderboardScoreBuffer paramLeaderboardScoreBuffer, final int paramInt1, final int paramInt2)
{
return paramGoogleApiClient.a(new c(paramLeaderboardScoreBuffer)
{
protected void a(fl paramAnonymousfl)
{
paramAnonymousfl.a(this, paramLeaderboardScoreBuffer, paramInt1, paramInt2);
}
});
}
示例9: a
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public final void a(a.c<Leaderboards.LoadScoresResult> paramc, LeaderboardScoreBuffer paramLeaderboardScoreBuffer, int paramInt1, int paramInt2)
{
// Byte code:
// 0: aload_0
// 1: invokevirtual 149 com/google/android/gms/internal/fl:bQ ()Landroid/os/IInterface;
// 4: checkcast 151 com/google/android/gms/internal/fp
// 7: new 296 com/google/android/gms/internal/fl$r
// 10: dup
// 11: aload_0
// 12: aload_1
// 13: invokespecial 297 com/google/android/gms/internal/fl$r:<init> (Lcom/google/android/gms/internal/fl;Lcom/google/android/gms/common/api/a$c;)V
// 16: aload_2
// 17: invokevirtual 303 com/google/android/gms/games/leaderboard/LeaderboardScoreBuffer:dq ()Lcom/google/android/gms/games/leaderboard/c;
// 20: invokevirtual 309 com/google/android/gms/games/leaderboard/c:dr ()Landroid/os/Bundle;
// 23: iload_3
// 24: iload 4
// 26: invokeinterface 312 5 0
// 31: return
// 32: ldc 169
// 34: ldc_w 256
// 37: invokestatic 259 com/google/android/gms/internal/fn:c (Ljava/lang/String;Ljava/lang/String;)V
// 40: return
//
// Exception table:
// from to target type
// 0 31 32 android/os/RemoteException
}
示例10: loadTopScores
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public void loadTopScores(String leaderboardId, int span,
int leaderboardCollection, int maxResults, boolean forceReload) {
Games.Leaderboards.loadTopScores(mGoogleApiClient, leaderboardId, span,
leaderboardCollection, maxResults, forceReload)
.setResultCallback(
new ResultCallback<Leaderboards.LoadScoresResult>() {
@Override
public void onResult(
Leaderboards.LoadScoresResult loadScoresResult) {
Leaderboard leaderboard = loadScoresResult
.getLeaderboard();
LeaderboardScoreBuffer buffer = loadScoresResult
.getScores();
String jsonString = "{\""
+ leaderboard.getDisplayName()
+ "\":\""
+ buffer.get(0).getDisplayScore()
+ "\"}";
JSONObject json = null;
try {
json = new JSONObject(jsonString);
} catch (JSONException e) {
e.printStackTrace();
Log.e(TAG, e.getLocalizedMessage());
}
if (mCallback != null) {
mCallback.onLoadTopScores(
ActionType.TOP_SCORES, json);
}
}
});
}
示例11: 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 );
}
}
示例12: incrementScore
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
/**
* Increments current score to leaderboard
* @param pLeaderboard
* @param pScore
*/
public void incrementScore(final String pLeaderboard, final long pScore){
if(isSignedIn() == false)
return;
final String playerId = getGamesClient().getCurrentPlayer().getPlayerId();
//Toast.makeText(this, "increment " + playerId, Toast.LENGTH_LONG).show();
getGamesClient().loadPlayerCenteredScores(new OnLeaderboardScoresLoadedListener() {
@Override
public void onLeaderboardScoresLoaded(int arg0, LeaderboardBuffer arg1, LeaderboardScoreBuffer arg2) {
Iterator <LeaderboardScore> it =arg2.iterator();
//Toast.makeText(ActivityBaseGameLeaderboard.this, "on score loaded", Toast.LENGTH_LONG).show();
if(it.hasNext() == false){
//Toast.makeText(ActivityBaseGameLeaderboard.this, "first submit", Toast.LENGTH_LONG).show();
submitScore(pLeaderboard, pScore);
return;
}
while(it.hasNext()){
LeaderboardScore lbScore = it.next();
long score = lbScore.getRawScore();
//Toast.makeText(ActivityBaseGameLeaderboard.this, score + " " + lbScore.getScoreHolder().getPlayerId(), Toast.LENGTH_LONG).show();
if(lbScore.getScoreHolder().getPlayerId().equals(playerId)){
submitScore(pLeaderboard, pScore + score);
}
}
}
}, pLeaderboard, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 1);
}
示例13: 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;
}
示例14: getScores
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public final LeaderboardScoreBuffer getScores()
{
return this.ui;
}
示例15: onLeaderboardLoaded
import com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer; //导入依赖的package包/类
public void onLeaderboardLoaded( LeaderboardScoreBuffer scores ) {
dispatchEvent( "ON_LEADERBOARD_LOADED", scoresToJsonString(scores) );
}