tabulation

This commit is contained in:
aragas 2020-11-06 15:07:19 +03:00 committed by Vitaly Mikhailov
parent e8d980b34a
commit b10415ccf0
2 changed files with 224 additions and 224 deletions

View File

@ -54,12 +54,12 @@
End Function
Public Overrides Sub ClickFunction()
If Me.TriggerID = 1 Or Me.TriggerID = 2 Then
ActionScript.TempInputDirection = -1
Me.clickedToActivate = True
TriggerScript(False)
End If
End Sub
If Me.TriggerID = 1 Or Me.TriggerID = 2 Then
ActionScript.TempInputDirection = -1
Me.clickedToActivate = True
TriggerScript(False)
End If
End Sub
Public Overrides Sub Update()
If Me.ActivateScript = True And Screen.Camera.Position.X = Me.Position.X And Screen.Camera.Position.Z = Me.Position.Z And CInt(Screen.Camera.Position.Y) = CInt(Me.Position.Y) Then
@ -81,13 +81,13 @@
Me.clickedToActivate = False
SoundManager.PlaySound("select")
End If
If Me.TriggerID = 2 Then
oS.ActionScript.StartScript(Me.AdditionalValue, GetActivationID())
Else
oS.ActionScript.StartScript(Me._scriptID, GetActivationID())
ActionScript.TempSpin = True
End If
End If
If Me.TriggerID = 2 Then
oS.ActionScript.StartScript(Me.AdditionalValue, GetActivationID())
Else
oS.ActionScript.StartScript(Me._scriptID, GetActivationID())
ActionScript.TempSpin = True
End If
End If
End If
End If
TriggeredScriptBlock = False

View File

