Exemplo n.º 1
0
        public void RemoveSong(CustomLevel customLevel)
        {
            if (customLevel == null)
            {
                return;
            }

            CustomLevelCollectionSO.RemoveLevel(customLevel);

            foreach (var difficultyBeatmap in customLevel.difficultyBeatmaps)
            {
                var customDifficulty = difficultyBeatmap as CustomLevel.CustomDifficultyBeatmap;
                if (customDifficulty == null)
                {
                    continue;
                }
                _beatmapDataPool.Return(customDifficulty.BeatmapDataSO);
            }

            _customLevelPool.Return(customLevel);
        }
Exemplo n.º 2
0
        public void RefreshSongs(bool fullRefresh = true)
        {
            if (SceneManager.GetActiveScene().name != MenuSceneName)
            {
                return;
            }
            if (AreSongsLoading)
            {
                return;
            }

            Log(fullRefresh ? "Starting full song refresh" : "Starting song refresh");
            AreSongsLoaded    = false;
            AreSongsLoading   = true;
            LoadingProgress   = 0;
            _loadingCancelled = false;

            if (LoadingStartedEvent != null)
            {
                try
                {
                    LoadingStartedEvent(this);
                }
                catch (Exception e)
                {
                    Log("Some plugin is throwing exception from the LoadingStartedEvent!", LogSeverity.Error);
                    Log(e.ToString(), LogSeverity.Error);
                }
            }

            foreach (var customLevel in CustomLevels)
            {
                CustomLevelCollectionSO.RemoveLevel(customLevel);
            }

            RetrieveAllSongs(fullRefresh);
        }