コード例 #1
0
 public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
 {
                 #if !IOS_DISABLE_APPLE_SCORES
     reportScoreCallback = callback;
     GameCenterReportScore(score, findNativeLoaderboardID(leaderboardID));
                 #endif
 }
コード例 #2
0
 /// <summary>
 /// Dumy method.
 /// </summary>
 /// <param name="leaderboardID"></param>
 /// <param name="score"></param>
 /// <param name="callback"></param>
 /// <param name="services"></param>
 public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
 {
     if (callback != null)
     {
         callback(false, "Dumy Score Obj");
     }
 }
コード例 #3
0
        /// <summary>
        /// Use to report a floating-point or currency score that formats according to the 'ScoreFormat' option
        /// </summary>
        /// <param name="leaderboardID">Leaderboard ID.</param>
        /// <param name="score">Score to report.</param>
        /// <param name="callback">The callback that fires when done.</param>
        public static void ReportScore(string leaderboardID, float score, ReportScoreCallbackMethod callback)
        {
            if (waitingForOperation)
            {
                Debug.LogError("Must wait for last Score operation to complete.");
                return;
            }

            var leaderboard = findLeaderboard(leaderboardID);

            if (leaderboard == null)
            {
                Debug.LogError("Failed to find leaderboard with ID: " + leaderboardID);
                return;
            }

            if (leaderboard.ScoreFormat != LeaderbaordScoreFormats.Numerical)
            {
                Debug.LogError("Leaderboard Formating type must be Numerical not: " + leaderboard.ScoreFormat);
                return;
            }

            long value = (long)(Math.Round(score, leaderboard.ScoreFormat_DecimalPlaces) * Math.Pow(10, leaderboard.ScoreFormat_DecimalPlaces));

            waitingForOperation = true;
            reportScoreCallback = callback;
            plugin.ReportScore(leaderboardID, value, async_reportScoreCallback, ReignServices.Singleton);
        }
コード例 #4
0
        /// <summary>
        /// Use to report a integer based numerical score with no API checks or formating
        /// </summary>
        /// <param name="leaderboardID">Leaderboard ID.</param>
        /// <param name="score">Score to report.</param>
        /// <param name="callback">The callback that fires when done.</param>
        public static void ReportScoreRaw(string leaderboardID, long score, ReportScoreCallbackMethod callback)
        {
            if (waitingForOperation)
            {
                Debug.LogError("Must wait for last Score operation to complete.");
                return;
            }

            waitingForOperation = true;
            reportScoreCallback = callback;
            plugin.ReportScore(leaderboardID, score, async_reportScoreCallback, ReignServices.Singleton);
        }
コード例 #5
0
        public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
        {
            // find leaderboard
            var leaderboardDesc = findLeaderboard(leaderboardID);

            if (leaderboardDesc == null)
            {
                if (callback != null)
                {
                    callback(false, "Failed to find leaderboardID: " + leaderboardID);
                }
                return;
            }

            // get server id
                        #if UNITY_EDITOR
            var serverLeaderboardID = leaderboardDesc.Editor_ReignScores_ID;
                        #elif UNITY_STANDALONE_WIN
            var serverLeaderboardID = leaderboardDesc.Win32_ReignScores_ID;
                        #elif UNITY_STANDALONE_OSX
            var serverLeaderboardID = leaderboardDesc.OSX_ReignScores_ID;
                        #elif UNITY_STANDALONE_LINUX
            var serverLeaderboardID = leaderboardDesc.Linux_ReignScores_ID;
                        #elif UNITY_WEBPLAYER
            var serverLeaderboardID = leaderboardDesc.Web_ReignScores_ID;
                        #elif UNITY_WEBGL
            var serverLeaderboardID = leaderboardDesc.WebGL_ReignScores_ID;
                        #elif UNITY_WP8
            var serverLeaderboardID = leaderboardDesc.WP8_ReignScores_ID;
                        #elif UNITY_METRO
            var serverLeaderboardID = leaderboardDesc.WinRT_ReignScores_ID;
                        #elif UNITY_BLACKBERRY
            var serverLeaderboardID = leaderboardDesc.BB10_ReignScores_ID;
                        #elif UNITY_TIZEN
            var serverLeaderboardID = leaderboardDesc.Tizen_ReignScores_ID;
                        #elif UNITY_IPHONE
            var serverLeaderboardID = leaderboardDesc.iOS_ReignScores_ID;
                        #elif UNITY_ANDROID
            var serverLeaderboardID = leaderboardDesc.Android_ReignScores_ID;
                        #endif

            // submit score
            ReportScore_callback = callback;
            helper.InvokeServiceMethod(ReignScores_ServiceTypes.Users, "ReportScore", reportScoreCallback, services, "user_id=" + UserID, "leaderboard_id=" + serverLeaderboardID, "score=" + score);
        }
