/// <summary> /// Use to init a score API. /// </summary> /// <param name="desc">Score Desc.</param> public static void Init(ScoreDesc desc, CreatedScoreAPICallbackMethod callback) { ScoreManager.createdCallback = callback; ReignServices.CheckStatus(); plugin = ScorePluginAPI.New(desc, async_CreatedCallback); ScoreManager.desc = desc; ReignServices.AddService(update, null, null); }
// ====================================================== // NOTE about users confused over Reign-Scores // Reign-Scores is an API target option, just as GooglePlay version GamceCircle is. // Reign-Scores is NOT required to use native services like GooglePlay, GameCenter ect. // Its a self-hosted option you can put on any ASP.NET server you own for platforms like WP8, BB10 ect. // ====================================================== void Start() { // bind button events BackButton.Select(); LogoutButton.onClick.AddListener(LogoutButton_Clicked); BackButton.onClick.AddListener(BackButton_Clicked); ReportScoreButton.onClick.AddListener(ReportScoreButton_Clicked); ReportAchievementButton.onClick.AddListener(ReportAchievementButton_Clicked); ShowLeaderboardsButton.onClick.AddListener(ShowLeaderboardsButton_Clicked); ShowAchievementsButton.onClick.AddListener(ShowAchievementsButton_Clicked); // make sure we don't init the same Score data twice if (created) return; created = true; // classic GUI stuff if (!UseUnityUI) { uiStyle = new GUIStyle() { alignment = TextAnchor.MiddleCenter, fontSize = 32, normal = new GUIStyleState() {textColor = Color.white}, }; } // Leaderboards --------------------------- var leaderboard = new LeaderboardDesc(); var reignScores_LeaderboardID = new System.Guid("f55e3800-eacd-4728-ae4f-31b00aaa63bf"); leaderboard.SortOrder = LeaderboardSortOrders.Ascending; leaderboard.ScoreFormat = LeaderbaordScoreFormats.Numerical; leaderboard.ScoreFormat_DecimalPlaces = 0; #if UNITY_IOS leaderboard.ScoreTimeFormat = LeaderboardScoreTimeFormats.Centiseconds; #else leaderboard.ScoreTimeFormat = LeaderboardScoreTimeFormats.Milliseconds; #endif // Global leaderboard.ID = "Level1";// Any unique ID value you want leaderboard.Desc = "Level1 Desc...";// Any desc you want // Editor leaderboard.Editor_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // WinRT leaderboard.WinRT_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // WP8 leaderboard.WP8_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // BB10 leaderboard.BB10_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // iOS leaderboard.iOS_ReignScores_ID = reignScores_LeaderboardID;// Any unique value leaderboard.iOS_GameCenter_ID = "";// Set to your GameCenter leaderboard ID // Android leaderboard.Android_ReignScores_ID = reignScores_LeaderboardID;// Any unique value leaderboard.Android_GooglePlay_ID = "";// Set to your GooglePlay leaderboard ID (Not Name) leaderboard.Android_GameCircle_ID = "";// Set to your GameCircle leaderboard ID (Not Name) // Win32 leaderboard.Win32_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // OSX leaderboard.OSX_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // Linux leaderboard.Linux_ReignScores_ID = reignScores_LeaderboardID;// Any unique value // Achievements --------------------------- var achievement = new AchievementDesc(); var reignScores_AchievementID = new System.Guid("352ce53d-142f-4a10-a4fb-804ad38be879"); // Global achievement.ID = "Achievement1";// Any unique ID value you want achievement.Name = "Achievement1";// Any name you want achievement.Desc = "Achievement1 Desc...";// Any desc you want // When you report an achievement you pass a PercentComplete value. // Example: This allows you to change that ratio to something like (0-1000) before the achievement is unlocked. achievement.PercentCompletedAtValue = 100;// NOTE: For GooglePlay you must match this value in the developer dashboard under "How many steps are needed?" option. // Mark if you want Achievement to use PercentCompleted value or not. // Marking this true will make the "PercentComplete" value irrelevant. achievement.IsIncremental = true; // Editor achievement.Editor_ReignScores_ID = reignScores_AchievementID;// Any unique value // WinRT achievement.WinRT_ReignScores_ID = reignScores_AchievementID;// Any unique value // WP8 achievement.WP8_ReignScores_ID = reignScores_AchievementID;// Any unique value // BB10 achievement.BB10_ReignScores_ID = reignScores_AchievementID;// Any unique value // iOS achievement.iOS_ReignScores_ID = reignScores_AchievementID;// Any unique index value achievement.iOS_GameCenter_ID = "";// Set to your GameCenter achievement ID // Android achievement.Android_ReignScores_ID = reignScores_AchievementID;// Any unique value achievement.Android_GooglePlay_ID = "";// Set to your GooglePlay achievement ID (Not Name) achievement.Android_GameCircle_ID = "";// Set to your GameCircle achievement ID (Not Name) // Win32 achievement.Win32_ReignScores_ID = reignScores_AchievementID;// Any unique value // OSX achievement.OSX_ReignScores_ID = reignScores_AchievementID;// Any unique value // Linux achievement.Linux_ReignScores_ID = reignScores_AchievementID;// Any unique value // Desc --------------------------- const string reignScores_gameID = "B2A24047-0487-41C4-B151-0F175BB54D0E";// Get this ID from the Reign-Scores Console. var desc = new ScoreDesc(); if (UseUnityUI) desc.ReignScores_UI = ReignScores_ModernRenderer.GetComponent<Reign.Plugin.ReignScores_UnityUI>() as IScores_UI; else desc.ReignScores_UI = ReignScores_ClassicRenderer.GetComponent<MonoBehaviour>() as IScores_UI; desc.ReignScores_UI.ScoreFormatCallback += scoreFormatCallback; desc.ReignScores_ServicesURL = "http://localhost:5537/Services/";// Set to your server! desc.ReignScores_GameKey = "04E0676D-AAF8-4836-A584-DE0C1D618D84";// Set to your servers game_api_key! desc.ReignScores_UserKey = "CE8E55E1-F383-4F05-9388-5C89F27B7FF2";// Set to your servers user_api_key! desc.LeaderboardDescs = new LeaderboardDesc[1] {leaderboard}; desc.AchievementDescs = new AchievementDesc[1] {achievement}; // Editor desc.Editor_ScoreAPI = ScoreAPIs.ReignScores; desc.Editor_ReignScores_GameID = reignScores_gameID; // WinRT desc.WinRT_ScoreAPI = ScoreAPIs.ReignScores; desc.WinRT_ReignScores_GameID = reignScores_gameID; // WP8 desc.WP8_ScoreAPI = ScoreAPIs.ReignScores; desc.WP8_ReignScores_GameID = reignScores_gameID; // BB10 desc.BB10_ScoreAPI = ScoreAPIs.ReignScores; desc.BB10_ReignScores_GameID = reignScores_gameID; // iOS desc.iOS_ScoreAPI = ScoreAPIs.GameCenter; desc.iOS_ReignScores_GameID = reignScores_gameID; // Android #if GOOGLEPLAY desc.Android_ScoreAPI = ScoreAPIs.GooglePlay; desc.Android_GooglePlay_DisableUsernameRetrieval = false;// This lets you remove the android.permission.GET_ACCOUNTS requirement if enabled #elif AMAZON desc.Android_ScoreAPI = ScoreAPIs.GameCircle; #else desc.Android_ScoreAPI = ScoreAPIs.ReignScores; #endif desc.Android_ReignScores_GameID = reignScores_gameID; // Win32 desc.Win32_ScoreAPI = ScoreAPIs.ReignScores; desc.Win32_ReignScores_GameID = reignScores_gameID; // OSX desc.OSX_ScoreAPI = ScoreAPIs.ReignScores; desc.OSX_ReignScores_GameID = reignScores_gameID; // Linux desc.Linux_ScoreAPI = ScoreAPIs.ReignScores; desc.Linux_ReignScores_GameID = reignScores_gameID; // init ScoreManager.Init(desc, createdCallback); // <<< Reign-Scores manual methods >>> //ScoreManager.RequestScores(...); //ScoreManager.RequestAchievements(...); //ScoreManager.ManualLogin(...); //ScoreManager.ManualCreateUser(...); }