The dirty fixes: Part 2

This commit is contained in:
Aragas 2016-10-06 18:25:33 +03:00
parent 8922030727
commit 3ef08819a9
5 changed files with 47 additions and 10 deletions

View File

@ -225,6 +225,7 @@
Return 1 Return 1
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -271,8 +272,9 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
End If End If
End If End If
End Sub End Sub
@ -747,4 +749,9 @@
#End Region #End Region
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -84,7 +84,7 @@
If Not OnlineSprite Is Nothing Then If Not OnlineSprite Is Nothing Then
Me.Texture = OnlineSprite Me.Texture = OnlineSprite
Else Else
If net.Pokemon3D.Game.TextureManager.TextureExist(texturePath) = True Then If TextureManager.TextureExist(texturePath) = True Then
Logger.Debug("Change network texture to [" & texturePath & "]") Logger.Debug("Change network texture to [" & texturePath & "]")
If texturePath.StartsWith("Pokemon\") = True Then If texturePath.StartsWith("Pokemon\") = True Then
@ -93,10 +93,10 @@
Me.HasPokemonTexture = False Me.HasPokemonTexture = False
End If End If
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture(texturePath) Me.Texture = TextureManager.GetTexture(texturePath)
Else Else
Logger.Debug("Texture fallback!") Logger.Debug("Texture fallback!")
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture("Textures\NPC\" & FallBack(Me.NetworkID)) Me.Texture = TextureManager.GetTexture("Textures\NPC\" & FallBack(Me.NetworkID))
End If End If
End If End If
End Sub End Sub
@ -124,6 +124,7 @@
Return texturePath & TextureID Return texturePath & TextureID
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -156,8 +157,9 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
End If End If
End If End If
End Sub End Sub
@ -370,4 +372,10 @@
Return Nothing Return Nothing
End Function End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -16,7 +16,7 @@
Dim AnimationDelay As Single = AnimationDelayLenght Dim AnimationDelay As Single = AnimationDelayLenght
Public Sub New(ByVal pos As Vector3, ByVal PokemonTexture As String, ByVal visible As Boolean) Public Sub New(ByVal pos As Vector3, ByVal PokemonTexture As String, ByVal visible As Boolean)
MyBase.New(pos.X, pos.Y, pos.Z, "NetworkPokemon", {net.Pokemon3D.Game.TextureManager.DefaultTexture}, {0, 0}, False, 0, New Vector3(0.9F), BaseModel.BillModel, 0, "", New Vector3(1)) MyBase.New(pos.X, pos.Y, pos.Z, "NetworkPokemon", {TextureManager.DefaultTexture}, {0, 0}, False, 0, New Vector3(0.9F), BaseModel.BillModel, 0, "", New Vector3(1))
Me.Visible = visible Me.Visible = visible
@ -97,10 +97,11 @@
Return True Return True
End Function End Function
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Me.Texture Is Nothing Then If Me.Texture Is Nothing Then
Dim path As String = Me.PokemonTexture.Replace("[POKEMON|N]", "Pokemon\Overworld\Normal\").Replace("[POKEMON|S]", "Pokemon\Overworld\Shiny\") Dim path As String = Me.PokemonTexture.Replace("[POKEMON|N]", "Pokemon\Overworld\Normal\").Replace("[POKEMON|S]", "Pokemon\Overworld\Shiny\")
Me.Texture = net.Pokemon3D.Game.TextureManager.GetTexture(path) Me.Texture = TextureManager.GetTexture(path)
End If End If
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -133,8 +134,9 @@
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
End If End If
End Sub End Sub
@ -173,4 +175,10 @@
Catch : End Try Catch : End Try
End Sub End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -34,6 +34,7 @@ Public Class OverworldPokemon
Me.DropUpdateUnlessDrawn = False Me.DropUpdateUnlessDrawn = False
End Sub End Sub
Dim dispTex As Boolean = false
Private Sub ChangeTexture() Private Sub ChangeTexture()
If Me.Texture Is Nothing Then If Me.Texture Is Nothing Then
Me.Texture = PokemonReference.GetOverworldTexture() Me.Texture = PokemonReference.GetOverworldTexture()
@ -62,8 +63,9 @@ Public Class OverworldPokemon
If r <> lastRectangle Then If r <> lastRectangle Then
lastRectangle = r lastRectangle = r
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
End If End If
End Sub End Sub
@ -269,4 +271,9 @@ Public Class OverworldPokemon
Me.ChangeTexture() Me.ChangeTexture()
End Sub End Sub
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class

View File

@ -113,6 +113,7 @@
End If End If
End Sub End Sub
Dim dispTex As Boolean = false
Public Sub ChangeTexture() Public Sub ChangeTexture()
If Not Me.Texture Is Nothing Then If Not Me.Texture Is Nothing Then
Dim r As New Rectangle(0, 0, 0, 0) Dim r As New Rectangle(0, 0, 0, 0)
@ -146,8 +147,9 @@
Core.Player.Skin = SkinName Core.Player.Skin = SkinName
Try Try
Dim t As Texture2D = net.Pokemon3D.Game.TextureManager.TextureRectangle(Me.Texture, r, 1) Dim t As Texture2D = TextureManager.TextureRectangle(Me.Texture, r, 1)
Textures(0) = t Textures(0) = t
dispTex = true
Catch Catch
Logger.Log(Logger.LogTypes.Warning, "OwnPlayer.vb: Error assigning a new texture to the player.") Logger.Log(Logger.LogTypes.Warning, "OwnPlayer.vb: Error assigning a new texture to the player.")
End Try End Try
@ -205,4 +207,9 @@
Return OwnPlayer.AnimationDelayLenght Return OwnPlayer.AnimationDelayLenght
End Function End Function
Protected Overrides Sub Finalize()
If Textures(0) IsNot Nothing And dispTex
Textures(0).Dispose()
End If
End Sub
End Class End Class