コード例 #6
0
        /// <summary>
        /// Use to report a Time score that formats according to the 'ScoreFormat' option
        /// </summary>
        /// <param name="leaderboardID">Leaderboard ID.</param>
        /// <param name="score">Score to report.</param>
        /// <param name="callback">The callback that fires when done.</param>
        public static void ReportScore(string leaderboardID, TimeSpan score, ReportScoreCallbackMethod callback)
        {
            if (waitingForOperation)
            {
                Debug.LogError("Must wait for last Score operation to complete.");
                return;
            }

            var leaderboard = findLeaderboard(leaderboardID);

            if (leaderboard == null)
            {
                Debug.LogError("Failed to find leaderboard with ID: " + leaderboardID);
                return;
            }

            if (leaderboard.ScoreFormat != LeaderbaordScoreFormats.Time)
            {
                Debug.LogError("Leaderboard Formating type must be Time not: " + leaderboard.ScoreFormat);
                return;
            }

            long value = 0;

            switch (leaderboard.ScoreTimeFormat)
            {
            case LeaderboardScoreTimeFormats.Minutes: value = (long)score.TotalMinutes; break;

            case LeaderboardScoreTimeFormats.Seconds: value = (long)score.TotalSeconds; break;

            case LeaderboardScoreTimeFormats.Centiseconds: value = (long)(score.TotalSeconds / 100d); break;

            case LeaderboardScoreTimeFormats.Milliseconds: value = (long)score.TotalMilliseconds; break;

            default: Debug.LogError("Unsuported LeaderboardScoreTimeFormat: " + leaderboard.ScoreTimeFormat); return;
            }

            waitingForOperation = true;
            reportScoreCallback = callback;
            plugin.ReportScore(leaderboardID, value, async_reportScoreCallback, ReignServices.Singleton);
        }
