Ejemplo n.º 1
0
        private void PlayNow_Pressed()
        {
            SongInfo       info  = channelInfo.currentSong;
            BeatmapLevelSO level = SongLoader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(info.levelId)) as BeatmapLevelSO;

            if (level == null)
            {
                SongDownloader.Instance.RequestSongByLevelID(info.levelId,
                                                             (song) =>
                {
                    SongDownloader.Instance.DownloadSong(song, "RadioSongs",
                                                         () =>
                    {
                        SongLoader.SongsLoadedEvent += PlayNow_SongsLoaded;
                    },
                                                         (progress) =>
                    {
                        _inGameViewController.SetProgressBarState((progress < 100f), progress);
                    });
                });
            }
            else
            {
                SongLoader.Instance.LoadAudioClipForLevel((CustomLevel)level,
                                                          (levelLoaded) =>
                {
                    StartLevel(levelLoaded, _beatmapCharacteristics.First(x => x.serializedName == channelInfo.currentLevelOptions.characteristicName), channelInfo.currentLevelOptions.difficulty, channelInfo.currentLevelOptions.modifiers, currentTime);
                });
            }
        }
Ejemplo n.º 2
0
        private void PlayNow_Pressed()
        {
            SongInfo             info  = channelInfo.currentSong;
            IPreviewBeatmapLevel level = SongCore.Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(info.levelId));

            if (level == null)
            {
                SongDownloader.Instance.RequestSongByLevelID(info.hash,
                                                             (song) =>
                {
                    SongDownloader.Instance.DownloadSong(song,
                                                         (success) =>
                    {
                        if (success)
                        {
                            SongCore.Loader.SongsLoadedEvent += PlayNow_SongsLoaded;
                            SongCore.Loader.Instance.RefreshSongs(false);
                        }
                    },
                                                         (progress) =>
                    {
                        _inGameViewController.SetProgressBarState((progress < 100f), progress);
                    });
                });
            }
            else
            {
                LoadBeatmapLevelAsync(level,
                                      (success, beatmapLevel) =>
                {
                    StartLevel(beatmapLevel, _beatmapCharacteristics.First(x => x.serializedName == channelInfo.currentLevelOptions.characteristicName), channelInfo.currentLevelOptions.difficulty, channelInfo.currentLevelOptions.modifiers.ToGameplayModifiers(), currentTime);
                });
            }
        }
        private void PlayNow_Pressed()
        {
            SongInfo info  = channelInfo.currentSong;
            LevelSO  level = SongLoader.CustomLevelCollectionSO.levels.FirstOrDefault(x => x.levelID.StartsWith(info.levelId));

            if (level == null)
            {
                SongDownloader.Instance.RequestSongByLevelID(info.levelId,
                                                             (song) =>
                {
                    SongDownloader.Instance.DownloadSong(song, "RadioSongs",
                                                         () =>
                    {
                        SongLoader.Instance.RefreshSongs(false);
                        SongLoader.SongsLoadedEvent += PlayNow_SongsLoaded;
                    },
                                                         (progress) =>
                    {
                        _inGameViewController.SetProgressBarState((progress < 100f), progress);
                    });
                });
            }
            else
            {
                SongLoader.Instance.LoadAudioClipForLevel((CustomLevel)level,
                                                          (levelLoaded) =>
                {
                    StartLevel(levelLoaded, channelInfo.preferredDifficulty, currentTime);
                });
            }
        }