Exemplo n.º 1
0
        private static void ReadyUp(IBeatmapLevel song)
        {
            if (queuedSong != null || (queuedSong == null && song == null))
            {
                return;
            }
            if (queuedSong == null && song != null)
            {
                queuedSong = song;
                if (autoReady)
                {
                    PracticeSettings pSettings = null;
                    if (SteamAPI.GetSongOffset() > 0f)
                    {
                        pSettings = new PracticeSettings();
                        float offsetTime = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds() - timeRequestedToLaunch;
                        // add 5 seconds to it because that's about how long it takes to launch a song
                        pSettings.startSongTime = SteamAPI.GetSongOffset() + offsetTime + 5f;
                        timeRequestedToLaunch   = 0;
                    }

                    SongListUtils.StartSong(song, SteamAPI.GetSongDifficulty(), SteamAPI.GetGameplayModifiers(), pSettings);
                }
                else
                {
                    SteamAPI.SetReady();
                    PreviewPlayer.CrossfadeTo(song.previewAudioClip, song.previewStartTime, song.previewDuration);
                }
            }
        }