Fix global level

This commit is contained in:
jianmingyong 2017-03-25 02:00:13 +08:00
parent 5fbbf804f6
commit e5f2db323e

View File

@ -1,3 +1,4 @@
Imports net.Pokemon3D.Game
''' <summary> ''' <summary>
''' The base class for all screens in the game. ''' The base class for all screens in the game.
''' </summary> ''' </summary>
@ -104,6 +105,7 @@ Public MustInherit Class Screen
''' </summary> ''' </summary>
Public Shared Property Camera() As Camera Public Shared Property Camera() As Camera
Private Shared _globalLevel As Level
''' <summary> ''' <summary>
''' A global level instance, that carries over screen instances. ''' A global level instance, that carries over screen instances.
''' </summary> ''' </summary>
@ -213,13 +215,13 @@ Public MustInherit Class Screen
''' </summary> ''' </summary>
''' <param name="scr">The source screen.</param> ''' <param name="scr">The source screen.</param>
Protected Sub CopyFrom(ByVal scr As Screen) Protected Sub CopyFrom(ByVal scr As Screen)
_mouseVisible = scr._mouseVisible _MouseVisible = scr._MouseVisible
_canBePaused = scr._canBePaused _CanBePaused = scr._CanBePaused
_canMuteMusic = scr._canMuteMusic _CanMuteMusic = scr._CanMuteMusic
_canChat = scr._canChat _CanChat = scr._CanChat
_canTakeScreenshot = scr._canTakeScreenshot _CanTakeScreenshot = scr._CanTakeScreenshot
_canDrawDebug = scr._canDrawDebug _CanDrawDebug = scr._CanDrawDebug
_canGoFullscreen = scr._canGoFullscreen _CanGoFullscreen = scr._CanGoFullscreen
End Sub End Sub
''' <summary> ''' <summary>
@ -233,7 +235,7 @@ Public MustInherit Class Screen
''' <summary> ''' <summary>
''' The base render function of the screen. Used to render models above sprites. ''' The base render function of the screen. Used to render models above sprites.
''' </summary> ''' </summary>
Public Overridable Overloads Sub Render() Public Overridable Overloads Sub Render()
End Sub End Sub
@ -265,7 +267,7 @@ Public MustInherit Class Screen
''' Returns if this screen instance is the currently active screen (set in the global Basic.CurrentScreen). ''' Returns if this screen instance is the currently active screen (set in the global Basic.CurrentScreen).
''' </summary> ''' </summary>
''' <returns></returns> ''' <returns></returns>
Public Function IsCurrentScreen() As Boolean Public Function IsCurrentScreen() As Boolean
If CurrentScreen.Identification = Identification Then 'If the screen stored in the CurrentScreen field has the same ID as this screen, return true. If CurrentScreen.Identification = Identification Then 'If the screen stored in the CurrentScreen field has the same ID as this screen, return true.
Return True Return True
Else Else
@ -292,7 +294,7 @@ Public MustInherit Class Screen
''' <summary> ''' <summary>
''' An event that is getting raised when the Escape button is getting pressed. The PauseScreen is getting brought up if the CanBePaused field is set to true. ''' An event that is getting raised when the Escape button is getting pressed. The PauseScreen is getting brought up if the CanBePaused field is set to true.
''' </summary> ''' </summary>
Public Overridable Sub EscapePressed() Public Overridable Sub EscapePressed()
'If the game can be paused on this screen, open the PauseScreen. 'If the game can be paused on this screen, open the PauseScreen.
If CurrentScreen.CanBePaused = True Then If CurrentScreen.CanBePaused = True Then
SetScreen(New PauseScreen(CurrentScreen)) SetScreen(New PauseScreen(CurrentScreen))
@ -329,7 +331,7 @@ Public MustInherit Class Screen
''' </summary> ''' </summary>
''' <param name="Descriptions">The button types and descriptions.</param> ''' <param name="Descriptions">The button types and descriptions.</param>
''' <param name="Position">The position to draw the buttons.</param> ''' <param name="Position">The position to draw the buttons.</param>
Public Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Buttons, String), ByVal Position As Vector2) Public Sub DrawGamePadControls(ByVal Descriptions As Dictionary(Of Buttons, String), ByVal Position As Vector2)
'Only if a Gamepad is connected and the screen is active, render the buttons: 'Only if a Gamepad is connected and the screen is active, render the buttons:
If GamePad.GetState(PlayerIndex.One).IsConnected = True And Core.GameOptions.GamePadEnabled = True And IsCurrentScreen() = True Then If GamePad.GetState(PlayerIndex.One).IsConnected = True And Core.GameOptions.GamePadEnabled = True And IsCurrentScreen() = True Then
'Transform the position to integers and store the current drawing position: 'Transform the position to integers and store the current drawing position:
@ -398,7 +400,7 @@ Public MustInherit Class Screen
Dim s As Screen = Me Dim s As Screen = Me
While s.PreScreen IsNot Nothing And canDrawGradients = True While s.PreScreen IsNot Nothing And canDrawGradients = True
If s._isOverlay = False Then If s._IsOverlay = False Then
s = s.PreScreen s = s.PreScreen
If s.IsDrawingGradients = True Then If s.IsDrawingGradients = True Then
canDrawGradients = False canDrawGradients = False
@ -421,7 +423,7 @@ Public MustInherit Class Screen
''' Returns the screen status of the current screen. Override this function to return a screen state. ''' Returns the screen status of the current screen. Override this function to return a screen state.
''' </summary> ''' </summary>
''' <returns></returns> ''' <returns></returns>
Public Overridable Function GetScreenStatus() As String Public Overridable Function GetScreenStatus() As String
'// Return the generic "not implemented" message: '// Return the generic "not implemented" message:
Return "Screen state not implemented for screen class: " & Identification.ToString() Return "Screen state not implemented for screen class: " & Identification.ToString()
End Function End Function