From 6b12b8f9d057455bcead9e9abd03d14838927910 Mon Sep 17 00:00:00 2001 From: jianmingyong Date: Mon, 9 Jan 2017 01:36:27 +0800 Subject: [PATCH] Added per GameMode instance of global start script. New GameMode rule added "StartScript" --- 2.5DHero/2.5DHero/Overworld/OverworldScreen.vb | 7 +++++++ 2.5DHero/2.5DHero/Resources/GameModeManager.vb | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/2.5DHero/2.5DHero/Overworld/OverworldScreen.vb b/2.5DHero/2.5DHero/Overworld/OverworldScreen.vb index f2abb57b6..7a30911ee 100644 --- a/2.5DHero/2.5DHero/Overworld/OverworldScreen.vb +++ b/2.5DHero/2.5DHero/Overworld/OverworldScreen.vb @@ -81,6 +81,7 @@ Public Class OverworldScreen End Set End Property + Public Property GlobalGameModeScriptStarted As Boolean = False #End Region ''' @@ -143,6 +144,12 @@ Public Class OverworldScreen ''' Updates the OverworldScreen. ''' 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 diff --git a/2.5DHero/2.5DHero/Resources/GameModeManager.vb b/2.5DHero/2.5DHero/Resources/GameModeManager.vb index 4144b70ae..ba4895665 100644 --- a/2.5DHero/2.5DHero/Resources/GameModeManager.vb +++ b/2.5DHero/2.5DHero/Resources/GameModeManager.vb @@ -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 + ''' + ''' The default gamemode boot up script. + ''' + Public Property StartScript As String = "" + #End Region Class GameRule