@ -51,7 +51,7 @@ Public Class LoopStream
End If
totalBytesRead += bytesRead
End While
Return totalBytesRead
End Function
End Class
@ -94,248 +94,248 @@ Public Class MusicManager
Private Shared _isFadingIn As Boolean = False
' NAudio properties
Public Shared outputDevice As WaveOutEvent
Public Shared audioFile As VorbisWaveReader
Public Shared _stream As WaveChannel32
Public Shared audioFile As VorbisWaveReader
Public Shared _stream As WaveChannel32
Public Shared Property MasterVolume As Single = 1.0F
Public Shared ReadOnly Property CurrentSong As SongContainer
Get
Return _currentSong
End Get
End Property
Public Shared Property MasterVolume As Single = 1.0F
Public Shared ReadOnly Property CurrentSong As SongContainer
Get
Return _currentSong
End Get
End Property
Public Shared Property Muted As Boolean
Get
Return _muted
End Get
Set(value As Boolean)
If _muted <> value Then
_muted = value
Public Shared Property Muted As Boolean
Get
Return _muted
End Get
Set(value As Boolean)
If _muted <> value Then
_muted = value
If _muted = True Then
If outputDevice IsNot Nothing Then
Volume = 0.0F
Core.GameMessage.ShowMessage(Localization.GetString("game_message_audio_off"), 12, FontManager.MainFont, Color.White)
End If
If _muted = True Then
If outputDevice IsNot Nothing Then
Volume = 0.0F
Core.GameMessage.ShowMessage(Localization.GetString("game_message_audio_off"), 12, FontManager.MainFont, Color.White)
End If
Else
If outputDevice IsNot Nothing Then
If _isPausedForSound = True Then
_muted = True
Volume = 0.0F
Else
Volume = 1.0F
Core.GameMessage.ShowMessage(Localization.GetString("game_message_audio_on"), 12, FontManager.MainFont, Color.White)
End If
End If
End If
End If
End Set
End Property
Public Shared Property Paused As Boolean
Get
Return _paused
End Get
Set(value As Boolean)
If _paused <> value Then
_paused = value
Else
If outputDevice IsNot Nothing Then
If _isPausedForSound = True Then
_muted = True
Volume = 0.0F
Else
Volume = 1.0F
Core.GameMessage.ShowMessage(Localization.GetString("game_message_audio_on"), 12, FontManager.MainFont, Color.White)
End If
End If
End If
End If
End Set
End Property
Public Shared Property Paused As Boolean
Get
Return _paused
End Get
Set(value As Boolean)
If _paused <> value Then
_paused = value
If _paused = True Then
If outputDevice IsNot Nothing Then
outputDevice.Pause()
_introMuteTime = Date.Now
End If
Else
ResumePlayback()
End If
End If
End Set
End Property
Public Shared Sub Setup()
MasterVolume = 1.0F
If Muted = True Then
Volume = 0.0F
Else
Volume = 1.0F
End If
_nextSong = ""
_fadeSpeed = DEFAULT_FADE_SPEED
_isFadingOut = False
_isFadingIn = False
_isLooping = True
End Sub
If _paused = True Then
If outputDevice IsNot Nothing Then
outputDevice.Pause()
_introMuteTime = Date.Now
End If
Else
ResumePlayback()
End If
End If
End Set
End Property
Public Shared Sub Setup()
MasterVolume = 1.0F
If Muted = True Then
Volume = 0.0F
Else
Volume = 1.0F
End If
_nextSong = ""
_fadeSpeed = DEFAULT_FADE_SPEED
_isFadingOut = False
_isFadingIn = False
_isLooping = True
End Sub
Public Shared Sub Clear()
_songs.Clear()
LoadMusic(False)
End Sub
Public Shared Sub Clear()
_songs.Clear()
LoadMusic(False)
End Sub
Public Shared Sub ClearCurrentlyPlaying()
' cleans all remains of currently playing songs
_currentSongExists = False
_currentSong = Nothing
_currentSongName = NO_MUSIC
_isIntroStarted = False
End Sub
Public Shared Sub ClearCurrentlyPlaying()
' cleans all remains of currently playing songs
_currentSongExists = False
_currentSong = Nothing
_currentSongName = NO_MUSIC
_isIntroStarted = False
End Sub
Public Shared Sub PlayNoMusic()
' fades out current track and sets to NO_MUSIC
Play(NO_MUSIC)
End Sub
Public Shared Sub PlayNoMusic()
' fades out current track and sets to NO_MUSIC
Play(NO_MUSIC)
End Sub
Public Shared Sub Update()
If _isPausedForSound Then
If Date.Now >= _pausedUntil Then
If MusicManager.Paused = True Then
_isPausedForSound = False
Paused = False
End If
End If
Else
Public Shared Sub Update()
If _isPausedForSound Then
If Date.Now >= _pausedUntil Then
If MusicManager.Paused = True Then
_isPausedForSound = False
Paused = False
End If
End If
Else
' fading
If _isFadingOut Then
Volume -= _fadeSpeed
' fading
If _isFadingOut Then
Volume -= _fadeSpeed
If Volume <= 0F Then
If Volume <= 0F Then
Volume = 0F
_isFadingOut = False
_isFadingIn = True
Volume = 0F
_isFadingOut = False
_isFadingIn = True
Dim song = GetSong(_nextSong)
Dim song = GetSong(_nextSong)
If Not song Is Nothing Then
If Not song Is Nothing Then
Play(song)
_nextSong = ""
Play(song)
_nextSong = ""
If _fadeIntoIntro Then
_fadeIntoIntro = False
_introEndTime = Date.Now + song.Duration
_isIntroStarted = True
Else
_isLooping = True
End If
If _fadeIntoIntro Then
_fadeIntoIntro = False
_introEndTime = Date.Now + song.Duration
_isIntroStarted = True
Else
_isLooping = True
End If
Else
Else
' no song found, do not fade into anything
_fadeIntoIntro = False
ClearCurrentlyPlaying()
_isFadingIn = False
If Muted = True Then
Volume = 0.0F
Else
Volume = 1.0F
End If
If _nextSong = NO_MUSIC Then
_nextSong = ""
MusicManager.Stop()
End If
' no song found, do not fade into anything
_fadeIntoIntro = False
ClearCurrentlyPlaying()
_isFadingIn = False
If Muted = True Then
Volume = 0.0F
Else
Volume = 1.0F
End If
If _nextSong = NO_MUSIC Then
_nextSong = ""
MusicManager.Stop()
End If
End If
End If
End If
End If
ElseIf _isFadingIn Then
If Muted = True Then
Volume = 0.0F
_isFadingIn = False
Else
Volume += _fadeSpeed
If Volume >= 1.0F Then
Volume = 1.0F
_isFadingIn = False
End If
End If
End If
ElseIf _isFadingIn Then
If Muted = True Then
Volume = 0.0F
_isFadingIn = False
Else
Volume += _fadeSpeed
If Volume >= 1.0F Then
Volume = 1.0F
_isFadingIn = False
End If
End If
End If
' intro
If _isIntroStarted Then
If Paused = False Then
If Date.Now >= _introEndTime Then
Dim song = GetSong(_introContinueSong)
_isLooping = True
_isIntroStarted = False
Play(song)
End If
End If
End If
End If
' intro
If _isIntroStarted Then
If Paused = False Then
If Date.Now >= _introEndTime Then
Dim song = GetSong(_introContinueSong)
_isLooping = True
_isIntroStarted = False
Play(song)
End If
End If
End If
End If
If Core.GameInstance.IsActive AndAlso _lastVolume <> (Volume * MasterVolume) Then
UpdateVolume()
End If
End Sub
If Core.GameInstance.IsActive AndAlso _lastVolume <> (Volume * MasterVolume) Then
UpdateVolume()
End If
End Sub
Public Shared Sub UpdateVolume()
_lastVolume = Volume * MasterVolume
If Not _stream Is Nothing Then
_stream.Volume = Volume * MasterVolume
End If
End Sub
Public Shared Sub UpdateVolume()
_lastVolume = Volume * MasterVolume
If Not _stream Is Nothing Then
_stream.Volume = Volume * MasterVolume
End If
End Sub
Public Shared Sub PauseForSound(ByVal sound As SoundEffect)
_isPausedForSound = True
_pausedUntil = Date.Now + sound.Duration
MusicManager.Pause()
End Sub
Public Shared Sub PauseForSound(ByVal sound As SoundEffect)
_isPausedForSound = True
_pausedUntil = Date.Now + sound.Duration
MusicManager.Pause()
End Sub
Public Shared Sub Pause()
MusicManager.Paused = True
End Sub
Public Shared Sub Pause()
MusicManager.Paused = True
End Sub
Public Shared Sub [Stop]()
If Not outputDevice Is Nothing Then
outputDevice.Stop()
outputDevice.Dispose()
End If
_isIntroStarted = False
End Sub
Public Shared Sub [Stop]()
If Not outputDevice Is Nothing Then
outputDevice.Stop()
outputDevice.Dispose()
End If
_isIntroStarted = False
End Sub
Public Shared Sub ResumePlayback()
If Not _currentSong Is Nothing Then
Public Shared Sub ResumePlayback()
If Not _currentSong Is Nothing Then
If outputDevice IsNot Nothing Then
' if an intro was playing while the music player was paused, calculate its end time
If outputDevice.PlaybackState = PlaybackState.Paused AndAlso _isIntroStarted Then
Dim pauseTime As TimeSpan = Date.Now.Subtract(_introMuteTime)
_introEndTime = _introEndTime + pauseTime
If outputDevice IsNot Nothing Then
' if an intro was playing while the music player was paused, calculate its end time
If outputDevice.PlaybackState = PlaybackState.Paused AndAlso _isIntroStarted Then
Dim pauseTime As TimeSpan = Date.Now.Subtract(_introMuteTime)
_introEndTime = _introEndTime + pauseTime
End If
outputDevice.Play()
End If
End If
End If
outputDevice.Play()
End If
End If
End Sub
End Sub
Private Shared Sub Play(song As SongContainer)
If Not song Is Nothing Then
Logger.Debug($"Play song [{song.Name}]")
If Not outputDevice Is Nothing Then
outputDevice.Dispose()
End If
outputDevice = New WaveOutEvent()
audioFile = New VorbisWaveReader(song.Song)
_stream = New NAudio.Wave.WaveChannel32(New LoopStream(audioFile, _isLooping))
outputDevice.Init(_stream)
If Paused = False Then
outputDevice.Play()
End If
_stream.Volume = Volume * MasterVolume
_currentSongExists = True
_currentSongName = song.Name
_currentSong = song
Else
_currentSongExists = False
_currentSongName = NO_MUSIC
_currentSong = Nothing
End If
Private Shared Sub Play(song As SongContainer)
If Not song Is Nothing Then
Logger.Debug($"Play song [{song.Name}]")
If Not outputDevice Is Nothing Then
outputDevice.Dispose()
End If
outputDevice = New WaveOutEvent()
audioFile = New VorbisWaveReader(song.Song)
_stream = New NAudio.Wave.WaveChannel32(New LoopStream(audioFile, _isLooping))
outputDevice.Init(_stream)
If Paused = False Then
outputDevice.Play()
End If
_stream.Volume = Volume * MasterVolume
_currentSongExists = True
_currentSongName = song.Name
_currentSong = song
Else
_currentSongExists = False
_currentSongName = NO_MUSIC
_currentSong = Nothing
End If
End Sub
End Sub
Private Shared Sub FadeInto(song As SongContainer, fadeSpeed As Single)
Private Shared Sub FadeInto(song As SongContainer, fadeSpeed As Single)
_isFadingOut = True
If Not song Is Nothing Then
_nextSong = song.Name
@ -415,10 +415,10 @@ Public Class MusicManager
playedSong = nextSong
End If
End If
End If
Return playedSong
End Function