Example #1
0
        public static void GetSongInfo()
        {
            var mainGameSceneSetupData = Resources.FindObjectsOfTypeAll <MainGameSceneSetupData>().First();
            var playerLevelStatsData   = PersistentSingleton <GameDataModel> .instance.gameDynamicData.GetCurrentPlayerDynamicData().GetPlayerLevelStatsData(mainGameSceneSetupData.difficultyLevel.level.levelID, mainGameSceneSetupData.difficultyLevel.difficulty, mainGameSceneSetupData.gameplayMode);

            //Get notes count
            noteCount = mainGameSceneSetupData.difficultyLevel.beatmapData.notesCount;

            //Get Player Score
            localHighScore = playerLevelStatsData.validScore ? playerLevelStatsData.highScore : 0;

            //If we couldn't grab a local score, we'll try to grab one from the leaderboards
            if (localHighScore == 0)
            {
                string leaderboardID = LeaderboardsModel.GetLeaderboardID(mainGameSceneSetupData.difficultyLevel, mainGameSceneSetupData.gameplayMode);
                if (_asyncRequest != null)
                {
                    _asyncRequest.Cancel();
                }
                _asyncRequest = new HMAsyncRequest();

                //Note: I'm leaving "around" as 10 intentionally so that this "looks" like a normal score request
                //Don't judge. Old habits die hard.
                PersistentSingleton <PlatformLeaderboardsModel> .instance.GetScoresAroundPlayer(leaderboardID, 10, _asyncRequest, LeaderboardsResultsReturned);
            }
            CalculatePercentage();
        }