Example #1
0
        static StackObject *SetLocalUserScore_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.SocialPlatforms.IScore score = (UnityEngine.SocialPlatforms.IScore) typeof(UnityEngine.SocialPlatforms.IScore).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.SocialPlatforms.Impl.Leaderboard instance_of_this_method;
            instance_of_this_method = (UnityEngine.SocialPlatforms.Impl.Leaderboard) typeof(UnityEngine.SocialPlatforms.Impl.Leaderboard).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.SetLocalUserScore(score);

            return(__ret);
        }
Example #2
0
        // Sync local score with the one on leaderboard
        void OnLeaderboardScoreLoaded(string ldbName, UnityEngine.SocialPlatforms.IScore score)
        {
            if (score == null)
            {
                return;
            }

            int serverScore    = (int)score.value;
            int localHighScore = ScoreManager.Instance.HighScore;

            if (localHighScore > serverScore)
            {
                // Local score is better than the submitted one, so reporting the local one.
                ReportScore(localHighScore, leaderboardName);
            }
            else if (localHighScore < serverScore)
            {
                // Loaded score is better than the local one, so updating the local highscore.
                ScoreManager.Instance.UpdateHighScore(serverScore);
            }
        }