From 6e0b1d15504a3685c3ebb755cb455c1da59bf802 Mon Sep 17 00:00:00 2001 From: Vitaly Mikhailov Date: Fri, 11 Oct 2019 21:39:42 +0300 Subject: [PATCH] Added command to change Screen.Fade color --- P3D/Overworld/OverworldScreen.vb | 19 ++++++++++++++++--- P3D/Screens/MainMenu/NewNewGameScreen.vb | 2 +- .../V2/ScriptCommands/DoScreen.vb | 8 ++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/P3D/Overworld/OverworldScreen.vb b/P3D/Overworld/OverworldScreen.vb index 0c2b75709..f1fcf7698 100644 --- a/P3D/Overworld/OverworldScreen.vb +++ b/P3D/Overworld/OverworldScreen.vb @@ -9,7 +9,8 @@ Public Class OverworldScreen #Region "Fields" - Private Shared _fadeValue As Integer = 0 'Fade progress value for the black screen fade. + Private Shared _fadeColor As Color = Color.Black 'Fade screen color. + Private Shared _fadeValue As Integer = 0 'Fade progress value for the screen fade. Private Shared _drawRodID As Integer = -1 'The rod ID to display on the screen during the fishing animation. Private _actionScript As ActionScript 'Private ActionScript instance. @@ -57,7 +58,19 @@ Public Class OverworldScreen End Property ''' - ''' Fade progress value for the black screen fade. + ''' Fade color for the screen. + ''' + Public Shared Property FadeColor() As Color + Get + Return _fadeColor + End Get + Set(value As Color) + _fadeColor = value + End Set + End Property + + ''' + ''' Fade progress value for the screen fade. ''' Public Shared Property FadeValue() As Integer Get @@ -378,7 +391,7 @@ Public Class OverworldScreen 'If the black fade is visible, render it: If FadeValue > 0 Then - Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, FadeValue)) + Canvas.DrawRectangle(Core.windowSize, New Color(FadeColor.R, FadeColor.G, FadeColor.B, FadeValue)) End If End Sub diff --git a/P3D/Screens/MainMenu/NewNewGameScreen.vb b/P3D/Screens/MainMenu/NewNewGameScreen.vb index f4b0b6a75..aeea60904 100644 --- a/P3D/Screens/MainMenu/NewNewGameScreen.vb +++ b/P3D/Screens/MainMenu/NewNewGameScreen.vb @@ -106,7 +106,7 @@ End If If FadeValue > 0 Then - Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, FadeValue)) + Canvas.DrawRectangle(windowSize, New Color(FadeColor.R, FadeColor.G, FadeColor.B, FadeValue)) End If End Sub diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb index d5dc6e7b7..a5b6038ca 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb @@ -91,6 +91,14 @@ Else IsReady = True End If + Case "fadeoutcolor" + If Not String.IsNullOrEmpty(argument) Then + Dim colorR As Integer = int(argument.GetSplit(0)) + Dim colorG As Integer = int(argument.GetSplit(1)) + Dim colorB As Integer = int(argument.GetSplit(2)) + OverworldScreen.FadeColor = New Color(colorR, colorG, colorB) + End If + IsReady = True Case "setfade" OverworldScreen.FadeValue = int(argument).Clamp(0, 255) IsReady = True