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


Java Leaderboards类代码示例

本文整理汇总了Java中com.google.android.gms.games.leaderboard.Leaderboards的典型用法代码示例。如果您正苦于以下问题:Java Leaderboards类的具体用法?Java Leaderboards怎么用?Java Leaderboards使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Leaderboards类属于com.google.android.gms.games.leaderboard包,在下文中一共展示了Leaderboards类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: z

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的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()
    {
    }
  };
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:25,代码来源:fw.java

示例2: leaderboard_submit_score_immediate

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
/**
 * Submit a given score to the specified leaderboard immediately
 * with a callback result
 * @param id leaderboard id obtained from your Developer Console
 * @param score score number the player earned
 *
 * Usage:
 *      const ST_OK = "STATUS_OK"
 *      var leaderboard_id = "exampleLeaderbord123ID"
 *
 *      ...
 *
 *      gpgs.leaderboard_submit_score_immediate(leaderboard_id, 9001)
 *
 *      ...
 *
 *      func _on_leaderboard_score_submitted(id, score, status):
 *          if status == ST_OK:
 *              //succeeded action
 *          else:
 *              //failed action
 */
public void leaderboard_submit_score_immediate(final String id, final int score) {
    logMethod();

    if (!isConnectedLogged()) return;

    final boolean debug = this.debug;
    
    leaderboards.submitScoreImmediate(
            id, score, new ResultCallback<Leaderboards.SubmitScoreResult>() {
                @Override
                public void onResult(@NonNull Leaderboards.SubmitScoreResult submitScoreResult) {
                    String status = extractStatusNameFromStatus(
                            submitScoreResult.getStatus().toString());

                    if (debug) Log.d(TAG, MODULE
                            + ": > tried to submit score value " + String.valueOf(score)
                            + " with " + status);

                           GodotLib.calldeferred(
                                   instance_id, "_on_leaderboard_score_submitted",
                                   new Object[] { id, score, status });
                }
            });
}
 
开发者ID:drtwisted,项目名称:godot-google-play-game-services,代码行数:47,代码来源:GodotPlayGameServices.java

