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


Java Player类代码示例

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


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

示例1: onConnected

import com.google.android.gms.games.Player; //导入依赖的package包/类
/**
 *
 * Google API client
 *
 */

@Override
public void onConnected( @Nullable Bundle bundle ) {
	AIR.log( "GameServicesHelper | connected" );
	if( mPendingAchievementsUI ) {
		mPendingAchievementsUI = false;
		showAchievementsUI();
	} else if( mPendingLeaderboardsUI ) {
		mPendingLeaderboardsUI = false;
		showLeaderboardsUI( mPendingLeaderboardId );
	} else {
		AIR.log( "GameServicesHelper | user signed in" );
		Player player = Games.Players.getCurrentPlayer( mGoogleApiClient );
		JSONObject response = GSPlayerUtils.getJSON( player );
		AIR.dispatchEvent( GameServicesEvent.AUTH_SUCCESS, response.toString() );
	}
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:23,代码来源:GameServicesHelper.java

示例2: getJSON

import com.google.android.gms.games.Player; //导入依赖的package包/类
static JSONObject getJSON( Player player ) {
	JSONObject response = new JSONObject();
	if( player != null ) {
		try {
			response.put( "playerId", player.getPlayerId() );
			response.put( "displayName", player.getDisplayName() );
			if( player.hasIconImage() ) {
				response.put( "iconImageUri", player.getIconImageUri().toString() );
			}
			if( player.hasHiResImage() ) {
				response.put( "hiResImageUri", player.getHiResImageUri().toString() );
			}
			// alias not available
		} catch( Exception e ) {
			e.printStackTrace();
		}
	}
	return response;
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:20,代码来源:GSPlayerUtils.java

示例3: addUser

import com.google.android.gms.games.Player; //导入依赖的package包/类
private void addUser(website.bloop.app.api.Player player) {
    SharedPreferences prefs = getSharedPreferences(BLOOP_PREFERENCE_FILE, Context.MODE_PRIVATE);
    mApplication.getService().addPlayer(player)
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                    responseBody -> {
                        String token = prefs.getString(BloopFirebaseInstanceIDService.PREF_FIREBASE_TOKEN, "");
                        if (token.equals("")) {
                            token = FirebaseInstanceId.getInstance().getToken();
                        }
                        mApplication.sendFirebaseRegistrationToServer(token);
                    },
                    throwable -> Log.e(TAG, throwable.getMessage())
            );
}
 
开发者ID:BloopApp,项目名称:Bloop,代码行数:17,代码来源:PlayLoginActivity.java

示例4: showSignOutBar

import com.google.android.gms.games.Player; //导入依赖的package包/类
private void showSignOutBar() {
    findViewById(R.id.sign_in_bar).setVisibility(View.GONE);
    findViewById(R.id.sign_out_bar).setVisibility(View.VISIBLE);

    Player player = Games.Players.getCurrentPlayer(mGoogleApiClient);
    String url = player.getIconImageUrl();
    TextView name = (TextView)findViewById(R.id.playerName);
    name.setText(player.getDisplayName());
    if (url != null) {
        ImageView vw = (ImageView) findViewById(R.id.avatar);

        // load the image in the background.
        new DownloadImageTask(vw).execute(url);
     }
    String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
    TextView emailView = (TextView)findViewById((R.id.playerEmail));
    emailView.setText(email);
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:19,代码来源:BeGenerousActivity.java

示例5: d

import com.google.android.gms.games.Player; //导入依赖的package包/类
public d(LeaderboardScore paramLeaderboardScore)
{
  this.vK = paramLeaderboardScore.getRank();
  this.vL = ((String)eg.f(paramLeaderboardScore.getDisplayRank()));
  this.vM = ((String)eg.f(paramLeaderboardScore.getDisplayScore()));
  this.vN = paramLeaderboardScore.getRawScore();
  this.vO = paramLeaderboardScore.getTimestampMillis();
  this.vP = paramLeaderboardScore.getScoreHolderDisplayName();
  this.vQ = paramLeaderboardScore.getScoreHolderIconImageUri();
  this.vR = paramLeaderboardScore.getScoreHolderHiResImageUri();
  Player localPlayer = paramLeaderboardScore.getScoreHolder();
  PlayerEntity localPlayerEntity;
  if (localPlayer == null)
    localPlayerEntity = null;
  else
    localPlayerEntity = (PlayerEntity)localPlayer.freeze();
  this.vS = localPlayerEntity;
  this.vT = paramLeaderboardScore.getScoreTag();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:d.java

示例6: ParticipantEntity

import com.google.android.gms.games.Player; //导入依赖的package包/类
public ParticipantEntity(Participant paramParticipant)
{
  this.kg = 2;
  this.up = paramParticipant.getParticipantId();
  this.qa = paramParticipant.getDisplayName();
  this.sL = paramParticipant.getIconImageUri();
  this.sM = paramParticipant.getHiResImageUri();
  this.wr = paramParticipant.getStatus();
  this.ws = paramParticipant.dy();
  this.wt = paramParticipant.isConnectedToRoom();
  Player localPlayer = paramParticipant.getPlayer();
  PlayerEntity localPlayerEntity;
  if (localPlayer == null)
    localPlayerEntity = null;
  else
    localPlayerEntity = new PlayerEntity(localPlayer);
  this.wu = localPlayerEntity;
  this.wv = paramParticipant.getCapabilities();
  this.ww = paramParticipant.getResult();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:ParticipantEntity.java

示例7: scoresToJsonString

import com.google.android.gms.games.Player; //导入依赖的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

示例8: call

import com.google.android.gms.games.Player; //导入依赖的package包/类
@Override
public FREObject call(FREContext arg0, FREObject[] arg1) {
	
	Extension.context.createHelperIfNeeded(arg0.getActivity());
	Player player = Games.Players.getCurrentPlayer(Extension.context.getApiClient());
	
	FREObject playerName = null;
	if (player != null)
	{
		try {
			playerName = FREObject.newObject(player.getDisplayName());
		} catch (FREWrongThreadException e) {
			e.printStackTrace();
		}
	}
	
	return playerName;
}
 
开发者ID:freshplanet,项目名称:ANE-Google-Play-Game-Services,代码行数:19,代码来源:AirGooglePlayGamesGetActivePlayerName.java

示例9: playerInfo

import com.google.android.gms.games.Player; //导入依赖的package包/类
private void playerInfo() {
    Player player = fragmentController.getGamesClientPublic().getCurrentPlayer();
    String name = player.getDisplayName();
    Uri uri = player.getIconImageUri();

    String displayName;
    if (player == null) {
        Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
        displayName = "???";
    } else {
        displayName = player.getDisplayName();
        appPreference.setLoginName(displayName);
    }


    userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName));
    //userIcon.setImageURI(uri);
}
 
开发者ID:pjq,项目名称:pushup,代码行数:19,代码来源:GameBoardFragment.java

示例10: playerInfo

import com.google.android.gms.games.Player; //导入依赖的package包/类
private void playerInfo() {
    Player player = getGamesClient().getCurrentPlayer();
    String name = player.getDisplayName();
    Uri uri = player.getIconImageUri();

    String displayName;
    if (player == null) {
        Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
        displayName = "???";
    } else {
        displayName = player.getDisplayName();
        appPreference.setLoginName(displayName);
    }


    userInfo.setText(String.format(getString(R.string.you_are_signed_in_as), displayName));
    //userIcon.setImageURI(uri);
}
 
开发者ID:pjq,项目名称:pushup,代码行数:19,代码来源:MainActivity.java

示例11: ParticipantEntity

import com.google.android.gms.games.Player; //导入依赖的package包/类
public ParticipantEntity(Participant paramParticipant)
{
  Player localPlayer = paramParticipant.i();
  if (localPlayer == null);
  for (PlayerEntity localPlayerEntity = null; ; localPlayerEntity = new PlayerEntity(localPlayer))
  {
    this.a = localPlayerEntity;
    this.b = paramParticipant.h();
    this.c = paramParticipant.e();
    this.d = paramParticipant.f();
    this.e = paramParticipant.g();
    this.f = paramParticipant.b();
    this.g = paramParticipant.c();
    this.h = paramParticipant.d();
    return;
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:18,代码来源:ParticipantEntity.java

示例12: onConnected

import com.google.android.gms.games.Player; //导入依赖的package包/类
@Override
public void onConnected(Bundle connectionHint) 
{
	// The player is signed in. Hide the sign-in button and allow the
	// player to proceed.
	Log.i("yoyo","Sign In Succeeded");
	
	
	Player p = Games.Players.getCurrentPlayer(getApiClient());
       String displayName;
       String id;
       if (p == null) {
           Log.i("yoyo", "mGamesClient.getCurrentPlayer() is NULL!");
           displayName = "???";
           id="-1";
       }
       else {
           displayName = p.getDisplayName();
           id = p.getPlayerId();
       }
       
       Log.i("yoyo","Found displayname " + displayName + " with id " + id);
	
	RunnerJNILib.OnLoginSuccess(displayName,id,"","","","","");
	
	//Call back to generate the social event 
}
 
开发者ID:Magicrafter13,项目名称:1946,代码行数:28,代码来源:GooglePlayServicesExtension.java

示例13: succeedSignIn

import com.google.android.gms.games.Player; //导入依赖的package包/类
public void succeedSignIn() {
	Log.d(TAG, "Google signed in.");

	mAchievementsClient = Games.getAchievementsClient(activity, mAccount);
	mLeaderboardsClient = Games.getLeaderboardsClient(activity, mAccount);
	mPlayersClient = Games.getPlayersClient(activity, mAccount);

	Games.getGamesClient(activity, mAccount).setViewForPopups(
	activity.getWindow().getDecorView().findViewById(android.R.id.content));

	GUtils.callScriptFunc("login", "true");

	mPlayersClient.getCurrentPlayer()
	.addOnCompleteListener(new OnCompleteListener<Player>() {
		@Override
		public void onComplete(@NonNull Task<Player> task) {
			String displayName = "UserName";

			if (task.isSuccessful()) {
				displayName = task.getResult().getDisplayName();
			} else {
				Exception e = task.getException();
			}

			GUtils.callScriptFunc("user", displayName);
                   }
	});
}
 
开发者ID:FrogSquare,项目名称:GodotGoogleService,代码行数:29,代码来源:PlayService.java

示例14: onConnected

import com.google.android.gms.games.Player; //导入依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
    Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
    String displayName;
    String playerId;

    if (p == null) {
        Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
        displayName = "???";
    } else {
        displayName = p.getDisplayName();

        playerId = Games.Players.getCurrentPlayerId(mGoogleApiClient);

        mApplication.setPlayerName(displayName);
        mApplication.setPlayerId(playerId);

        website.bloop.app.api.Player player = new website.bloop.app.api.Player(displayName, playerId, null);
        addUser(player);
    }

    // hide button on login
    loginButton.setVisibility(View.INVISIBLE);
    loginText.setText(displayName);

    // store that we are logged in
    SharedPreferences pref = getSharedPreferences(PREF_LOGIN, Context.MODE_PRIVATE);
    SharedPreferences.Editor ed = pref.edit();
    ed.putBoolean(PREF_LOGIN_VAL, true);
    ed.apply();

    // start the main game now
    Intent newIntent = new Intent(getBaseContext(), BloopActivity.class);
    newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(newIntent);
    finish();
}
 
开发者ID:BloopApp,项目名称:Bloop,代码行数:38,代码来源:PlayLoginActivity.java

示例15: updateGooglePlayGames

import com.google.android.gms.games.Player; //导入依赖的package包/类
private void updateGooglePlayGames() {
    if (mGoogleApiClient.isConnected()) {
        // Set the greeting appropriately on main menu
        Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
        String displayName;
        Uri imageUri;
        if (p == null) {
            displayName = getString(R.string.google_play_games_player_unknown);
            imageUri = null;
        } else {
            displayName = p.getDisplayName();
            imageUri = p.hasHiResImage() ? p.getHiResImageUri() : p.getIconImageUri();
            //bannerUri = p.getBannerImageLandscapeUri();
        }
        Log.w(TAG, "onConnected(): current player is " + displayName);

        mIvGooglePlayGamesIcon.setVisibility(View.GONE);
        mIvGooglePlayGamesAvatar.setVisibility(View.VISIBLE);
        ImageManager.create(this).loadImage(mIvGooglePlayGamesAvatar, imageUri, R.drawable.im_avatar);
        mTvGooglePlayGames.setVisibility(View.GONE);
        mTvGooglePlayGamesName.setVisibility(View.VISIBLE);
        mTvGooglePlayGamesName.setText(displayName);
        mVgGooglePlayGamesActions.setVisibility(View.VISIBLE);
    } else {
        mIvGooglePlayGamesIcon.setVisibility(View.VISIBLE);
        mIvGooglePlayGamesAvatar.setVisibility(View.GONE);
        mTvGooglePlayGames.setVisibility(View.VISIBLE);
        mTvGooglePlayGamesName.setVisibility(View.GONE);
        mVgGooglePlayGamesActions.setVisibility(View.GONE);
    }
}
 
开发者ID:pflammertsma,项目名称:cryptogram,代码行数:32,代码来源:CryptogramActivity.java


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