public void ShowLeaderboard() { #if UNITY_IPHONE || UNITY_ANDROID // show leaderboard UI PlayGameServices.showLeaderboard(_leaderboardID, GPGLeaderboardTimeScope.AllTime); #endif }
public static void TryAuthentication(bool forceMode = false) { if (instanceExists && instance.debugMode) { Debug.LogFormat("PlayGameCenterManager:TryAuthentication({0}) - isAuthenticated={1}, isLastAuthenticationFailed={2}", forceMode, isAuthenticated, isLastAuthenticationFailed); } if (IsSingedIn()) // If already logined, skip here { return; } if (isLastAuthenticationFailed && !forceMode) // If last login failed, don't do it again (unless in forceMode) { return; } _isForcingAuthentication = forceMode; #if UNITY_IOS GameCenterBinding.authenticateLocalPlayer(forceMode); // Authenticate the player #elif UNITY_ANDROID && !CHS if (forceMode) { PlayGameServices.authenticate(); // Authenticate with UI } else { PlayGameServices.attemptSilentAuthentication(); // Authenticate Silently (with no UI) } #endif }
//============================================================================= public void Logout() { #if UNITY_IPHONE if ((IsLoggedIn() == true) && (m_ManagerState == eManagerState.Idle)) { // Stop auto log-in from now on PlayerPrefs.SetInt("GCGPAutoLogin", 0); m_bIsLoggedIn = false; m_ManagerState = eManagerState.Idle; if (LogoutSuccessEvent != null) { LogoutSuccessEvent(); } } #endif #if UNITY_ANDROID if ((IsLoggedIn() == true) && (m_ManagerState == eManagerState.Idle)) { // Stop auto log-in from now on PlayerPrefs.SetInt("GCGPAutoLogin", 0); m_bIsLoggedIn = false; m_ManagerState = eManagerState.Idle; PlayGameServices.signOut(); if (LogoutSuccessEvent != null) { LogoutSuccessEvent(); } } #endif }
public void SubmitLeaderboardScore(int score) { if (score > 0) { PlayGameServices.submitScore(m_leaderboardId, (long)score); } }
public void DisplayUI() { #if UNITY_ANDROID && API_SYNC_GPGS UnityEngine.Debug.Log("Display UI"); PlayGameServices.showSnapshotList(3, "Kubiko", true, false); #endif }
public void ShowLeaderboard(ButtonEventArgs args) { #if UNITY_IOS #if GAMECENTER if (GameCenterBinding.isPlayerAuthenticated()) { GameCenterBinding.showLeaderboardWithTimeScope(GameCenterLeaderboardTimeScope.AllTime); } else { StartLeaderboard(); } #else Core.Utility.Popup.PopupMessages.Me.NativeFuncionNonAvailableMessage(); #endif #endif #if UNITY_ANDROID #if GPGSERVIES if (!PlayGameServices.isSignedIn()) { StartLeaderboard(false); } else { PlayGameServices.showLeaderboards(); } #else Core.Utility.Popup.PopupMessages.Me.NativeFuncionNonAvailableMessage(); #endif #endif }
public void StartLeaderboard(bool autoStart = false) { if (!Network.IsInternetConnection() && !autoStart) { Core.Utility.Popup.PopupMessages.Me.InternetConnectionMessgae(); return; } #if UNITY_IOS && GAMECENTER if (!GameCenterBinding.isPlayerAuthenticated()) { GameCenterBinding.authenticateLocalPlayer(); } #endif #if UNITY_ANDROID #if GPGSERVIES && !AMAZONSTORE GPGManager.authenticationFailedEvent += (string error) => { MyDebug.Log("Prime[31] Google Play service authenticate fail with error:\n" + error); }; GPGManager.authenticationSucceededEvent += (string data) => { MyDebug.Log("Prime[31] Google Play service authenticate compelete with data:\n" + data); }; if (!PlayGameServices.isSignedIn()) { #if MYDEBUG PlayGameServices.enableDebugLog(true); #endif PlayGameServices.authenticate(); } #endif #endif }
private void CheckshouldLoadTopScores() { if (shouldLoadMyScores) { foreach (LeaderboardInfo li in leaderboardInfos) { #if UNITY_IOS || UNITY_TVOS GameCenterBinding.retrieveScoresForPlayerIds(new string[1] { GameCenterBinding.playerIdentifier() }, li.leaderboardId); #elif UNITY_ANDROID && !CHS PlayGameServices.loadCurrentPlayerLeaderboardScore(li.leaderboardId, GPGLeaderboardTimeScope.AllTime, false); #endif } } #if UNITY_ANDROID CheckOfflineHighScores(); #endif if (shouldLoadTopScores) { DownloadAllLeaderboardTopScores(TimeScope.AllTime); } }
public static void Report(Leaderboard leaderboard, long score) { if (!instanceExists) { return; } int leaderboardIndex = (int)leaderboard; if (leaderboardIndex >= instance.leaderboardInfos.Length) { Debug.LogFormat("LeaderboardManager:Report - leaderboard index ({0}) out of bound.", leaderboardIndex); return; } if (instance.debugMode) { Debug.LogFormat("LeaderboardManager:Report({0},{1})", leaderboard, score); } #if UNITY_IOS || UNITY_TVOS GameCenterBinding.reportScore(score, instance.leaderboardInfos[leaderboardIndex].leaderboardId); #elif UNITY_ANDROID && !CHS if (PlayGameCenterManager.isAuthenticated) { PlayGameServices.submitScore(instance.leaderboardInfos[leaderboardIndex].leaderboardId, score); } else { SetCachedHighScore(leaderboard, score); } #endif }
public void LoadScoresForLeaderboard(bool aroundMyRankResults, int count = 0) { MaxVisibleScores = (count > 0) ? count : int.MaxValue; #if UNITY_IPHONE || UNITY_ANDROID PlayGameServices.loadScoresForLeaderboard(_leaderboardID, GPGLeaderboardTimeScope.AllTime, false, aroundMyRankResults); Debug.LogWarning("call LoadScoresForLeaderboard"); #endif }
void OnGUI() { GUI.skin.label.alignment = TextAnchor.MiddleCenter; beginColumn(); // if there is no game in progress we show buttons to setup a room if (!_isGameInProgress) { if (GUILayout.Button("Authenticate")) { PlayGameServices.authenticate(); } GUILayout.Label("Room Creation"); if (GUILayout.Button("Show Invitation Inbox")) { GPGMultiplayer.showInvitationInbox(); } if (GUILayout.Button("Create Room Programmatically")) { GPGMultiplayer.createRoomProgrammatically(1, 1, 0); } if (GUILayout.Button("Show Player Selector")) { GPGMultiplayer.showPlayerSelector(1, 1); } } else { GUILayout.Label("In Real-time Match"); if (GUILayout.Button("Leave Room")) { GPGMultiplayer.leaveRoom(); } if (GUILayout.Button("Send Unreliable Message to All")) { var bytes = System.Text.Encoding.UTF8.GetBytes("howdy. current time: " + System.DateTime.Now); GPGMultiplayer.sendUnreliableRealtimeMessageToAll(bytes); } GUILayout.Space(40); GUILayout.Label(_lastReceivedMessage); } endColumn(false); }
public static bool IsSingedIn() { #if UNITY_IOS return(GameCenterBinding.isPlayerAuthenticated()); #elif UNITY_ANDROID return(PlayGameServices.isSignedIn()); #endif return(false); }
public void Authenticate() { #if UNITY_IPHONE || UNITY_ANDROID Init(); PlayGameServices.setAchievementToastSettings(GPGToastPlacement.Center, 50); PlayGameServices.authenticate(); Debug.LogWarning("MySocial authenticate"); #endif }
void Start() { PlayGameServices.enableDebugLog(true); // we always want to call init as soon as possible after launch. Be sure to pass your own clientId to init on iOS! // This call is not required on Android. //PlayGameServices.init( "YOUR_CLIENT_ID", true ); PlayGameServices.init("160040154367.apps.googleusercontent.com", true); }
public void Login() { #if UNITY_ANDROID if (!PlayGameServices.isSignedIn()) { ZedLogger.Log("trying to authenticate local player"); PlayGameServices.authenticate(); } #endif }
//============================================================================= public void DisplayAchievements() { #if UNITY_IPHONE GameCenterBinding.showAchievements(); #endif #if UNITY_ANDROID PlayGameServices.showAchievements(); #endif }
//============================================================================= public void DisplayScoreboards() { #if UNITY_IPHONE GameCenterBinding.showLeaderboardWithTimeScope(GameCenterLeaderboardTimeScope.AllTime); #endif #if UNITY_ANDROID PlayGameServices.showLeaderboards(); #endif }
protected override void Setup(APIWrapperSettings settings) { #if UNITY_ANDROID if (!PlayGameServices.isSignedIn() && !PlayerDataManager.Instance.GameCenterLoginRequested) { ZedLogger.Log("trying to authenticate local player (silently)"); PlayGameServices.attemptSilentAuthentication(); } #endif }
public static string GetPlayerName() { #if UNITY_IOS return(GameCenterBinding.playerAlias()); #elif UNITY_ANDROID && !CHS return(PlayGameServices.getLocalPlayerInfo().name); #else return(string.Empty); #endif }
public void ReportStarAchievementProgress(int numStars) { if (numStars > 0 && numStars % 10 == 0) { int index = (numStars / 10) - 1; if (index >= 0 && index <= m_starAchievementIds.Length - 1) { PlayGameServices.unlockAchievement(m_starAchievementIds[index]); } } }
public void UnlockAchievement(string achievementName) { for (int i = 0; i < achievementNameID.Count; i++) { if (achievementNameID[i].achievementName == achievementName) { Debug.Log("Displaying achievements : " + achievementNameID[i].achievementID); PlayGameServices.unlockAchievement(achievementNameID[i].achievementID, true); } } }
public void ToggleSignIn() { if (IsSignedIn) { PlayGameServices.signOut(); } else { PlayGameServices.authenticate(); } }
public void ShowAchievements() { if (IsSignedIn) { PlayGameServices.showAchievements(); } else { PlayGameServices.authenticate(); } }
private void OnAuthenticationSucceeded(string param) { if (debugMode) { Debug.LogFormat("PlayGameCenterManager:OnAuthenticationSucceeded({0})"); } ProcessAuthenticationSucceeded(); playerNameLoadedEvent?.Invoke(PlayGameServices.getLocalPlayerInfo().name); }
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); }
public void ShowLeaderboard() { if (IsSignedIn) { PlayGameServices.showLeaderboards(); } else { PlayGameServices.authenticate(); } }
public void StartGoogleCloudLogin() { Debug.Log("StartGoogleCloudLogin() called"); if (!PlayGameServices.isSignedIn() && !googleCloudTryingToLogin) { Debug.Log("StartGoogleCloudLogin() authenticate called"); PlayGameServices.authenticate(); googleCloudTryingToLogin = true; } }
public static void ShowPlayGameCenterLeaderboards() { if (!PlayGameCenterManager.isAuthenticated) { PlayGameCenterManager.TryAuthentication(true); } #if UNITY_IOS || UNITY_TVOS GameCenterBinding.showLeaderboardWithTimeScope(GameCenterLeaderboardTimeScope.AllTime); #elif UNITY_ANDROID && !CHS PlayGameServices.showLeaderboards(); #endif }
public static void ShowPlayGameCenterAchievements() { if (!PlayGameCenterManager.isAuthenticated) { PlayGameCenterManager.TryAuthentication(true); } #if UNITY_IOS || UNITY_TVOS GameCenterBinding.showAchievements(); #elif UNITY_ANDROID && !CHS PlayGameServices.showAchievements(); #endif }
public void DeleteUserFromCloud() { Debug.Log("[UserManagerCloud] DeleteUserFromCloud..."); #if UNITY_IPHONE || UNITY_EDITOR StartCoroutine(DeleteFromCloud()); #elif UNITY_ADNROID if (PlayGameServices.isSignedIn()) { PlayGameServices.deleteCloudDataForKey(0, false); } #endif }