mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-24 22:35:47 +02:00
store duration with reflection
This commit is contained in:
parent
1869eacf38
commit
fb64e8dd07
@ -117,7 +117,7 @@ Public Class MusicManager
|
||||
|
||||
If _fadeIntoIntro Then
|
||||
_fadeIntoIntro = False
|
||||
_introEndTime = Date.Now.AddSeconds(0) + song.Duration
|
||||
_introEndTime = Date.Now.AddSeconds(0) + song.Song.Duration
|
||||
_isIntroStarted = True
|
||||
MediaPlayer.IsRepeating = False
|
||||
Else
|
||||
@ -194,7 +194,7 @@ Public Class MusicManager
|
||||
' if an intro was playing while the media player was paused, calc its end time
|
||||
If MediaPlayer.State = MediaState.Paused AndAlso _isIntroStarted Then
|
||||
|
||||
_introEndTime = Date.Now + (_currentSong.Duration - MediaPlayer.PlayPosition)
|
||||
_introEndTime = Date.Now + (_currentSong.Song.Duration - MediaPlayer.PlayPosition)
|
||||
|
||||
End If
|
||||
|
||||
@ -271,7 +271,7 @@ Public Class MusicManager
|
||||
FadeInto(introSong, fadeSpeed)
|
||||
Else
|
||||
_isIntroStarted = True
|
||||
_introEndTime = Date.Now.AddSeconds(0) + introSong.Duration
|
||||
_introEndTime = Date.Now.AddSeconds(0) + introSong.Song.Duration
|
||||
Play(introSong)
|
||||
End If
|
||||
|
||||
|
@ -4,12 +4,13 @@ Public Class SongContainer
|
||||
|
||||
Public Song As Song
|
||||
Public Name As String
|
||||
Public Duration As TimeSpan
|
||||
|
||||
Public Sub New(song As Song, name As String, duration As TimeSpan)
|
||||
Me.Song = song
|
||||
Me.Name = name
|
||||
Me.Duration = duration
|
||||
|
||||
Dim durationField = song.GetType().GetField("_duration", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)
|
||||
durationField.SetValue(song, duration)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
@ -509,7 +509,7 @@
|
||||
MediaPlayer.IsRepeating = False
|
||||
|
||||
If Not MusicManager.CurrentSong Is Nothing Then
|
||||
Me.duration = MusicManager.CurrentSong.Duration
|
||||
Me.duration = MusicManager.CurrentSong.Song.Duration
|
||||
Else
|
||||
Me.duration = New TimeSpan(0)
|
||||
End If
|
||||
|
Loading…
x
Reference in New Issue
Block a user