Esempio n. 1
0
 public void SubmitLeaderboardScore(int score)
 {
     if (score > 0)
     {
         PlayGameServices.submitScore(m_leaderboardId, (long)score);
     }
 }
Esempio n. 2
0
        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 SubmitScore(int score, string leaderboardID)
        {
                        #if UNITY_ANDROID
            if (!Enabled)
            {
                return;
            }

            string leaderboard = GetLeaderboardID(leaderboardID);
            if (leaderboard != null)
            {
                PlayGameServices.submitScore(leaderboard, (long)score);
            }
                        #endif
        }
        public void PublishScore(int score)
        {
#if UNITY_ANDROID
            if (PlayGameServices.isSignedIn())
            {
                Debug.Log("Publish score. Signed In.");
                PlayGameServices.submitScore(_leaderboardId, score);
            }
            else
            {
                Debug.Log("Publish score not possible. Not Signed In.");
            }
#else
            Debug.Log("Error. AndroidLeaderboard.Show call for not android platform.");
#endif
        }
Esempio n. 5
0
    private void secondColumnButtions()
    {
        GUILayout.Label("Leaderboards");

        if (GUILayout.Button("Show Leaderboard"))
        {
            PlayGameServices.showLeaderboard("CgkI_-mLmdQEEAIQBQ", GPGLeaderboardTimeScope.AllTime);
        }


        if (GUILayout.Button("Show All Leaderboards"))
        {
            PlayGameServices.showLeaderboards();
        }


        if (GUILayout.Button("Submit Score"))
        {
            PlayGameServices.submitScore("CgkI_-mLmdQEEAIQBQ", 567);
        }


        if (GUILayout.Button("Load Raw Score Data"))
        {
            PlayGameServices.loadScoresForLeaderboard("CgkI_-mLmdQEEAIQBQ", GPGLeaderboardTimeScope.AllTime, false, false);
        }


        if (GUILayout.Button("Get Leaderboard Metadata"))
        {
            var info = PlayGameServices.getAllLeaderboardMetadata();
            Prime31.Utils.logObject(info);
        }


        if (GUILayout.Button("Get Achievement Metadata"))
        {
            var info = PlayGameServices.getAllAchievementMetadata();
            Prime31.Utils.logObject(info);
        }


        if (GUILayout.Button("Reload All Metadata"))
        {
            PlayGameServices.reloadAchievementAndLeaderboardData();
        }
    }
Esempio n. 6
0
        public void ReportScore(int score, int modeId, int leaderboard)
        {
#if UNITY_IOS && GAMECENTER
            if (isModeBasedGame)
            {
                GameCenterBinding.reportScore(score, modes[modeId].leaderboards[leaderboard].keyGameCenteriOS);
            }
            else
            {
                GameCenterBinding.reportScore(score, leaderboards[leaderboard].keyGameCenteriOS);
            }
#endif
#if UNITY_ANDROID && GPGSERVIES
            if (isModeBasedGame)
            {
                PlayGameServices.submitScore(modes[modeId].leaderboards[leaderboard].keyGoogleGameServices, score);
            }
            else
            {
                PlayGameServices.submitScore(leaderboards[leaderboard].keyGoogleGameServices, score);
            }
#endif
        }
Esempio n. 7
0
    public void SubmitScore(long score)
    {
#if UNITY_IPHONE || UNITY_ANDROID
        PlayGameServices.submitScore(_leaderboardID, score);
#endif
    }
Esempio n. 8
0
 public void PostScoreToLeaderBoard()
 {
     Debug.Log("Posting score");
     PlayGameServices.submitScore("CgkIr87MtK4BEAIQAA", (long)GlobalVariables.distanceCovered);
 }
Esempio n. 9
0
    //=============================================================================

    public void ReportScore(System.Int64 Score)
    {
        // Report score to GC/GP first
                #if UNITY_IPHONE
        if ((IsLoggedIn() == true) && (m_ManagerState == eManagerState.Idle))
        {
            GameCenterBinding.reportScore(Score, ScoreboardID);
            m_ManagerState = eManagerState.ReportScore;
        }
        else
        {
            if (ReportScoreFailEvent != null)
            {
                ReportScoreFailEvent("Error - not logged in or manager busy");
            }
        }
                #endif

                #if UNITY_ANDROID
        if ((IsLoggedIn() == true) && (m_ManagerState == eManagerState.Idle))
        {
            PlayGameServices.submitScore(ScoreboardIDAndroid, Score);
            m_ManagerState = eManagerState.ReportScore;
        }
        else
        {
            if (ReportScoreFailEvent != null)
            {
                ReportScoreFailEvent("Error - not logged in or manager busy");
            }
        }
                #endif

        // Now report score to playtomic system along with any custom parameters
        if (IsPlayerRegistered() == false)
        {
            return;
        }

                #if UNITY_EDITOR
        string sourceType = "Editor";
                #elif UNITY_IPHONE
        string sourceType = "iOS";
                #elif UNITY_ANDROID
        string sourceType = "iOS";         //"Android";
                #else
        string sourceType = "Unknown";
                #endif

        string CurCountry = PreHelpers.GetCountryCode();

        PlayerScore NewScore = new PlayerScore
        {
            playername      = GetPlayerName(),
            playerid        = GetPlayerID(),
            points          = Score,
            table           = ScoreboardID,
            allowduplicates = false,
            source          = sourceType,
            fields          = new PDictionary
            {
                { "country", CurCountry }
            }
        };

        Playtomic.Leaderboards.Save(NewScore, ScoreSubmitComplete);
    }
Esempio n. 10
0
 void SubmitScore()
 {
     PlayGameServices.submitScore("CgkItJD32NYKEAIQAQ", GameManager.cookiesTotal);
 }
Esempio n. 11
0
 void ShowLeaderboard()
 {
     PlayGameServices.submitScore("CgkItJD32NYKEAIQAQ", GameManager.cookiesTotal);
     PlayGameServices.showLeaderboard("CgkItJD32NYKEAIQAQ", GPGLeaderboardTimeScope.AllTime);
 }