示例3: incrementScore

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override public IFuture<Boolean> incrementScore(final String leaderboardId, final int by) {
    final Future<Boolean> future = Future.make();
    activity.getMainHandler().post(new Runnable() {
        @Override public void run() {
            Games.Leaderboards
                .loadCurrentPlayerLeaderboardScore(
                    helper.getApiClient(),
                    leaderboardId,
                    LeaderboardVariant.TIME_SPAN_WEEKLY,
                    LeaderboardVariant.COLLECTION_PUBLIC
                )
                .setResultCallback(new ResultCallback<LoadPlayerScoreResult>() {
                    @Override public void onResult(LoadPlayerScoreResult result) {
                        processLoadScoreResult(result, leaderboardId, by, future);
                    }
                });
        }
    });
    return future;
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:21,代码来源:GameServicesHelper.java

示例4: onUpdateScoreClick

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@ィ(ˊ="USER_RECEIVED")
public void onUpdateScoreClick(JSONObject paramJSONObject)
{
  if (paramJSONObject != null)
  {
    QuizApplication.ᐝ().ˋ(paramJSONObject);
    int i = QuizApplication.ᐝ().ˋ.ʻ().ˊ;
    if (i > 0)
    {
      Leaderboards localLeaderboards = Games.Leaderboards;
      כּ localכּ = this.mHelper;
      if (localכּ.ˎ == null)
        throw new IllegalStateException("No GoogleApiClient. Did you call setup()?");
      localLeaderboards.submitScore(localכּ.ˎ, getResources().getString(2131165269), i);
    }
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:GameServiceActivity.java

示例5: x

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
public Leaderboards.LeaderboardMetadataResult x(final Status paramStatus)
{
  return new Leaderboards.LeaderboardMetadataResult()
  {
    public LeaderboardBuffer getLeaderboards()
    {
      return new LeaderboardBuffer(DataHolder.empty(14));
    }

    public Status getStatus()
    {
      return paramStatus;
    }

    public void release()
    {
    }
  };
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:fw.java

示例6: A

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
public Leaderboards.SubmitScoreResult A(final Status paramStatus)
{
  return new Leaderboards.SubmitScoreResult()
  {
    public ScoreSubmissionData getScoreData()
    {
      return new ScoreSubmissionData(DataHolder.empty(14));
    }

    public Status getStatus()
    {
      return paramStatus;
    }

    public void release()
    {
    }
  };
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:fw.java

示例7: uploadLeaderBoard

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@ィ(ˊ="GAME_SERVICES_UPLOAD_LEADER_BOARD")
public final void uploadLeaderBoard(כּ paramכּ)
{
  if (paramכּ.ˎ != null)
    paramכּ.ˎ.isConnected();
  int i;
  if ((paramכּ.ˎ != null) && (paramכּ.ˎ.isConnected()))
    i = 1;
  else
    i = 0;
  if (i != 0)
  {
    int j = QuizApplication.ᐝ().ˋ.ʻ().ˊ;
    if (j > 0)
    {
      Leaderboards localLeaderboards = Games.Leaderboards;
      if (paramכּ.ˎ == null)
        throw new IllegalStateException("No GoogleApiClient. Did you call setup()?");
      localLeaderboards.submitScore(paramכּ.ˎ, this.ˋ.getString(2131165269), j);
      ךּ.ˊ("RECEIVED_GAME_SERVICES_UPLOAD_LEADER_BOARD", new Object[0]);
    }
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:24,代码来源:Ô∫ã.java

示例8: getLeaderboards

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override
public void getLeaderboards(final GameServicesCallbacks.SuccessWithListListener<Leaderboard> leaderboardsListener) {
    if (enableGameServices) {
        Games.Leaderboards.loadLeaderboardMetadata(googleApiClient, true).setResultCallback(new ResultCallback<Leaderboards.LeaderboardMetadataResult>() {
            @Override
            public void onResult(Leaderboards.LeaderboardMetadataResult leaderboardMetadataResult) {
                if (leaderboardMetadataResult.getStatus().isSuccess()) {
                    List<Leaderboard> result = new ArrayList<>();
                    for (com.google.android.gms.games.leaderboard.Leaderboard lb : leaderboardMetadataResult.getLeaderboards()) {
                        result.add(new Leaderboard(lb.getLeaderboardId(), Provider.GOOGLE, lb.getDisplayName(), lb.getIconImageUrl()));
                    }
                    leaderboardsListener.success(result, false);
                } else {
                    leaderboardsListener.fail(leaderboardMetadataResult.getStatus().getStatusMessage());
                }
            }
        });
    } else {
        leaderboardsListener.fail("To use GPGS features, please set `enableGameServices = true` in Google provider initialization parameters.");
    }
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:22,代码来源:SoomlaGooglePlus.java

示例9: submitScore

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override
public void submitScore(String leaderboardId, long value, final GameServicesCallbacks.SuccessWithScoreListener submitScoreListener) {
    if (enableGameServices) {
        Games.Leaderboards.submitScoreImmediate(googleApiClient, leaderboardId, value).setResultCallback(new ResultCallback<Leaderboards.SubmitScoreResult>() {
            @Override
            public void onResult(Leaderboards.SubmitScoreResult submitScoreResult) {
                if (submitScoreResult.getStatus().isSuccess()) {
                    submitScoreListener.success(
                            new Score(
                                    new Leaderboard(submitScoreResult.getScoreData().getLeaderboardId(), getProvider(), "", ""), // here is no iconURL and title at this moment
                                    0, // rank is undefined here
                                    SoomlaProfile.getInstance().getStoredUserProfile(getProvider()),
                                    submitScoreResult.getScoreData().getScoreResult(LeaderboardVariant.TIME_SPAN_ALL_TIME).rawScore
                            )
                    );
                } else {
                    submitScoreListener.fail(submitScoreResult.getStatus().getStatusMessage());
                }
            }
        });
    } else {
        submitScoreListener.fail("To use GPGS features, please set `enableGameServices = true` in Google provider initialization parameters.");
    }
}
 
开发者ID:soomla,项目名称:android-profile,代码行数:25,代码来源:SoomlaGooglePlus.java

示例10: submitHightScore

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
private static void submitHightScore(final Context context, final GoogleApiClient apiClient, final long highestScoreValue) {
    LogX.i(TAG, "Submitting score to Google leaderboard");

    final PendingResult<SubmitScoreResult> result = Games.Leaderboards.submitScoreImmediate(apiClient, getLeaderboardId(context), highestScoreValue);
    result.setResultCallback(new ResultCallback<Leaderboards.SubmitScoreResult>() {

        @Override
        public void onResult(SubmitScoreResult finalResult) {
            Status status = finalResult.getStatus();
            LogX.i(TAG, "Result of the score submission: " + status);
            if (status.getStatusCode() == GamesStatusCodes.STATUS_OK) {
                PermData.saveHighestScoreSentToLeaderboard(context, highestScoreValue);
            }
        }
    });
}
 
开发者ID:sergiotorresperez,项目名称:jumplings,代码行数:17,代码来源:GooglePlayGamesLeaderboardHelper.java

示例11: setSubmitScore

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
public void setSubmitScore(boolean callback, String submitScoreId,
		long score) {
	if (!callback) {
		Games.Leaderboards.submitScore(mGoogleApiClient, submitScoreId,
				score);
	} else {
		Games.Leaderboards.submitScoreImmediate(mGoogleApiClient,
				submitScoreId, score).setResultCallback(
				new ResultCallback<Leaderboards.SubmitScoreResult>() {
					@Override
					public void onResult(
							Leaderboards.SubmitScoreResult submitScoreResult) {
						if (mCallback != null) {
							mCallback.onActionResult(
									ActionType.SUBMIT_SCORE,
									getStatusResult(submitScoreResult
											.getStatus()));
						}
					}
				});
	}
}
 
开发者ID:sadisasha,项目名称:PlayGames,代码行数:23,代码来源:PlayGamesServices.java

示例12: loadScoreOfLeaderBoardIfLarger

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
private void loadScoreOfLeaderBoardIfLarger(final String leaderboardId, final int currentScore, final String gameDifficulty) {
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient, leaderboardId, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC).setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
        @Override
        public void onResult(final Leaderboards.LoadPlayerScoreResult scoreResult) {
            if (isScoreResultValid(scoreResult)) {
                // here you can get the score like this
                int score = (int) scoreResult.getScore().getRawScore();
                if (score > currentScore) {
                    SharedPreferences.Editor editor = getSharedPreferences(ResultsActivity.PREF_NAME, MODE_PRIVATE).edit();
                    editor.putInt(ResultsActivity.SCORE_PREFIX + gameDifficulty, score);
                    editor.apply();
                }
            }
        }
    });
}
 
开发者ID:chrisjluc,项目名称:Onesearch,代码行数:17,代码来源:BaseGooglePlayServicesActivity.java

示例13: showLeaderboards

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override
public void showLeaderboards(String leaderBoardId) throws GameServiceException {
    if (isSessionActive()) {
        if (gpgsLeaderboardIdMapper != null)
            leaderBoardId = gpgsLeaderboardIdMapper.mapToGsId(leaderBoardId);

        myContext.startActivityForResult(leaderBoardId != null ?
                Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, leaderBoardId) :
                Games.Leaderboards.getAllLeaderboardsIntent(mGoogleApiClient), RC_LEADERBOARD);
    } else
        throw new GameServiceException.NoSessionException();
}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:13,代码来源:GpgsClient.java

示例14: submitToLeaderboard

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override
public boolean submitToLeaderboard(String leaderboardId, long score, String tag) {
    if (gpgsLeaderboardIdMapper != null)
        leaderboardId = gpgsLeaderboardIdMapper.mapToGsId(leaderboardId);

    if (leaderboardId != null && isSessionActive()) {
        if (tag != null)
            Games.Leaderboards.submitScore(mGoogleApiClient, leaderboardId, score, tag);
        else
            Games.Leaderboards.submitScore(mGoogleApiClient, leaderboardId, score);
        return true;
    } else
        return false;
}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:15,代码来源:GpgsClient.java

示例15: submitScore

import com.google.android.gms.games.leaderboard.Leaderboards; //导入依赖的package包/类
@Override
public void submitScore(int highScore) {
    if (isSignedIn()) {
        Games.Leaderboards.submitScore(gameHelper.getApiClient(),
                activity.getString(R.string.leaderboard_highscore), highScore);
    }
}
 
开发者ID:ezet,项目名称:penguins-in-space,代码行数:8,代码来源:AndroidNetworkService.java


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