Added per GameMode instance of global start script. New GameMode rule added "StartScript"

This commit is contained in:
jianmingyong 2017-01-09 01:36:27 +08:00
parent e435227959
commit 6b12b8f9d0
2 changed files with 15 additions and 0 deletions

View File

@ -81,6 +81,7 @@ Public Class OverworldScreen
End Set
End Property
Public Property GlobalGameModeScriptStarted As Boolean = False
#End Region
''' <summary>
@ -143,6 +144,12 @@ Public Class OverworldScreen
''' Updates the OverworldScreen.
''' </summary>
Public Overrides Sub Update()
If GameModeManager.ActiveGameMode.StartScript <> "" AndAlso ActionScript.IsReady AndAlso Not GlobalGameModeScriptStarted Then
ActionScript.reDelay = 0.0F
ActionScript.StartScript(GameModeManager.ActiveGameMode.StartScript, 0)
GlobalGameModeScriptStarted = True
End If
'If the MapScript has a value loaded from the MapScript map tag and there is no script running, start that script:
If LevelLoader.MapScript <> "" And ActionScript.IsReady = True Then
ActionScript.reDelay = 0.0F

View File

@ -459,6 +459,8 @@ Public Class GameMode
End If
Case "startrotation"
Me._startRotation = CSng(Value.Replace(".", GameController.DecSeparator))
Case "startscript"
StartScript = Value
Case "startlocationname"
Me._startLocationName = Value
Case "startdialogue"
@ -590,6 +592,7 @@ Public Class GameMode
"StartMap|" & Me._startMap & vbNewLine &
"StartPosition|" & Me._startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & vbNewLine &
"StartRotation|" & Me._startRotation.ToString().Replace(GameController.DecSeparator, ".") & vbNewLine &
"StartScript|" & StartScript & vbNewLine &
"StartLocationName|" & Me._startLocationName & vbNewLine &
"StartDialogue|" & Me._startDialogue & vbNewLine &
"StartColor|" & Me._startColor.R & "," & Me._startColor.G & "," & Me._startColor.B & vbNewLine &
@ -980,6 +983,11 @@ Public Class GameMode
End Set
End Property
''' <summary>
''' The default gamemode boot up script.
''' </summary>
Public Property StartScript As String = ""
#End Region
Class GameRule