P3D-Legacy/P3D/Battle/BattleSystemV2/QueryObjects/TextQueryObject.vb

119 lines
4.4 KiB
VB.net
Raw Normal View History

2016-09-07 18:50:38 +02:00
Namespace BattleSystem
Public Class TextQueryObject
Inherits QueryObject
Dim _text As String = ""
Dim _textColor As Color = Color.White
Dim _ready As Boolean = False
Dim _textIndex As Integer = 0
Dim _textDelay As Single = 0.015F
Private ReadOnly Property TextReady() As Boolean
Get
If _textIndex < Me._text.Length Then
Return False
End If
Return True
End Get
End Property
Public Sub New(ByVal Text As String)
MyBase.New(QueryTypes.Textbox)
Me._text = Text
Me._text = Me._text.Replace("*", " ")
Me._text = Me._text.Replace("~", " ")
Me._text = Me._text.Replace("<player.name>", Core.Player.Name)
Me._text = Me._text.Replace("<playername>", Core.Player.Name)
Me._text = Me._text.Replace("<rivalname>", Core.Player.RivalName)
Me._text = Me._text.Replace("[POKE]", "Poké")
If Me._text = "" Then
Me._ready = True
End If
End Sub
Public Sub New(ByVal Text As String, ByVal TextColor As Color)
MyBase.New(QueryTypes.Textbox)
Me._text = Text
Me._textColor = TextColor
If Me._text = "" Then
Me._ready = True
End If
End Sub
Public Overrides Sub Update(BV2Screen As BattleScreen)
If Me.TextReady = False Then
Me._textDelay -= 0.01F
If Me._textDelay <= 0.0F Then
Me._textDelay = 0.015F
Me._textIndex += 1
End If
If Controls.Accept(True, True) = True And Me._textIndex > 2 Then
Me._textIndex = Me._text.Length
End If
Else
If Controls.Accept(True, True) = True Then
Fix audio engine & contentpacks (#35) * Replaced existing Gen 2 SFX with better sounding ones (no ugly reverb) Replaced MediaPlayer with NAudio(and NAudio.Vorbis) for playing music in order to fix random stopping issues. The game now directly loads .ogg files instead of the .wma/.xnb combination from before. ContentPacks are now able to replace Music and SFX again (I haven't added a menu yet for choosing ContentPacks). To make older GameModes work with current versions, you can add the GameMode property EnterType and set it to "1", this will make the game use the older 2D NewGameScreen. * Delete GameController.vb * Add gamecontroller.vb back * Fix sfx missing * Battleintro doodle now doesn't loop anymore (for no trainer) Changed the shutter sound (aka Large Door sound) to something more large door-y Made the enter sound slightly louder The enter sound now plays when going through any warp to or from an indoor map (including falling through holes) The flying sound effect is played earlier in the animation after selecting a location Changed played sound effect when using the Escape Rope to "teleport" instead of "destroy" The bump noise now also plays when bumping into something in first person Fixed small gap between the end of the intro song and the start of the main song Replaced some songs with better songs * Fixed some more intro issues * Forgot to change a thing * Fixed an error where the main music would play, ignoring the muted musicmanager. * fix indenting in musicmanager * The music player will now only start playback on a new song if the music player is not muted, fixed the end time calculation of the intro of a song after muting, Music can't be unmuted now as long as a sound effect plays that stops the music. * Fixed league restplace position, fixed sound effects sharing the volume slider of the music, sound effects are now also muted when pressing M, changed music on/off popup to audio on/off, removed bump delay in first person, added more control on whether played songs should be looping or not. * Fixed some more scripts that turn on thirdperson mode but don't check if it was on before or set it back to what it was before afterwards, also fixed a small error in creditsscreen.vb. * Fixed indenting error in musicmanager.vb, fixed an error of mine where the loopsong parameter would be seen as the playintro parameter. * Added more music commands, added quite some menu select noises, will add more later * More select sound effects! * Fix music not resuming after soundeffect * Trainer using item now plays the single_heal soundeffect * Pokémon cries now sound louder * Possibly fixing crash when playing Pokémon cry at volume higher than 0.71 * Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720. * Sound effects now sound louder * Revert "Added better quality Pokémon cries, made random overworld cries slightly less loud, added cries for 719 and 720." This reverts commit 8c9296ed1a82144d17f303a52c3f2e9e65a5bfea. * Fixed the cause of why the title screen music plays even when the game is muted * Tabs to spaces * Revert Co-authored-by: darkfire006 <blazer257@live.com> Co-authored-by: JappaWakkaP3D <66885565+JappaWakkaP3D@users.noreply.github.com> Co-authored-by: JappaWakkaP3D <jasper.speelman@outlook.com> Co-authored-by: Vitaly Mikhailov <personal@aragas.org>
2020-07-09 19:59:42 +02:00
SoundManager.PlaySound("select")
2016-09-07 18:50:38 +02:00
Me._ready = True
End If
End If
End Sub
Public Overrides Sub Draw(BV2Screen As BattleScreen)
Dim rec As New Rectangle(100, Core.windowSize.Height - 250, Core.windowSize.Width - 200, 200)
Dim text As String = Me._text.Substring(0, _textIndex)
Battle fixes and improvements * Fixed camera angle not changing to the Pokémon when status effects are doing something * Fixed softlock when opponent trainer switches Pokémon * (Hopefully) fixed initial positioning errors with spawned BattleAnimation entities related to BattleFlip functionality * Removed the now unneccessary BattleFlip checks in the move animation of Growl * Improved Ember move animation (fireball speed & flame delay) * Improved Poison Sting move animation by making the stinger smaller, increasing the speed of the stinger and making it use a flipped version of the texture when the opponent uses the move * Improved Poisoned status effect animation by making it 1 bubble for regular poison and 3 bubbles for toxic * Repositioned the flame of the Burned status effect animation * Trainers now display a message when sending out their Pokémon (I removed that before) * Fixed Party Screen not appearing immediately after the player's Pokémon fainted and also made the player unable to exit the Party Screen when that happens. * Fixed the incorrectly scaled font sizes and text alignment in the selection menu that appears when selecting a Pokémon in the Party screen * Replaced minifont in the Pokémon level up stats box with InGameFont and fixed the offsets * Fixed the error I made in the ceiling map code of Violet City's gym * Removed the file MoveAnimationQueryObject.vb because AnimationQueryObject.vb also includes Move Animations * Fixed the textbox in battles where an empty rectangle would appear before the animation finished. * When a trainer spots the player and an exclamation mark bubble pops up above their head, a sound is played (Emote_Exclamation) * In trainer battles, the player's Pokémon now also plays their cry.
2022-01-16 17:22:36 +01:00
If text.Length > 0 Then
Canvas.DrawRectangle(rec, New Color(0, 0, 0, 150))
End If
Text = text.CropStringToWidth(FontManager.TextFont, 2.0F, Core.windowSize.Width - 300)
2016-09-07 18:50:38 +02:00
Core.SpriteBatch.DrawString(FontManager.TextFont, text, New Vector2(rec.X + 20, rec.Y + 20), Color.White, 0.0F, Vector2.Zero, 2.0F, SpriteEffects.None, 0.0F)
If GamePad.GetState(PlayerIndex.One).IsConnected = True And Core.GameOptions.GamePadEnabled = True And BV2Screen.IsCurrentScreen() = True Then
Dim d As New Dictionary(Of Buttons, String)
d.Add(Buttons.A, "OK")
BV2Screen.DrawGamePadControls(d, New Vector2(rec.X + rec.Width - 100, rec.Y + rec.Height - 40))
Else
If TextReady = True Then
Core.SpriteBatch.DrawString(FontManager.TextFont, "OK", New Vector2(rec.X + rec.Width - (FontManager.TextFont.MeasureString("OK").X * 2.0F) - 20, rec.Y + rec.Height - (FontManager.TextFont.MeasureString("OK").Y * 2.0F) - 5), Color.White, 0.0F, Vector2.Zero, 2.0F, SpriteEffects.None, 0.0F)
End If
End If
End Sub
Public Overrides ReadOnly Property IsReady() As Boolean
Get
Return Me._ready
End Get
End Property
Public Overrides Function NeedForPVPData() As Boolean
Return True
End Function
Public Shared Shadows Function FromString(ByVal input As String) As QueryObject
Dim d() As String = input.Split(CChar("|"))
Return New TextQueryObject(d(0).Replace("*", Environment.NewLine), New Color(CInt(d(1)), CInt(d(2)), CInt(d(3))))
2016-09-07 18:50:38 +02:00
End Function
Public Overrides Function ToString() As String
Dim s As String = Me._text.Replace(Environment.NewLine, "*") & "|" &
2016-09-07 18:50:38 +02:00
Me._textColor.R & "|" & Me._textColor.G & "|" & Me._textColor.B
Return "{TEXT|" & s & "}"
End Function
Public ReadOnly Property Text() As String
Get
Return Me._text
End Get
End Property
End Class
End Namespace