P3D-Legacy/P3D/World/ActionScript/V2/ScriptCommands/DoText.vb

75 lines
3.9 KiB
VB.net
Raw Normal View History

2016-09-07 18:50:38 +02:00
Namespace ScriptVersion2
Partial Class ScriptCommander
' --------------------------------------------------------------------------------------------------------------------------
' Contains the @text commands.
' --------------------------------------------------------------------------------------------------------------------------
2016-09-07 18:50:38 +02:00
Private Shared Sub DoText(ByVal subClass As String)
Dim command As String = ScriptComparer.GetSubClassArgumentPair(subClass).Command
Dim argument As String = ScriptComparer.GetSubClassArgumentPair(subClass).Argument
Select Case command.ToLower()
2021-10-09 23:05:56 +02:00
Case "notification"
2021-10-19 21:36:47 +02:00
'@text.notification(message,[int_delay=500],[int_backgroundID=0],[int_IconID=0],[str_sfx],[str_script],[bool_force=0])
2021-10-09 23:05:56 +02:00
Dim _NotificationPopup As New NotificationPopup
Dim args As String() = argument.Split(CChar(","))
Select Case args.Length
Case 1
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(argument)
2021-10-09 23:05:56 +02:00
Case 2
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(args(0), int(args(1)))
2021-10-09 23:05:56 +02:00
Case 3
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(args(0), int(args(1)), int(args(2)))
2021-10-09 23:05:56 +02:00
Case 4
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)))
2021-10-09 23:05:56 +02:00
Case 5
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)), args(4))
2021-10-09 23:05:56 +02:00
Case 6, 7
2021-10-11 21:16:39 +02:00
_NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)), args(4), args(5))
2021-10-09 23:05:56 +02:00
End Select
If args.Length = 7 AndAlso CBool(args(6)) = True Then
CType(CurrentScreen, OverworldScreen).NotificationPopupList.Insert(0, _NotificationPopup)
2021-10-11 21:16:39 +02:00
Else
CType(CurrentScreen, OverworldScreen).NotificationPopupList.Add(_NotificationPopup)
2021-10-09 23:05:56 +02:00
End If
2016-09-07 18:50:38 +02:00
Case "show"
Screen.TextBox.reDelay = 0.0F
Screen.TextBox.Show(argument, {}, False, False)
CanContinue = False
Case "setfont"
Dim f As FontContainer = FontManager.GetFontContainer(argument)
If Not f Is Nothing Then
Screen.TextBox.TextFont = f
Else
Screen.TextBox.TextFont = FontManager.GetFontContainer("textfont")
End If
Case "debug"
Logger.Debug("DEBUG: " & argument.ToString())
Case "log"
Logger.Log(Logger.LogTypes.Debug, argument.ToString())
Case "color"
Dim args As String() = argument.Split(CChar(","))
If args.Length = 1 Then
Select Case args(0).ToLower()
Case "playercolor", "player"
Screen.TextBox.TextColor = TextBox.PlayerColor
Case "defaultcolor", "default"
Screen.TextBox.TextColor = TextBox.DefaultColor
Case Else ' Try to convert the input color name into a color: (https://msdn.microsoft.com/en-us/library/system.drawing.knowncolor%28v=vs.110%29.aspx)
2016-09-07 18:50:38 +02:00
Screen.TextBox.TextColor = Drawing.Color.FromName(args(0)).ToXNA()
End Select
ElseIf args.Length = 3 Then
Screen.TextBox.TextColor = New Color(int(args(0)), int(args(1)), int(args(2)))
End If
End Select
IsReady = True
End Sub
End Class
End Namespace