//Returns true if data requested, or false if data is not available //range_start of -1 means get entries around the player public static CloudDataYield RequestChallengeLeaderboardData(string level_name, bool submode, int difficulty_level, int range_start, int num_entries, bool friends) { string leaderboard_name = GetChallengeLeaderboardName(level_name, submode, difficulty_level); #if UNITY_XBOXONE #if !UNITY_EDITOR return(XboxOneLeaderboards.RequestLeaderboardData(leaderboard_name, range_start, num_entries, friends)); #else return(null); #endif #elif UNITY_PS4 return(PS4Leaderboards.RequestChallengeData(leaderboard_name, range_start, num_entries, friends)); #else if (CloudProvider == CloudProviders.Steam) { return(Steam.RequestLeaderboardData(leaderboard_name, range_start, num_entries, friends)); #if !UNITY_STANDALONE_LINUX } else if (CloudProvider == CloudProviders.Galaxy) { return(GogGalaxyManager.RequestLeaderboardData(leaderboard_name, range_start, num_entries, friends)); #endif } else { return(null); } #endif }
//Downloads the leaderboard data if it has arrived, else null. //Returns the array of requested entries, and the total leaderboard length (not the requested data length) //Also returns the index in the list of the item for the current user, or -1 if the user not in the list public static LeaderboardEntry[] GetLeaderboardData(out int leaderboard_length, out int user_index, out LeaderboardDataState result) { #if UNITY_XBOXONE return(XboxOneLeaderboards.GetLeaderboardData(out leaderboard_length, out user_index, out result)); #elif UNITY_PS4 return(PS4Leaderboards.GetData(out leaderboard_length, out user_index, out result)); #else if (CloudProvider == CloudProviders.Steam) { return(Steam.GetLeaderboardData(out leaderboard_length, out user_index, out result)); #if !UNITY_STANDALONE_LINUX } else if (CloudProvider == CloudProviders.Galaxy) { return(GogGalaxyManager.GetLeaderboardData(out leaderboard_length, out user_index, out result)); #endif } else { leaderboard_length = 0; user_index = -1; result = LeaderboardDataState.NoProvider; return(null); } #endif }
// // Interfaces to CloudData functions // public static CloudDataYield UpdateChallengeLeaderboardScore(string level_name, bool submode, int difficulty_level, int score, int kills, int weapon, float time) { #if UNITY_XBOXONE return(XboxOneLeaderboards.UpdateLeaderboardScore(level_name, submode, difficulty_level, score, kills, weapon, time)); #elif UNITY_PS4 string leaderboard_name = Platform.GetChallengeLeaderboardName(level_name, submode, difficulty_level); return(PS4Leaderboards.UpdateChallengeScore(leaderboard_name, score, kills, weapon, time)); #else string leaderboard_name = Platform.GetChallengeLeaderboardName(level_name, submode, difficulty_level); if (CloudProvider == CloudProviders.Steam) { return(Steam.UpdateLeaderboardScore(leaderboard_name, score, kills, weapon, time)); #if !UNITY_STANDALONE_LINUX } else if (CloudProvider == CloudProviders.Galaxy) { return(GogGalaxyManager.UpdateLeaderboardScore(leaderboard_name, score, kills, weapon, time)); #endif } else { return(null); } #endif }