mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-26 07:15:48 +02:00
@Music.ForcePlay(song) & @Music.Unforce
@Music.ForcePlay(song) Changes the currently playing music to a new one and prevents the music from being changed by warps or surfing/riding and such. @Music.Unforce Allows warps and surfing/riding etc. to change the music again.
This commit is contained in:
parent
3c5f5ee889
commit
0e8170a449
Binary file not shown.
@ -99,6 +99,8 @@ Public Class MusicManager
|
|||||||
Private Shared _lastVolume As Single = 1.0F
|
Private Shared _lastVolume As Single = 1.0F
|
||||||
Private Shared _muted As Boolean = False
|
Private Shared _muted As Boolean = False
|
||||||
Private Shared _paused As Boolean = False
|
Private Shared _paused As Boolean = False
|
||||||
|
|
||||||
|
Public Shared ForceMusic As String = ""
|
||||||
Public Shared ReadOnly Property IsLooping As Boolean
|
Public Shared ReadOnly Property IsLooping As Boolean
|
||||||
Get
|
Get
|
||||||
If Playlist IsNot Nothing AndAlso Playlist.Count <= 1 Then
|
If Playlist IsNot Nothing AndAlso Playlist.Count <= 1 Then
|
||||||
|
@ -28,8 +28,24 @@
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Case "forceplay"
|
Case "forceplay"
|
||||||
MusicManager.ClearCurrentlyPlaying()
|
Dim LoopSong As Boolean = True
|
||||||
MusicManager.Play(argument)
|
If argument.Split(",").Length > 1 Then
|
||||||
|
LoopSong = CBool(argument.GetSplit(1, ","))
|
||||||
|
End If
|
||||||
|
MusicManager.ForceMusic = argument.GetSplit(0, ",")
|
||||||
|
MusicManager.Play(argument.GetSplit(0, ","), LoopSong, LoopSong)
|
||||||
|
|
||||||
|
If LoopSong = True Then
|
||||||
|
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
|
Screen.Level.MusicLoop = argument
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
|
Screen.Level.MusicLoop = "silence"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Case "unforce"
|
||||||
|
MusicManager.ForceMusic = ""
|
||||||
Case "setmusicloop"
|
Case "setmusicloop"
|
||||||
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
Screen.Level.MusicLoop = argument
|
Screen.Level.MusicLoop = argument
|
||||||
|
@ -170,7 +170,10 @@ Namespace ScriptVersion2
|
|||||||
|
|
||||||
Private Shared Sub DoMusic()
|
Private Shared Sub DoMusic()
|
||||||
' Commands:
|
' Commands:
|
||||||
r(New ScriptCommand("music", "play", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the currently playing music to a new one."))
|
r(New ScriptCommand("music", "play", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str),
|
||||||
|
New ScriptArgument("loopSong", ScriptArgument.ArgumentTypes.Bool, True, "true")}.ToList(), "Changes the currently playing music to a new one."))
|
||||||
|
r(New ScriptCommand("music", "forceplay", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the currently playing music to a new one and prevents the music from being changed by warps or surfing/riding and such."))
|
||||||
|
r(New ScriptCommand("music", "unforce", "Allows warps and surfing/riding etc. to change the music again."))
|
||||||
r(New ScriptCommand("music", "setmusicloop", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the map musicloop to a new musicfile."))
|
r(New ScriptCommand("music", "setmusicloop", {New ScriptArgument("musicFile", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Sets the map musicloop to a new musicfile."))
|
||||||
r(New ScriptCommand("music", "stop", "Stops the music playback."))
|
r(New ScriptCommand("music", "stop", "Stops the music playback."))
|
||||||
r(New ScriptCommand("music", "mute", "Silences the music playback."))
|
r(New ScriptCommand("music", "mute", "Silences the music playback."))
|
||||||
|
@ -1060,23 +1060,29 @@ Public Class Level
|
|||||||
Me._routeSign.Setup(MapName)
|
Me._routeSign.Setup(MapName)
|
||||||
|
|
||||||
' Play the correct music track:
|
' Play the correct music track:
|
||||||
If IsRadioOn = True AndAlso GameJolt.PokegearScreen.StationCanPlay(Me.SelectedRadioStation) = True Then
|
If MusicManager.ForceMusic = "" Then
|
||||||
MusicManager.Play(SelectedRadioStation.Music, True)
|
If IsRadioOn = True AndAlso GameJolt.PokegearScreen.StationCanPlay(Me.SelectedRadioStation) = True Then
|
||||||
Else
|
MusicManager.Play(SelectedRadioStation.Music, True)
|
||||||
IsRadioOn = False
|
|
||||||
If Me.Surfing = True Then
|
|
||||||
MusicManager.Play("surf", True)
|
|
||||||
Else
|
Else
|
||||||
If Me.Riding = True Then
|
IsRadioOn = False
|
||||||
MusicManager.Play("ride", True)
|
If Me.Surfing = True Then
|
||||||
|
MusicManager.Play("surf", True)
|
||||||
Else
|
Else
|
||||||
If MusicManager.GetSong(MusicLoop) IsNot Nothing Then
|
If Me.Riding = True Then
|
||||||
MusicManager.Play(MusicLoop, True)
|
MusicManager.Play("ride", True)
|
||||||
Else
|
Else
|
||||||
MusicManager.Play("silence")
|
If MusicManager.GetSong(MusicLoop) IsNot Nothing Then
|
||||||
|
MusicManager.Play(MusicLoop, True)
|
||||||
|
Else
|
||||||
|
MusicManager.Play("silence")
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
If MusicManager._currentSongName <> MusicManager.ForceMusic Then
|
||||||
|
MusicManager.Play(MusicManager.ForceMusic, True)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Initialize the world with newly loaded environment variables:
|
' Initialize the world with newly loaded environment variables:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user