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 defd4d538..50c274f08 100644 Binary files a/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png and b/lib/P3D.ContentPipeline/Content/Fonts/BMP/VoltorbFlipFont.png differ