public static string GetPlayerName() { #if UNITY_IOS return(GameCenterBinding.playerAlias()); #elif UNITY_ANDROID && !CHS return(PlayGameServices.getLocalPlayerInfo().name); #else return(string.Empty); #endif }
public GPGPlayerInfo GetLocalPlayerInfo() { var playerInfo = PlayGameServices.getLocalPlayerInfo(); Prime31.Utils.logObject(playerInfo); // if we are on Android and have an avatar image available, lets download the profile pic //if (Application.platform == RuntimePlatform.Android && playerInfo.avatarUrl != null) // PlayGameServices.loadProfileImageForUri(playerInfo.avatarUrl); return(playerInfo); }
private void OnAuthenticationSucceeded(string param) { if (debugMode) { Debug.LogFormat("PlayGameCenterManager:OnAuthenticationSucceeded({0})"); } ProcessAuthenticationSucceeded(); playerNameLoadedEvent?.Invoke(PlayGameServices.getLocalPlayerInfo().name); }
void OnGUI() { GUI.skin.label.alignment = TextAnchor.MiddleCenter; beginColumn(); GUILayout.Label("Authentication and Settings"); if (GUILayout.Button("Set Toasts on Bottom")) { PlayGameServices.setAchievementToastSettings(GPGToastPlacement.Bottom, 50); } if (GUILayout.Button("Authenticate")) { PlayGameServices.authenticate(); } if (GUILayout.Button("Sign Out")) { PlayGameServices.signOut(); } if (GUILayout.Button("Is Signed In")) { // Please note that the isSignedIn method is a total hack that was added to work around a current bug where Google // does not properly notify an app that the user signed out Debug.Log("is signed in? " + PlayGameServices.isSignedIn()); } if (GUILayout.Button("Get Player Info")) { var playerInfo = PlayGameServices.getLocalPlayerInfo(); Debug.Log(playerInfo); // if we are on Android and have an avatar image available, lets download the profile pic if (Application.platform == RuntimePlatform.Android && playerInfo.avatarUrl != null) { PlayGameServices.loadProfileImageForUri(playerInfo.avatarUrl); } } GUILayout.Label("Achievements"); if (GUILayout.Button("Show Achievements")) { PlayGameServices.showAchievements(); } if (GUILayout.Button("Increment Achievement")) { PlayGameServices.incrementAchievement("CgkI_-mLmdQEEAIQAQ", 2); } if (GUILayout.Button("Unlock Achievment")) { PlayGameServices.unlockAchievement("CgkI_-mLmdQEEAIQAw"); } endColumn(true); // toggle to show two different sets of buttons if (toggleButtonState("Show Cloud Save Buttons")) { secondColumnButtions(); } else { cloudSaveButtons(); } toggleButton("Show Cloud Save Buttons", "Toggle Buttons"); endColumn(false); }