From 8bf3c7daf3470f017194815e9bb1b65a97653776 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Wed, 24 May 2023 11:49:18 +0200 Subject: [PATCH] Fix level drop system, adjust font, more drawing --- P3D/Resources/FontManager.vb | 6 ++ P3D/Screens/VoltorbFlipScreen.vb | 91 +++++++++++++++--- .../Content/Fonts/BMP/VoltorbFlipFont.png | Bin 448 -> 437 bytes 3 files changed, 86 insertions(+), 11 deletions(-) diff --git a/P3D/Resources/FontManager.vb b/P3D/Resources/FontManager.vb index d0ee6605c..45ecfa4f5 100644 --- a/P3D/Resources/FontManager.vb +++ b/P3D/Resources/FontManager.vb @@ -116,6 +116,12 @@ Public Class FontManager End Get End Property + Public Shared ReadOnly Property VoltorbFlipFont() As SpriteFont + Get + Return GetFont("voltorbflipfont") + End Get + End Property + Private Shared loadedGameJoltFont As SpriteFont = Nothing Private Shared hasLoadedGameJoltFont As Boolean = False diff --git a/P3D/Screens/VoltorbFlipScreen.vb b/P3D/Screens/VoltorbFlipScreen.vb index 7f729a842..68f97a3e8 100644 --- a/P3D/Screens/VoltorbFlipScreen.vb +++ b/P3D/Screens/VoltorbFlipScreen.vb @@ -32,9 +32,13 @@ Namespace VoltorbFlip Public Property CurrentLevel As Integer = 1 Public Shared ReadOnly MinLevel As Integer = 1 - Public Shared ReadOnly MaxLevel As Integer = 8 + Public Shared ReadOnly MaxLevel As Integer = 7 + Public Shared Property CurrentFlips As Integer = 0 + Public Shared Property TotalFlips As Integer = 0 + Public Shared Property CurrentCoins As Integer = 0 - Public Property TotalCoins As Integer = 0 + Public Shared Property TotalCoins As Integer = 0 + Public Shared Property ConsequentWins As Integer = 0 Public Property MaxCoins As Integer = 1 Public Board As List(Of List(Of Tile)) @@ -69,8 +73,6 @@ Namespace VoltorbFlip Public Sub New(ByVal currentScreen As Screen) - Board = CreateBoard(1) - _preScreenTarget = New RenderTarget2D(GraphicsDevice, windowSize.Width, windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) _blur = New Resources.Blur.BlurHandler(windowSize.Width, windowSize.Height) @@ -151,6 +153,9 @@ Namespace VoltorbFlip SpriteBatch.Draw(TextureManager.GetTexture("Textures\VoltorbFlip\Board"), New Rectangle(CInt(BoardOrigin.X), CInt(BoardOrigin.Y), BoardSize.Width, BoardSize.Height), mainBackgroundColor) DrawTiles() + + DrawSums() + End Sub Private Sub DrawTiles() @@ -162,6 +167,60 @@ Namespace VoltorbFlip Next End Sub + Private Sub DrawSums() + Dim mainBackgroundColor As Color = New Color(255, 255, 255) + If GameState = States.Closing Or GameState = States.Opening Then + mainBackgroundColor = New Color(255, 255, 255, CInt(255 * _interfaceFade)) + End If + + 'Draw Rows + 'Coins + For RowIndex = 0 To GridSize - 1 + Dim CoinSumString As String = "00" + If GameState = States.Game Or GameState = States.Memo Then + Dim CoinSumInteger As Integer = CoinSums(0)(RowIndex) + If CoinSumInteger < 10 Then + CoinSumString = "0" & CoinSumInteger.ToString + Else + CoinSumString = CoinSumInteger.ToString + End If + End If + SpriteBatch.DrawString(FontManager.VoltorbFlipFont, CoinSumString, New Vector2(CInt(BoardOrigin.X + TileSize.Width * (GridSize - 1) - TileSize.Width / 2 - FontManager.VoltorbFlipFont.MeasureString(CoinSumString).X / 2), BoardOrigin.Y + TileSize.Height * RowIndex + 4), mainBackgroundColor) + Next + 'Voltorbs + For RowIndex = 0 To GridSize - 1 + Dim VoltorbSumString As String = "0" + If GameState = States.Game Or GameState = States.Memo Then + VoltorbSumString = VoltorbSums(0)(RowIndex).ToString + End If + SpriteBatch.DrawString(FontManager.VoltorbFlipFont, VoltorbSumString, New Vector2(CInt(BoardOrigin.X + TileSize.Width * (GridSize - 1) - TileSize.Width / 2 - FontManager.VoltorbFlipFont.MeasureString(VoltorbSumString).X / 2), BoardOrigin.Y + TileSize.Height * RowIndex + 17), mainBackgroundColor) + Next + + 'Draw Columns + 'Coins + For ColumnIndex = 0 To GridSize - 1 + Dim CoinSumString As String = "00" + If GameState = States.Game Or GameState = States.Memo Then + Dim CoinSumInteger As Integer = CoinSums(1)(ColumnIndex) + If CoinSumInteger < 10 Then + CoinSumString = "0" & CoinSumInteger.ToString + Else + CoinSumString = CoinSumInteger.ToString + End If + End If + SpriteBatch.DrawString(FontManager.VoltorbFlipFont, CoinSumString, New Vector2(CInt(BoardOrigin.X + TileSize.Width * ColumnIndex + TileSize.Width / 2 - FontManager.VoltorbFlipFont.MeasureString(CoinSumString).X / 2), BoardOrigin.Y + TileSize.Height * (GridSize - 1) + 4), mainBackgroundColor) + Next + 'Voltorbs + For ColumnIndex = 0 To GridSize - 1 + Dim VoltorbSumString As String = "0" + If GameState = States.Game Or GameState = States.Memo Then + VoltorbSumString = VoltorbSums(1)(ColumnIndex).ToString + End If + SpriteBatch.DrawString(FontManager.VoltorbFlipFont, VoltorbSumString, New Vector2(CInt(BoardOrigin.X + TileSize.Width * ColumnIndex + TileSize.Width / 2 - FontManager.VoltorbFlipFont.MeasureString(VoltorbSumString).X / 2), BoardOrigin.Y + TileSize.Height * (GridSize - 1) + 17), mainBackgroundColor) + Next + + End Sub + Private Sub DrawMemoMenuAndButton() Dim mainBackgroundColor As Color = New Color(255, 255, 255) If GameState = States.Closing Or GameState = States.Opening Then @@ -752,18 +811,26 @@ Namespace VoltorbFlip Next Next - PreviousLevel = CurrentLevel - CurrentLevel += 1 + TotalFlips += CurrentFlips + CurrentFlips = 0 + ConsequentWins += 1 - If CurrentLevel > MaxLevel Then - CurrentLevel = MaxLevel + If ConsequentWins = 5 And TotalFlips >= 8 Then + CurrentLevel = 8 + Else + PreviousLevel = CurrentLevel + CurrentLevel += 1 + + If CurrentLevel > MaxLevel Then + CurrentLevel = MaxLevel + End If End If GameState = States.NewLevel End If End If - 'Change Level, reset Tiles + 'Drop Level(s), reset Tiles If GameState = States.FlipLost Then If Controls.Accept = True And TextBox.Showing = False Then For _row = 0 To GridSize @@ -773,7 +840,8 @@ Namespace VoltorbFlip Next PreviousLevel = CurrentLevel - CurrentLevel -= 1 + CurrentLevel = CurrentFlips.Clamp(1, CurrentLevel.Clamp(1, 7)) + CurrentFlips = 0 If CurrentLevel < MinLevel Then CurrentLevel = MinLevel @@ -836,7 +904,7 @@ Namespace VoltorbFlip If _interfaceFade > 1.0F Then _interfaceFade = 1.0F If GameState = States.Opening Then - GameState = States.Game + GameState = States.NewLevel End If End If End If @@ -871,6 +939,7 @@ Namespace VoltorbFlip Public Sub Flip() If Flipped = False Then FlipProgress = 3 + VoltorbFlipScreen.CurrentFlips += 1 End If End Sub diff --git a/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png b/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png index defd4d5388db4d3eafd166188db7bf81b0780f18..50c274f086b89f05973085d34f7354d81b57b810 100644 GIT binary patch delta 385 zcmX@Wyp>t8Gr-TCmrII^fq{Y7)59f*fq{_)$X4KB1Cn2y*yc@Cw6AyYba4!+xb^my z_oQY69tX#t|Juv0MFu2n_|sVTTJmV>0_G5}-YDluN{bjAg#=U>k%%BO4%1Wr>s@Z& zcc0Vvx#Zu)=Tn;fqjUd8eqR6f_}{;of0Z=5-=EKW?LU*BMS+2l!`WfR-iN6lh3mfj z$quL~uRp`iBv9Xw@J~nJoZgeGjxYB9i~PLV;Y6K^q;386$G^>V+Z7^J zdhi|Jp%s5mG9`Y0Z2fy;@yWl8K%*F1*aTE+)f7CKnpBX9svG>0PwMY)n|{9t7^)1O Lu6{1-oD!M=2$<9Kbcs|my55+lYGrV}g^I2mR#fSF%>w*0eP z*!$Pscy*BOrhj_fKATb|dOD|0?DW}m!XzT6#z*q>tJW;b*`oUYt?lm@W@O&6KIT=r zG$mFw_?e2^!nSj#UNzVA_lO?b5i2(Hgi3be%wLz+e?K)P(z`6oMD#}b3sGGC>dybG=cW`gUc7guVA-^9PZ_+ISr+>*OEPkO^r(Z2_wS|k8e!p6ixaKC zTu``tUU>WCR5#a|TCpk;%ot>n>aW)C+&?y+2#Lo;7J#Qu-^` z>mka*Gf!;U=o3CC_!ry!Eh#6b#9r?)>^l{b*JD>QRaILP=DD?M!VSsmCUPnWJE%4I kFo41X#AE;kjm~-I%U>5=-XVIE6&Sz_p00i_>zopr0L+c7tpET3