Add mail delete menu + modern buttons

This commit is contained in:
JappaWakka 2023-07-25 12:48:43 +02:00
parent 970feaefbc
commit fdcbdfa62b
5 changed files with 537 additions and 358 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -11033,7 +11033,7 @@
<Content Include="Content\GUI\Menus\InterfaceColors.png"> <Content Include="Content\GUI\Menus\InterfaceColors.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\GUI\Menus\MailMenuBackground.png"> <Content Include="Content\GUI\Menus\MailboxBackground.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\GUI\PokemonMenu\Alcremie.png"> <Content Include="Content\GUI\PokemonMenu\Alcremie.png">

View File

@ -6,6 +6,10 @@
Dim scrollIndex As Integer = 0 Dim scrollIndex As Integer = 0
Dim selectIndex As Integer = 0 Dim selectIndex As Integer = 0
Dim MenuEntries As New List(Of MenuEntry)
Dim MenuVisible As Boolean = False
Dim MenuCursor As Integer = 0
Dim MenuHeader As String = ""
Dim message As String = "" Dim message As String = ""
Public Sub New(ByVal currentScreen As Screen) Public Sub New(ByVal currentScreen As Screen)
@ -39,72 +43,91 @@
backSize.Width = CInt(windowSize.Height / origSize.Height * origSize.Width) backSize.Width = CInt(windowSize.Height / origSize.Height * origSize.Width)
End If End If
Dim background As Texture2D = TextureManager.GetTexture("GUI\Menus\MailMenuBackground") Dim background As Texture2D = TextureManager.GetTexture("GUI\Menus\MailboxBackground")
Core.SpriteBatch.Draw(background, New Rectangle(0, 0, backSize.Width, backSize.Height), Color.White) Core.SpriteBatch.Draw(background, New Rectangle(0, 0, backSize.Width, backSize.Height), Color.White)
Canvas.DrawRectangle(New Rectangle(32, 16, 240, 48), Color.White) Canvas.DrawRectangle(New Rectangle(32, 16, 240, 48), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", New Vector2(48, 24), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", New Vector2(48, 24), Color.Black)
Canvas.DrawRectangle(New Rectangle(32, 64, 352, 592), New Color(255, 255, 255, 224)) Canvas.DrawRectangle(New Rectangle(32, 64, 352, 624), New Color(255, 255, 255, 224))
Canvas.DrawRectangle(New Rectangle(400, 64, 704, 592), New Color(255, 255, 255, 224)) Canvas.DrawRectangle(New Rectangle(400, 64, 704, 624), New Color(255, 255, 255, 224))
For i = scrollIndex To scrollIndex + 8 For i = scrollIndex To scrollIndex + 8
If i = 0 Then If i = 0 Then
DrawMail(Nothing, New Vector2(42, 78 + (i - scrollIndex) * 64), i) DrawMail(Nothing, New Vector2(42, 78 + (i - scrollIndex) * 64), i)
Else Else
If i <= Core.Player.Mails.Count Then If i <= Core.Player.Mails.Count Then
DrawMail(Core.Player.Mails(i - 1), New Vector2(42, 78 + (i - scrollIndex) * 64), i) DrawMail(Core.Player.Mails(i - 1), New Vector2(42, 78 + (i - scrollIndex) * 64 + 2 * (i - scrollIndex)), i)
End If End If
End If End If
Next Next
Canvas.DrawScrollBar(New Vector2(358, 86), Core.Player.Mails.Count + 1, 9, scrollIndex, New Size(6, 560), False, Color.LightGray, Color.Black) Canvas.DrawScrollBar(New Vector2(368, 86), Core.Player.Mails.Count + 1, 9, scrollIndex, New Size(6, 560), False, Color.LightGray, Color.Black)
If Me.index <> -1 Then If Me.index <> -1 Then
DrawCurrentMail() DrawCurrentMail()
End If End If
If MenuVisible = True Then
DrawMenuEntries()
End If
If message <> "" Then If message <> "" Then
Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, 150)) Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, 150))
Dim t As String = message.CropStringToWidth(FontManager.MainFont, 800) Dim t As String = message.CropStringToWidth(FontManager.MainFont, 800)
Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.MainFont.MeasureString(t).X / 2), 340), Color.White) Core.SpriteBatch.DrawString(FontManager.MainFont, t, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.MainFont.MeasureString(t).X / 2), 340), Color.White)
End If End If
End Sub End Sub
Private Sub DrawMail(ByVal mail As Items.MailItem.MailData, ByVal P As Vector2, ByVal i As Integer) Private Sub DrawMail(ByVal mail As Items.MailItem.MailData, ByVal P As Vector2, ByVal i As Integer)
If i = 0 Then If i = 0 Then
Dim x As Integer = 0 Dim x As Integer = 16
Dim y As Integer = 0 Dim y As Integer = 16
If i = Me.index Then If i = Me.index Then
y = 48 x = 80
y = 72
Else Else
If i = selectIndex Then If i = selectIndex Then
y = 0
x = 48 x = 48
y = 72
End If End If
End If End If
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 2, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x, y, 16, 16), ""), New Rectangle(CInt(P.X), CInt(CInt(P.Y)), 64, 64), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black) For i = 64 To 224 Step 64
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x + 16, y, 16, 16), ""), New Rectangle(CInt(P.X + i), CInt(CInt(P.Y)), 64, 64), Color.White)
Next
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x, y, 16, 16), ""), New Rectangle(CInt(P.X + 256), CInt(CInt(P.Y)), 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Core.SpriteBatch.DrawString(FontManager.MainFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 18), Color.Black)
Else Else
Dim item As Item = Item.GetItemByID(mail.MailID.ToString) Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
Dim x As Integer = 0 Dim x As Integer = 16
Dim y As Integer = 0 Dim y As Integer = 16
If i = Me.index Then If i = Me.index Then
y = 48 x = 80
y = 72
Else Else
If i = selectIndex Then If i = selectIndex Then
y = 0
x = 48 x = 48
y = 72
End If End If
End If End If
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 2, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x, y, 16, 16), ""), New Rectangle(CInt(P.X), CInt(CInt(P.Y)), 64, 64), Color.White)
Core.SpriteBatch.Draw(item.Texture, New Rectangle(CInt(P.X), CInt(P.Y), 48, 48), Color.White) For i = 64 To 224 Step 64
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x + 16, y, 16, 16), ""), New Rectangle(CInt(P.X + i), CInt(CInt(P.Y)), 64, 64), Color.White)
Next
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(x, y, 16, 16), ""), New Rectangle(CInt(P.X + 256), CInt(CInt(P.Y)), 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black) Core.SpriteBatch.Draw(item.Texture, New Rectangle(CInt(P.X), CInt(P.Y) + 4, 48, 48), Color.White)
Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 18), Color.Black)
If mail.MailAttachment > -1 Then If mail.MailAttachment > -1 Then
Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment) Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment)
@ -112,7 +135,7 @@
End If End If
If mail.MailRead = False Then If mail.MailRead = False Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\GTS"), New Rectangle(CInt(P.X) + 272, CInt(P.Y), 32, 32), New Rectangle(320, 144, 32, 32), Color.White) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\GTS"), New Rectangle(CInt(P.X) + 272, CInt(P.Y) + 4, 32, 32), New Rectangle(320, 144, 32, 32), Color.White)
End If End If
End If End If
End Sub End Sub
@ -162,18 +185,26 @@
Core.SpriteBatch.DrawString(FontManager.MainFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Mail OT: " & mail.MailSender & " (" & mail.MailOriginalTrainerOT & ")", New Vector2(430, yPlus + 260), Color.Black)
If EditMailIndex = 3 Then If EditMailIndex = 3 Then
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(440, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(96, 72, 16, 16), ""), New Rectangle(440 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(440 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Else Else
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(440, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), ""), New Rectangle(440 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(440 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
End If End If
Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(524 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(534 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(348 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black)
If EditMailIndex = 4 Then If EditMailIndex = 4 Then
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(640, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(96, 72, 16, 16), ""), New Rectangle(640 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(640 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Else Else
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(640, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), ""), New Rectangle(640 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(640 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
End If End If
Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(724 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(734 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(348 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black)
Else Else
Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1) Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1)
Dim item As Item = Item.GetItemByID(mail.MailID.ToString) Dim item As Item = Item.GetItemByID(mail.MailID.ToString)
@ -205,18 +236,37 @@
End If End If
If EditMailIndex = 0 Then If EditMailIndex = 0 Then
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(440, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(96, 72, 16, 16), ""), New Rectangle(440 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(440 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Else Else
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(440, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), ""), New Rectangle(440 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(440 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
End If End If
Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(524 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Attach", New Vector2(CInt(534 - FontManager.MainFont.MeasureString("Attach").X / 2), yPlus + CInt(348 - FontManager.MainFont.MeasureString("Attach").Y / 2)), Color.Black)
If EditMailIndex = 1 Then If EditMailIndex = 1 Then
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(640, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(96, 72, 16, 16), ""), New Rectangle(640 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(640 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Else Else
Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(640, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), ""), New Rectangle(640 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(640 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
End If End If
Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(724 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(344 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black) Core.SpriteBatch.DrawString(FontManager.MainFont, "Delete", New Vector2(CInt(734 - FontManager.MainFont.MeasureString("Delete").X / 2), yPlus + CInt(348 - FontManager.MainFont.MeasureString("Delete").Y / 2)), Color.Black)
If EditMailIndex = 2 Then
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(840, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(96, 72, 16, 16), ""), New Rectangle(840 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(80, 72, 16, 16), ""), New Rectangle(840 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Else
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(840, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), ""), New Rectangle(840 + 64, yPlus + 320, 64, 64), Color.White)
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), ""), New Rectangle(840 + 128, yPlus + 320, 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
End If
Core.SpriteBatch.DrawString(FontManager.MainFont, "Cancel", New Vector2(CInt(934 - FontManager.MainFont.MeasureString("Cancel").X / 2), yPlus + CInt(348 - FontManager.MainFont.MeasureString("Cancel").Y / 2)), Color.Black)
End If End If
End Sub End Sub
@ -227,7 +277,42 @@
End If End If
Exit Sub Exit Sub
Else
If MenuVisible = True Then
For i = 0 To Me.MenuEntries.Count - 1
If i <= Me.MenuEntries.Count - 1 Then
Dim m As MenuEntry = Me.MenuEntries(i)
m.Update(Me)
End If End If
Next
If Controls.Up(True, True) = True Then
Me.MenuCursor -= 1
End If
If Controls.Down(True, True) = True Then
Me.MenuCursor += 1
End If
Dim maxIndex As Integer = 0
Dim minIndex As Integer = 100
For Each e As MenuEntry In Me.MenuEntries
If e.Index < minIndex Then
minIndex = e.Index
End If
If e.Index > maxIndex Then
maxIndex = e.Index
End If
Next
If Me.MenuCursor > maxIndex Then
Me.MenuCursor = minIndex
ElseIf Me.MenuCursor < minIndex Then
Me.MenuCursor = maxIndex
End If
Else
If index <> 0 Then If index <> 0 Then
If index > -1 Then If index > -1 Then
@ -239,33 +324,34 @@
If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then
EditMailIndex -= 1 EditMailIndex -= 1
End If End If
If Controls.Left(True, True, False, False, False) = True Then If Controls.Left(True, True, False, True, True) = True Then
If EditMailIndex = 1 Then
EditMailIndex -= 1 EditMailIndex -= 1
End If End If
End If If Controls.Right(True, True, False, True, True) = True Then
If Controls.Right(True, True, False, False, False) = True Then
If EditMailIndex = 0 Then
EditMailIndex += 1 EditMailIndex += 1
End If End If
End If
EditMailIndex = EditMailIndex.Clamp(0, 1) EditMailIndex = EditMailIndex.Clamp(0, 2)
If Controls.Accept(False, True, True) = True Then If Controls.Accept(False, True, True) = True Then
If EditMailIndex = 0 Then Select Case EditMailIndex
Case 0
Me.TempNewMail = Core.Player.Mails(Me.index - 1) Me.TempNewMail = Core.Player.Mails(Me.index - 1)
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True} Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
Core.SetScreen(selScreen) Core.SetScreen(selScreen)
Else Case 1
Dim e1 As New MenuEntry(3, "Yes", False, AddressOf DeleteMail)
Dim e2 As New MenuEntry(4, "No", True, Nothing)
SetupMenu({e1, e2}, "Delete this mail?")
Case 2
Me.index = -1 Me.index = -1
EditMailIndex = 0 EditMailIndex = 0
End Select
End If
End If End If
Dim text As String = Core.Player.Mails(index - 1).MailText.CropStringToWidth(FontManager.MainFont, 600) Dim text As String = Core.Player.Mails(index - 1).MailText.CropStringToWidth(FontManager.MainFont, 600)
@ -275,12 +361,12 @@
Dim MailIndex As Integer = -1 Dim MailIndex As Integer = -1
For i = 0 To 8 For i = 0 To 8
If i < Core.Player.Mails.Count + 1 Then If i < Core.Player.Mails.Count + 1 Then
If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then
MailIndex = scrollIndex + i MailIndex = scrollIndex + i
Exit For Exit For
End If End If
Else Else
If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 1 EditMailIndex = 1
Exit For Exit For
End If End If
@ -310,24 +396,24 @@
End If End If
Else Else
If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then If New Rectangle(440, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 0 EditMailIndex = 0
End If
If New Rectangle(640, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 1
End If
If EditMailIndex = 0 Then
Me.TempNewMail = Core.Player.Mails(Me.index - 1) Me.TempNewMail = Core.Player.Mails(Me.index - 1)
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True} Dim selScreen = New PartyScreen(Me, Item.GetItemByID(TempNewMail.MailID.ToString), AddressOf Me.ChosenPokemon, "Give mail to:", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler
Core.SetScreen(selScreen) Core.SetScreen(selScreen)
Else End If
If New Rectangle(640, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 1
Dim e1 As New MenuEntry(3, "Yes", False, AddressOf DeleteMail)
Dim e2 As New MenuEntry(4, "No", True, Nothing)
SetupMenu({e1, e2}, "Delete this mail?")
End If
If New Rectangle(840, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then
Me.index = -1 Me.index = -1
EditMailIndex = 0 EditMailIndex = 0
End If End If
End If End If
End If End If
@ -387,7 +473,7 @@
Dim MailIndex As Integer = -1 Dim MailIndex As Integer = -1
For i = 0 To 8 For i = 0 To 8
If i < Core.Player.Mails.Count + 1 Then If i < Core.Player.Mails.Count + 1 Then
If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then
MailIndex = scrollIndex + i MailIndex = scrollIndex + i
Exit For Exit For
End If End If
@ -420,7 +506,7 @@
If Controls.Dismiss(True, True, True) = True Then If Controls.Dismiss(True, True, True) = True Then
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.White, False)) Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.Black, False))
End If End If
End If End If
Else Else
@ -435,23 +521,23 @@
End If End If
If Controls.Left(True, True, False, False, False) = True Then If Controls.Left(True, True, False, False, False) = True Then
pressedSystemKey = True pressedSystemKey = True
If EditMailIndex = 4 Then If EditMailIndex = 4 Or EditMailIndex = 5 Then
EditMailIndex -= 1 EditMailIndex -= 1
End If End If
End If End If
If Controls.Right(True, True, False, False, False) = True Then If Controls.Right(True, True, False, False, False) = True Then
pressedSystemKey = True pressedSystemKey = True
If EditMailIndex = 3 Then If EditMailIndex = 3 Or EditMailIndex = 4 Then
EditMailIndex += 1 EditMailIndex += 1
End If End If
End If End If
If Controls.Left(False, False, True, True, True) = True Then If Controls.Left(False, False, False, True, True) = True Then
If EditMailIndex = 1 Then If EditMailIndex = 4 Or EditMailIndex = 5 Then
EditMailIndex -= 1 EditMailIndex -= 1
End If End If
End If End If
If Controls.Right(False, False, True, True, True) = True Then If Controls.Right(False, False, False, True, True) = True Then
If EditMailIndex = 0 Then If EditMailIndex = 3 Or EditMailIndex = 4 Then
EditMailIndex += 1 EditMailIndex += 1
End If End If
End If End If
@ -498,12 +584,12 @@
Dim MailIndex As Integer = -1 Dim MailIndex As Integer = -1
For i = 0 To 8 For i = 0 To 8
If i < Core.Player.Mails.Count + 1 Then If i < Core.Player.Mails.Count + 1 Then
If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then
MailIndex = scrollIndex + i MailIndex = scrollIndex + i
Exit For Exit For
End If End If
Else Else
If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 4 EditMailIndex = 4
Exit For Exit For
End If End If
@ -530,10 +616,10 @@
If New Rectangle(420, yPlus + 200, 660, 40).Contains(MouseHandler.MousePosition) Then If New Rectangle(420, yPlus + 200, 660, 40).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 2 EditMailIndex = 2
End If End If
If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then If New Rectangle(440, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 3 EditMailIndex = 3
End If End If
If New Rectangle(640, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then If New Rectangle(640, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then
EditMailIndex = 4 EditMailIndex = 4
End If End If
@ -560,6 +646,8 @@
SoundManager.PlaySound("select") SoundManager.PlaySound("select")
End If End If
End If End If
End If
End If
End Sub End Sub
Private Sub ChosenMailHandler(ByVal params As Object()) Private Sub ChosenMailHandler(ByVal params As Object())
@ -610,6 +698,8 @@
Me.message = text Me.message = text
End Sub End Sub
#Region "Trophies" #Region "Trophies"
Public Structure TrophyInformation Public Structure TrophyInformation
@ -650,4 +740,93 @@
#End Region #End Region
#Region "DeleteMailMenu"
Private Sub DeleteMail()
Me.message = "The mail has been removed from the mailbox."
Core.Player.Mails.RemoveAt(Me.index - 1)
Me.index = -1
EditMailIndex = 0
selectIndex -= 1
selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count)
End Sub
Private Sub SetupMenu(ByVal entries() As MenuEntry, ByVal header As String)
Me.MenuEntries.Clear()
Me.MenuEntries.AddRange(entries)
Me.MenuVisible = True
Me.MenuCursor = MenuEntries(0).Index
Me.MenuHeader = header
End Sub
Private Sub DrawMenuEntries()
If Me.MenuHeader <> "" Then
Canvas.DrawRectangle(New Rectangle(Core.windowSize.Width - 334, 100, 320, 64), New Color(0, 0, 0, 180))
Core.SpriteBatch.DrawString(FontManager.MainFont, MenuHeader, New Vector2(Core.windowSize.Width - 174 - FontManager.MainFont.MeasureString(MenuHeader).X / 2, 120), Color.White)
End If
For Each e As MenuEntry In Me.MenuEntries
e.Draw(Me.MenuCursor, TextureManager.GetTexture("GUI\Menus\General", New Rectangle(0, 0, 16, 16), ""))
Next
End Sub
Class MenuEntry
Public Index As Integer = 0
Public TAG As Object = Nothing
Public Text As String = "Menu"
Public IsBack As Boolean = False
Public Delegate Sub ClickEvent(ByVal m As MenuEntry)
Public ClickHandler As ClickEvent = Nothing
Dim t1 As Texture2D
Dim t2 As Texture2D
Public Sub New(ByVal Index As Integer, ByVal text As String, ByVal isBack As Boolean, ByVal ClickHandler As ClickEvent)
Me.New(Index, text, isBack, ClickHandler, Nothing)
End Sub
Public Sub New(ByVal Index As Integer, ByVal text As String, ByVal isBack As Boolean, ByVal ClickHandler As ClickEvent, ByVal TAG As Object)
Me.Index = Index
Me.TAG = TAG
Me.Text = text
Me.IsBack = isBack
Me.ClickHandler = ClickHandler
t1 = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(16, 16, 16, 16), "")
t2 = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(32, 16, 16, 16), "")
End Sub
Public Sub Update(ByVal s As MailSystemScreen)
If Controls.Accept(True, False, False) = True And s.MenuCursor = Me.Index And New Rectangle(Core.windowSize.Width - 270, 66 * Index, 256, 64).Contains(MouseHandler.MousePosition) = True Or Controls.Accept(False, True, True) = True And s.MenuCursor = Me.Index Or Controls.Dismiss(True, True, True) = True And Me.IsBack = True Then
s.MenuVisible = False
If Not ClickHandler Is Nothing Then
ClickHandler(Me)
End If
End If
If New Rectangle(Core.windowSize.Width - 270, 66 * Index, 256, 64).Contains(MouseHandler.MousePosition) = True And Controls.Accept(True, False, False) = True Then
s.MenuCursor = Me.Index
End If
End Sub
Public Sub Draw(ByVal CursorIndex As Integer, ByVal CursorTexture As Texture2D)
Dim startPos As New Vector2(Core.windowSize.Width - 270, 66 * Index)
Core.SpriteBatch.Draw(t1, New Rectangle(CInt(startPos.X), CInt(startPos.Y), 64, 64), Color.White)
Core.SpriteBatch.Draw(t2, New Rectangle(CInt(startPos.X + 64), CInt(startPos.Y), 64, 64), Color.White)
Core.SpriteBatch.Draw(t2, New Rectangle(CInt(startPos.X + 128), CInt(startPos.Y), 64, 64), Color.White)
Core.SpriteBatch.Draw(t1, New Rectangle(CInt(startPos.X + 192), CInt(startPos.Y), 64, 64), Nothing, Color.White, 0.0F, New Vector2(0), SpriteEffects.FlipHorizontally, 0.0F)
Core.SpriteBatch.DrawString(FontManager.MainFont, Me.Text, New Vector2(startPos.X + 128 - (FontManager.MainFont.MeasureString(Me.Text).X * 1.4F) / 2, startPos.Y + 15), Color.Black, 0.0F, Vector2.Zero, 1.4F, SpriteEffects.None, 0.0F)
If Me.Index = CursorIndex Then
Dim cPosition As Vector2 = New Vector2(startPos.X + 128, startPos.Y - 40)
Dim t As Texture2D = CursorTexture
Core.SpriteBatch.Draw(t, New Rectangle(CInt(cPosition.X), CInt(cPosition.Y), 64, 64), Color.White)
End If
End Sub
End Class
#End Region
End Class End Class

View File

@ -207,7 +207,7 @@
CanContinue = False CanContinue = False
Case "mailsystem" Case "mailsystem"
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MailSystemScreen(Core.CurrentScreen), Color.White, False)) Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New MailSystemScreen(Core.CurrentScreen), Color.Black, False))
IsReady = True IsReady = True