コード例 #7
0
		public void ReportScore (string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
		{
			reportScoreCallback = callback;
			native.CallStatic("ReportScore", findLeaderboardID(leaderboardID), score);
		}
コード例 #8
0
 public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
 {
     reportScoreCallback = callback;
     native.CallStatic("ReportScore", findLeaderboardID(leaderboardID), score);
 }
コード例 #9
0
		public void ReportScore (string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
		{
			#if !IOS_DISABLE_APPLE_SCORES
			reportScoreCallback = callback;
			GameCenterReportScore(score, findNativeLoaderboardID(leaderboardID));
			#endif
		}
コード例 #10
0
		public void ReportScore (string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
		{
			reportScoreCallback = callback;
			GameCenterReportScore(score, findNativeLoaderboardID(leaderboardID));
		}
コード例 #11
0
		/// <summary>
		/// Dumy method.
		/// </summary>
		/// <param name="leaderboardID"></param>
		/// <param name="score"></param>
		/// <param name="callback"></param>
		/// <param name="services"></param>
		public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
		{
			if (callback != null) callback(false, "Dumy Score Obj");
		}
コード例 #12
0
		/// <summary>
		/// Use to report a Time score that formats according to the 'ScoreFormat' option
		/// </summary>
		/// <param name="leaderboardID">Leaderboard ID.</param>
		/// <param name="score">Score to report.</param>
		/// <param name="callback">The callback that fires when done.</param>
		public static void ReportScore(string leaderboardID, TimeSpan score, ReportScoreCallbackMethod callback)
		{
			if (waitingForOperation)
			{
				Debug.LogError("Must wait for last Score operation to complete.");
				return;
			}

			var leaderboard = findLeaderboard(leaderboardID);
			if (leaderboard == null)
			{
				Debug.LogError("Failed to find leaderboard with ID: " + leaderboardID);
				return;
			}

			if (leaderboard.ScoreFormat != LeaderbaordScoreFormats.Time)
			{
				Debug.LogError("Leaderboard Formating type must be Time not: " + leaderboard.ScoreFormat);
				return;
			}

			long value = 0;
			switch (leaderboard.ScoreTimeFormat)
			{
				case LeaderboardScoreTimeFormats.Minutes: value = (long)score.TotalMinutes; break;
				case LeaderboardScoreTimeFormats.Seconds: value = (long)score.TotalSeconds; break;
				case LeaderboardScoreTimeFormats.Centiseconds: value = (long)(score.TotalSeconds / 100d); break;
				case LeaderboardScoreTimeFormats.Milliseconds: value = (long)score.TotalMilliseconds; break;
				default: Debug.LogError("Unsuported LeaderboardScoreTimeFormat: " + leaderboard.ScoreTimeFormat); return;
			}

			waitingForOperation = true;
			reportScoreCallback = callback;
			plugin.ReportScore(leaderboardID, value, async_reportScoreCallback, ReignServices.Singleton);
		}
コード例 #13
0
		/// <summary>
		/// Use to report a floating-point or currency score that formats according to the 'ScoreFormat' option
		/// </summary>
		/// <param name="leaderboardID">Leaderboard ID.</param>
		/// <param name="score">Score to report.</param>
		/// <param name="callback">The callback that fires when done.</param>
		public static void ReportScore(string leaderboardID, float score, ReportScoreCallbackMethod callback)
		{
			if (waitingForOperation)
			{
				Debug.LogError("Must wait for last Score operation to complete.");
				return;
			}

			var leaderboard = findLeaderboard(leaderboardID);
			if (leaderboard == null)
			{
				Debug.LogError("Failed to find leaderboard with ID: " + leaderboardID);
				return;
			}

			if (leaderboard.ScoreFormat != LeaderbaordScoreFormats.Numerical)
			{
				Debug.LogError("Leaderboard Formating type must be Numerical not: " + leaderboard.ScoreFormat);
				return;
			}

			long value = (long)(Math.Round(score, leaderboard.ScoreFormat_DecimalPlaces) * Math.Pow(10, leaderboard.ScoreFormat_DecimalPlaces));

			waitingForOperation = true;
			reportScoreCallback = callback;
			plugin.ReportScore(leaderboardID, value, async_reportScoreCallback, ReignServices.Singleton);
		}
コード例 #14
0
		/// <summary>
		/// Use to report a integer based numerical score with no API checks or formating
		/// </summary>
		/// <param name="leaderboardID">Leaderboard ID.</param>
		/// <param name="score">Score to report.</param>
		/// <param name="callback">The callback that fires when done.</param>
		public static void ReportScoreRaw(string leaderboardID, long score, ReportScoreCallbackMethod callback)
		{
			if (waitingForOperation)
			{
				Debug.LogError("Must wait for last Score operation to complete.");
				return;
			}

			waitingForOperation = true;
			reportScoreCallback = callback;
			plugin.ReportScore(leaderboardID, score, async_reportScoreCallback, ReignServices.Singleton);
		}
コード例 #15
0
		public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
		{
			// find leaderboard
			var leaderboardDesc = findLeaderboard(leaderboardID);
			if (leaderboardDesc == null)
			{
				if (callback != null) callback(false, "Failed to find leaderboardID: " + leaderboardID);
				return;
			}

			// get server id
			#if UNITY_EDITOR
			var serverLeaderboardID = leaderboardDesc.Editor_ReignScores_ID;
			#elif UNITY_STANDALONE_WIN
			var serverLeaderboardID = leaderboardDesc.Win32_ReignScores_ID;
			#elif UNITY_STANDALONE_OSX
			var serverLeaderboardID = leaderboardDesc.OSX_ReignScores_ID;
			#elif UNITY_STANDALONE_LINUX
			var serverLeaderboardID = leaderboardDesc.Linux_ReignScores_ID;
			#elif UNITY_WEBPLAYER
			var serverLeaderboardID = leaderboardDesc.Web_ReignScores_ID;
			#elif UNITY_WEBGL
			var serverLeaderboardID = leaderboardDesc.WebGL_ReignScores_ID;
			#elif UNITY_WP8
			var serverLeaderboardID = leaderboardDesc.WP8_ReignScores_ID;
			#elif UNITY_METRO
			var serverLeaderboardID = leaderboardDesc.WinRT_ReignScores_ID;
			#elif UNITY_BLACKBERRY
			var serverLeaderboardID = leaderboardDesc.BB10_ReignScores_ID;
			#elif UNITY_TIZEN
			var serverLeaderboardID = leaderboardDesc.Tizen_ReignScores_ID;
			#elif UNITY_IPHONE
			var serverLeaderboardID = leaderboardDesc.iOS_ReignScores_ID;
			#elif UNITY_ANDROID
			var serverLeaderboardID = leaderboardDesc.Android_ReignScores_ID;
			#endif

			// submit score
			ReportScore_callback = callback;
			helper.InvokeServiceMethod(ReignScores_ServiceTypes.Users, "ReportScore", reportScoreCallback, services, "user_id="+UserID, "leaderboard_id="+serverLeaderboardID, "score="+score);
		}
コード例 #16
0
 public void ReportScore(string leaderboardID, long score, ReportScoreCallbackMethod callback, MonoBehaviour services)
 {
     reportScoreCallback = callback;
     GameCenterReportScore(score, findNativeLoaderboardID(leaderboardID));
 }