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


Java Player.getDisplayName方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: onConnected

import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
    Log.d(TAG, "onConnected(): connected to Google APIs");
    // Show sign-out button on main menu
    mMainMenuFragment.setShowSignInButton(false);

    // Show "you are signed in" message on win screen, with no sign in button.
    mWinFragment.setShowSignInButton(false);

    // Set the greeting appropriately on main menu
    Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
    String displayName;
    if (p == null) {
        Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
        displayName = "???";
    } else {
        displayName = p.getDisplayName();
    }
    mMainMenuFragment.setGreeting("Hello, " + displayName);


    // if we have accomplishments to push, push them
    if (!mOutbox.isEmpty()) {
        pushAccomplishments();
        Toast.makeText(this, getString(R.string.your_progress_will_be_uploaded),
                Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:29,代码来源:MainActivity.java

示例7: onSignInSucceeded

import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Override
  public void onSignInSucceeded() {
//Util.alert(cordova.getActivity(), "onSignInSucceeded");	

//https://github.com/freshplanet/ANE-Google-Play-Game-Services/blob/master/android/src/com/freshplanet/googleplaygames/functions/AirGooglePlayGamesGetActivePlayerName.java
//https://developer.android.com/reference/com/google/android/gms/games/Games.html#Players
//https://developer.android.com/reference/com/google/android/gms/games/Players.html#getCurrentPlayer(com.google.android.gms.common.api.GoogleApiClient)
//https://developer.android.com/reference/com/google/android/gms/games/Player.html
Player player = Games.Players.getCurrentPlayer(getGameHelper().getApiClient());
JSONObject playerDetail = new JSONObject();
try {
	if (player != null)
	{
		String playerId = player.getPlayerId();
		String displayName = player.getDisplayName();
		//String title = player.getTitle();
						
		playerDetail.put("playerId", playerId);
		playerDetail.put("playerDisplayName", displayName);
	}
}
catch(JSONException ex){
}

PluginResult pr = new PluginResult(PluginResult.Status.OK, playerDetail);
//pr.setKeepCallback(true);
loginCC.sendPluginResult(pr);
//PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
//pr.setKeepCallback(true);
//loginCC.sendPluginResult(pr);			
  }
 
开发者ID:cranberrygame,项目名称:cordova-plugin-game,代码行数:32,代码来源:Game.java

示例8: providePlayerOneDefaultName

import com.google.android.gms.games.Player; //导入方法依赖的package包/类
@Provides
@Named("PlayerOneDefaultName")
public String providePlayerOneDefaultName(GoogleApiClient googleApiClient,
    AvatarManager avatarManager) {
  if (googleApiClient.isConnected()) {
    Player currentPlayer = Players.getCurrentPlayer(googleApiClient);
    avatarManager.setAvatarUri(currentPlayer.getDisplayName(), currentPlayer.getIconImageUri());
    return currentPlayer.getDisplayName();
  } else {
    return application.getString(R.string.player_one_default_name);
  }
}
 
开发者ID:cauchymop,项目名称:goblob,代码行数:13,代码来源:GoApplicationModule.java


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