Esempio n. 1
0
        /// <summary>
        /// Start playing the current track (if not already playing).
        /// </summary>
        /// <param name="restart">Whether to restart the track from the beginning.</param>
        /// <param name="requestedByUser">
        /// Whether the request to play was issued by the user rather than internally.
        /// Specifying <c>true</c> will ensure that other methods like <see cref="EnsurePlayingSomething"/>
        /// will resume music playback going forward.
        /// </param>
        /// <returns>Whether the operation was successful.</returns>
        public bool Play(bool restart = false, bool requestedByUser = false)
        {
            if (requestedByUser)
            {
                UserPauseRequested = false;
            }

            if (restart)
            {
                CurrentTrack.Restart();
            }
            else if (!IsPlaying)
            {
                CurrentTrack.Start();
            }

            return(true);
        }
Esempio n. 2
0
 private void restartTrack()
 {
     // if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase).
     // we probably want to move this to a central method for switching to a new working beatmap in the future.
     Schedule(() => CurrentTrack.Restart());
 }