diff --git a/P3D/Content/Data/Scripts/computer_choose.dat b/P3D/Content/Data/Scripts/computer_choose.dat index e0c9c5035..4d08d3830 100644 --- a/P3D/Content/Data/Scripts/computer_choose.dat +++ b/P3D/Content/Data/Scripts/computer_choose.dat @@ -7,10 +7,10 @@ version=2 :if:=true @storage.set(int,canind,2) - @storage.set(str,computer_options,,Inbox) + @storage.set(str,computer_options,,Mailbox) :else @storage.set(int,canind,1) - @storage.set(str,computer_options,Inbox) + @storage.set(str,computer_options,Mailbox) :endif :if:=true @@ -43,7 +43,7 @@ version=2 @sound.play(PC\LogOn) @screen.mysteryevent @script.start(computer_choose) - :when:Inbox + :when:Mailbox @sound.play(PC\LogOn) @screen.mailsystem @script.start(computer_choose) diff --git a/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat b/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat index 9e4c19d4d..f2d5cc300 100644 Binary files a/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat and b/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat differ diff --git a/P3D/Content/Data/Scripts/route31/sleepy_guy.dat b/P3D/Content/Data/Scripts/route31/sleepy_guy.dat index 7b2f562dd..869c89121 100644 Binary files a/P3D/Content/Data/Scripts/route31/sleepy_guy.dat and b/P3D/Content/Data/Scripts/route31/sleepy_guy.dat differ diff --git a/P3D/Content/GUI/Menus/General.png b/P3D/Content/GUI/Menus/General.png index 654793d72..9470cb5d5 100644 Binary files a/P3D/Content/GUI/Menus/General.png and b/P3D/Content/GUI/Menus/General.png differ diff --git a/P3D/Content/GUI/Menus/MailboxBackground.png b/P3D/Content/GUI/Menus/MailboxBackground.png new file mode 100644 index 000000000..64bffb294 Binary files /dev/null and b/P3D/Content/GUI/Menus/MailboxBackground.png differ diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 46812f21a..d6b967717 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -11024,6 +11024,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/P3D/Pokemon/Attacks/Dark/KnockOff.vb b/P3D/Pokemon/Attacks/Dark/KnockOff.vb index 384b610da..f02d437e7 100644 --- a/P3D/Pokemon/Attacks/Dark/KnockOff.vb +++ b/P3D/Pokemon/Attacks/Dark/KnockOff.vb @@ -79,7 +79,7 @@ If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then Return Power End If - If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If op.Item.IsMail = True Then Return Power End If @@ -113,7 +113,7 @@ If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso p.Number = 649 Then Exit Sub End If - If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If op.Item.IsMail = True Then Exit Sub End If diff --git a/P3D/Pokemon/Attacks/Dark/Switcheroo.vb b/P3D/Pokemon/Attacks/Dark/Switcheroo.vb index be103383f..48b3f2446 100644 --- a/P3D/Pokemon/Attacks/Dark/Switcheroo.vb +++ b/P3D/Pokemon/Attacks/Dark/Switcheroo.vb @@ -93,10 +93,10 @@ Namespace BattleSystem.Moves.Dark If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" memory") = True AndAlso op.Number = 773 Then CanSwitchItems = False End If - If Not p.Item Is Nothing AndAlso p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If Not p.Item Is Nothing AndAlso p.Item.IsMail = True Then CanSwitchItems = False End If - If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If Not op.Item Is Nothing AndAlso op.Item.IsMail = True Then CanSwitchItems = False End If If (p.Item IsNot Nothing AndAlso p.Item.IsMegaStone) OrElse (op.Item IsNot Nothing AndAlso op.Item.IsMegaStone) Then diff --git a/P3D/Pokemon/Attacks/Dark/Thief.vb b/P3D/Pokemon/Attacks/Dark/Thief.vb index 4a08b97a0..a1b0e41d2 100644 --- a/P3D/Pokemon/Attacks/Dark/Thief.vb +++ b/P3D/Pokemon/Attacks/Dark/Thief.vb @@ -79,7 +79,7 @@ If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then Exit Sub End If - If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If op.Item.IsMail = True Then Exit Sub End If diff --git a/P3D/Pokemon/Attacks/Normal/Bestow.vb b/P3D/Pokemon/Attacks/Normal/Bestow.vb index 7df966ee6..bd13f273d 100644 --- a/P3D/Pokemon/Attacks/Normal/Bestow.vb +++ b/P3D/Pokemon/Attacks/Normal/Bestow.vb @@ -86,7 +86,7 @@ If p.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso p.Number = 649 Then b = True End If - If p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If p.Item.IsMail = True Then b = True End If Else diff --git a/P3D/Pokemon/Attacks/Normal/Covet.vb b/P3D/Pokemon/Attacks/Normal/Covet.vb index a0679ae98..86d3c3b48 100644 --- a/P3D/Pokemon/Attacks/Normal/Covet.vb +++ b/P3D/Pokemon/Attacks/Normal/Covet.vb @@ -82,7 +82,7 @@ Namespace BattleSystem.Moves.Normal If op.Item.OriginalName.ToLower().EndsWith(" drive") = True AndAlso op.Number = 649 Then Exit Sub End If - If op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If op.Item.IsMail = True Then Exit Sub End If diff --git a/P3D/Pokemon/Attacks/Psychic/Trick.vb b/P3D/Pokemon/Attacks/Psychic/Trick.vb index aa9ed000d..034602a6e 100644 --- a/P3D/Pokemon/Attacks/Psychic/Trick.vb +++ b/P3D/Pokemon/Attacks/Psychic/Trick.vb @@ -93,10 +93,10 @@ Namespace BattleSystem.Moves.Psychic If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" memory") = True AndAlso op.Number = 773 Then CanSwitchItems = False End If - If Not p.Item Is Nothing AndAlso p.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If Not p.Item Is Nothing AndAlso p.Item.IsMail = True Then CanSwitchItems = False End If - If Not op.Item Is Nothing AndAlso op.Item.OriginalName.ToLower().EndsWith(" mail") = True Then + If Not op.Item Is Nothing AndAlso op.Item.IsMail = True Then CanSwitchItems = False End If If (p.Item IsNot Nothing AndAlso p.Item.IsMegaStone) OrElse (op.Item IsNot Nothing AndAlso op.Item.IsMegaStone) Then diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index 921798134..4c0c605db 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -6,83 +6,129 @@ Dim scrollIndex 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 = "" Public Sub New(ByVal currentScreen As Screen) Me.PreScreen = currentScreen Me.Identification = Identifications.MailSystemScreen - Me.MouseVisible = False + Me.MouseVisible = True Me.CanBePaused = True Me.CanMuteAudio = False Me.CanChat = False End Sub Public Overrides Sub Draw() - Canvas.DrawRectangle(Core.windowSize, Color.White) - Core.SpriteBatch.DrawString(FontManager.InGameFont, "Inbox", New Vector2(42, 28), Color.Black) - Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(32, 64, 320, 576)) + Dim backSize As New Size(windowSize.Width, windowSize.Height) + Dim origSize As New Size(380, 210) + Dim aspectRatio As Single = CSng(origSize.Width / origSize.Height) - Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(400, 64, 672, 576)) + backSize.Width = CInt(windowSize.Width * aspectRatio) + backSize.Height = CInt(backSize.Width / aspectRatio) + + If backSize.Width > backSize.Height Then + backSize.Width = windowSize.Width + backSize.Height = CInt(windowSize.Width / aspectRatio) + Else + backSize.Height = windowSize.Height + backSize.Width = CInt(windowSize.Height / aspectRatio) + End If + If backSize.Height < windowSize.Height Then + backSize.Height = windowSize.Height + backSize.Width = CInt(windowSize.Height / origSize.Height * origSize.Width) + End If + + Dim background As Texture2D = TextureManager.GetTexture("GUI\Menus\MailboxBackground") + + Core.SpriteBatch.Draw(background, New Rectangle(0, 0, backSize.Width, backSize.Height), Color.White) + Canvas.DrawRectangle(New Rectangle(32, 16, 240, 48), New Color(255, 255, 255, 224)) + Canvas.DrawRectangle(New Rectangle(48, 64 - 2, 208, 2), Color.DarkGray) + + Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", New Vector2(56, 24), Color.Black) + Canvas.DrawRectangle(New Rectangle(32, 64, 352, 624), 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 If i = 0 Then - DrawMail(Nothing, New Vector2(46, 82 + (i - scrollIndex) * 64), i) + DrawMail(Nothing, New Vector2(42, 78 + (i - scrollIndex) * 64), i) Else If i <= Core.Player.Mails.Count Then - DrawMail(Core.Player.Mails(i - 1), New Vector2(46, 82 + (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 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 DrawCurrentMail() End If + If MenuVisible = True Then + DrawMenuEntries() + End If + If message <> "" Then Canvas.DrawRectangle(Core.windowSize, New Color(0, 0, 0, 150)) - Dim t As String = message.CropStringToWidth(FontManager.InGameFont, 800) + Dim t As String = message.CropStringToWidth(FontManager.MainFont, 800) - Core.SpriteBatch.DrawString(FontManager.InGameFont, t, New Vector2(CSng(Core.windowSize.Width / 2 - FontManager.InGameFont.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 Sub Private Sub DrawMail(ByVal mail As Items.MailItem.MailData, ByVal P As Vector2, ByVal i As Integer) + If i = 0 Then - Dim x As Integer = 0 - Dim y As Integer = 0 + Dim x As Integer = 16 + Dim y As Integer = 16 If i = Me.index Then - y = 48 + x = 80 + y = 72 Else If i = selectIndex Then - y = 0 x = 48 + y = 72 End If End If - Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 1, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32)) - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black) + 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) + 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 Dim item As Item = Item.GetItemByID(mail.MailID.ToString) - Dim x As Integer = 0 - Dim y As Integer = 0 + Dim x As Integer = 16 + Dim y As Integer = 16 If i = Me.index Then - y = 48 + x = 80 + y = 72 Else If i = selectIndex Then - y = 0 x = 48 + y = 72 End If End If - Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(x, y, 48, 48), ""), 1, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32)) - Core.SpriteBatch.Draw(item.Texture, New Rectangle(CInt(P.X), CInt(P.Y), 48, 48), Color.White) + 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) + 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.MiniFont, 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 Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment) @@ -90,7 +136,7 @@ End If 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 Sub @@ -113,74 +159,115 @@ c = Color.Gray End If - Core.SpriteBatch.DrawString(FontManager.InGameFont, "Header: " & mail.MailHeader, New Vector2(480, 92), c) + Core.SpriteBatch.DrawString(FontManager.MainFont, "Header: " & mail.MailHeader, New Vector2(480, 92), c) Canvas.DrawRectangle(New Rectangle(420, 140, 660, 2), Color.DarkGray) - Dim text As String = ("Text: (" & mail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & mail.MailText.Replace("
", Environment.NewLine)).CropStringToWidth(FontManager.MiniFont, 600) + Dim text As String = ("Text: (" & mail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & mail.MailText.Replace("
", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600) If EditMailIndex = 1 Then c = Color.Blue text &= "_" Else c = Color.Gray End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, text, New Vector2(430, 160), c) + Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(430, 160), c) - Dim yPlus As Integer = CInt(FontManager.MiniFont.MeasureString(text).Y) + Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y) If EditMailIndex = 2 Then c = Color.Blue Else c = Color.Gray End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Signature: " & mail.MailSignature, New Vector2(430, yPlus + 200), c) + Core.SpriteBatch.DrawString(FontManager.MainFont, "Signature: " & mail.MailSignature, New Vector2(430, yPlus + 200), c) Canvas.DrawRectangle(New Rectangle(420, yPlus + 240, 660, 2), Color.DarkGray) - Core.SpriteBatch.DrawString(FontManager.MiniFont, "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 - 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 - 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 - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Attach", New Vector2(496, yPlus + 334), 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 - 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 - 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 - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Cancel", New Vector2(696, yPlus + 334), 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 Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1) Dim item As Item = Item.GetItemByID(mail.MailID.ToString) Core.SpriteBatch.Draw(item.Texture, New Rectangle(420, 84, 48, 48), Color.White) - Core.SpriteBatch.DrawString(FontManager.InGameFont, mail.MailHeader, New Vector2(480, 92), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(480, 92), Color.Black) Canvas.DrawRectangle(New Rectangle(420, 140, 660, 2), Color.DarkGray) - Dim text As String = ("Text: " & Environment.NewLine & Environment.NewLine & mail.MailText).CropStringToWidth(FontManager.MiniFont, 600) - Core.SpriteBatch.DrawString(FontManager.MiniFont, text, New Vector2(430, 160), Color.Black) + Dim text As String = mail.MailText.CropStringToWidth(FontManager.MainFont, 600) + Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(430, 160), Color.Black) - Dim yPlus As Integer = CInt(FontManager.MiniFont.MeasureString(text).Y) + Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y) - Core.SpriteBatch.DrawString(FontManager.MiniFont, mail.MailSignature, New Vector2(430, yPlus + 200), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailSignature, New Vector2(430, yPlus + 200), Color.Black) Canvas.DrawRectangle(New Rectangle(420, yPlus + 240, 660, 2), Color.DarkGray) - Core.SpriteBatch.DrawString(FontManager.MiniFont, "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 mail.MailAttachment > -1 Then Canvas.DrawRectangle(New Rectangle(420, yPlus + 300, 660, 2), Color.DarkGray) Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment) - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Trophy:", New Vector2(430, yPlus + 320), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, "Trophy:", New Vector2(430, yPlus + 320), Color.Black) Core.SpriteBatch.Draw(t.Texture, New Rectangle(430, yPlus + 340, 64, 64), Color.White) - Core.SpriteBatch.DrawString(FontManager.MiniFont, (t.Name & Environment.NewLine & Environment.NewLine & t.Description).CropStringToWidth(FontManager.MiniFont, 500), New Vector2(510, yPlus + 340), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, (t.Name & Environment.NewLine & Environment.NewLine & t.Description).CropStringToWidth(FontManager.MainFont, 500), New Vector2(510, yPlus + 340), Color.Black) End If + + If EditMailIndex = 0 Then + 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 + 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 + 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 + 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 + 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 + 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 Sub @@ -191,110 +278,376 @@ End If Exit Sub - End If + 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) - If index <> 0 Then - If Controls.Down(True, True, True, True, True) = True Then - Me.selectIndex += 1 - If Me.selectIndex = Me.index And Me.selectIndex < Core.Player.Mails.Count Then - Me.selectIndex += 1 + m.Update(Me) + End If + Next + + If Controls.Up(True, True) = True Then + Me.MenuCursor -= 1 End If - End If - If Controls.Up(True, True, True, True, True) = True Then - Me.selectIndex -= 1 - If Me.selectIndex = Me.index And Me.selectIndex > 0 Then - Me.selectIndex -= 1 + If Controls.Down(True, True) = True Then + Me.MenuCursor += 1 End If - End If - selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count) + Dim maxIndex As Integer = 0 + Dim minIndex As Integer = 100 - While selectIndex - scrollIndex > 8 - scrollIndex += 1 - End While + 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 - While selectIndex - scrollIndex < 0 - scrollIndex -= 1 - End While + If Me.MenuCursor > maxIndex Then + Me.MenuCursor = minIndex + ElseIf Me.MenuCursor < minIndex Then + Me.MenuCursor = maxIndex + End If - If Controls.Accept(True, True, True) = True Then - If Me.selectIndex = 0 Then - Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing) - selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection - selScreen.CanExit = True + Else - AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler - Core.SetScreen(selScreen) - Else - If Me.index = Me.selectIndex Then - Me.index = -1 + If index <> 0 Then + If index > -1 Then + + Dim pressedSystemKey As Boolean = False + If Controls.Down(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = False Then + EditMailIndex += 1 + End If + If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then + EditMailIndex -= 1 + End If + If Controls.Left(True, True, False, True, True) = True Then + EditMailIndex -= 1 + End If + If Controls.Right(True, True, False, True, True) = True Then + EditMailIndex += 1 + End If + + EditMailIndex = EditMailIndex.Clamp(0, 2) + + If Controls.Accept(False, True, True) = True Then + + Select Case EditMailIndex + Case 0 + Me.TempNewMail = Core.Player.Mails(Me.index - 1) + 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} + AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler + + Core.SetScreen(selScreen) + 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 + EditMailIndex = 0 + End Select + End If + + Dim text As String = Core.Player.Mails(index - 1).MailText.CropStringToWidth(FontManager.MainFont, 600) + Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y) + + If Controls.Accept(True, False, False) = True Then + Dim MailIndex As Integer = -1 + For i = 0 To 8 + If i < Core.Player.Mails.Count + 1 Then + If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then + MailIndex = scrollIndex + i + Exit For + End If + Else + If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 1 + Exit For + End If + End If + Next + If MailIndex <> -1 Then + selectIndex = MailIndex + If Me.selectIndex = 0 Then + Me.index = -1 + SoundManager.PlaySound("select") + Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing) + selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection + selScreen.CanExit = True + + AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler + Core.SetScreen(selScreen) + Else + SoundManager.PlaySound("select") + If Me.index = Me.selectIndex Then + Me.index = -1 + Else + Me.index = Me.selectIndex + + Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1) + Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText} + End If + End If + Else + + If New Rectangle(440, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 0 + Me.TempNewMail = Core.Player.Mails(Me.index - 1) + 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} + AddHandler selScreen.SelectedObject, AddressOf ChosenPokemonHandler + + Core.SetScreen(selScreen) + 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 + EditMailIndex = 0 + End If + End If + End If + + If Controls.Dismiss(True, True, True) = True Then + SoundManager.PlaySound("select") + Me.index = -1 + + End If Else - Me.index = Me.selectIndex - Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1) - Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText} + If Controls.Down(True, True, True, True, True) = True Then + Me.selectIndex += 1 + If Me.selectIndex = Me.index And Me.selectIndex < Core.Player.Mails.Count Then + Me.selectIndex += 1 + End If + End If + If Controls.Up(True, True, True, True, True) = True Then + Me.selectIndex -= 1 + If Me.selectIndex = Me.index And Me.selectIndex > 0 Then + Me.selectIndex -= 1 + End If + End If + + selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count) + + While selectIndex - scrollIndex > 8 + scrollIndex += 1 + End While + + While selectIndex - scrollIndex < 0 + scrollIndex -= 1 + End While + + If Controls.Accept(False, True, True) = True Then + If Me.selectIndex = 0 Then + SoundManager.PlaySound("select") + Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing) + selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection + selScreen.CanExit = True + + AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler + Core.SetScreen(selScreen) + Else + SoundManager.PlaySound("select") + If Me.index = Me.selectIndex Then + Me.index = -1 + Else + Me.index = Me.selectIndex + + Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1) + Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText} + End If + End If + End If + If Controls.Accept(True, False, False) Then + Dim MailIndex As Integer = -1 + For i = 0 To 8 + If i < Core.Player.Mails.Count + 1 Then + If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then + MailIndex = scrollIndex + i + Exit For + End If + End If + Next + If MailIndex <> -1 Then + selectIndex = MailIndex + If Me.selectIndex = 0 Then + SoundManager.PlaySound("select") + Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {5}, 5, Nothing) + selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection + selScreen.CanExit = True + + AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler + Core.SetScreen(selScreen) + Else + SoundManager.PlaySound("select") + If Me.index = Me.selectIndex Then + Me.index = -1 + Else + Me.index = Me.selectIndex + + Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1) + Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText} + End If + End If + End If + + End If + + If Controls.Dismiss(True, True, True) = True Then + SoundManager.PlaySound("select") + Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.Black, False)) + End If + End If + Else + Dim pressedSystemKey As Boolean = False + If Controls.Down(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = False Then + EditMailIndex += 1 + pressedSystemKey = True + End If + If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then + EditMailIndex -= 1 + pressedSystemKey = True + End If + If Controls.Left(True, True, False, False, False) = True Then + pressedSystemKey = True + If EditMailIndex = 4 Or EditMailIndex = 5 Then + EditMailIndex -= 1 + End If + End If + If Controls.Right(True, True, False, False, False) = True Then + pressedSystemKey = True + If EditMailIndex = 3 Or EditMailIndex = 4 Then + EditMailIndex += 1 + End If + End If + If Controls.Left(False, False, False, True, True) = True Then + If EditMailIndex = 4 Or EditMailIndex = 5 Then + EditMailIndex -= 1 + End If + End If + If Controls.Right(False, False, False, True, True) = True Then + If EditMailIndex = 3 Or EditMailIndex = 4 Then + EditMailIndex += 1 + End If + End If + + EditMailIndex = EditMailIndex.Clamp(0, 4) + + If pressedSystemKey = False Then + Select Case EditMailIndex + Case 0 + KeyBindings.GetInput(TempNewMail.MailHeader, 25, True, True) + TempNewMail.MailHeader = TempNewMail.MailHeader.Replace("\,", ",").Replace(Environment.NewLine, "").Replace("|", "/") + Case 1 + KeyBindings.GetInput(TempNewMail.MailText, 200, True, True) + TempNewMail.MailText = TempNewMail.MailText.Replace("\,", ",").Replace(Environment.NewLine, "
").Replace("|", "/") + Case 2 + KeyBindings.GetInput(TempNewMail.MailSignature, 25, True, True) + TempNewMail.MailSignature = TempNewMail.MailSignature.Replace("\,", ",").Replace(Environment.NewLine, "").Replace("|", "/") + End Select + End If + + If Controls.Accept(False, True, True) = True Then + Select Case EditMailIndex + Case 3 + SoundManager.PlaySound("select") + If TempNewMail.MailHeader = "" Or TempNewMail.MailText = "" Or TempNewMail.MailSignature = "" Then + message = "Please fill in the Header, the Message and the Signature." + Else + 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 + + Core.SetScreen(selScreen) + End If + Case 4 + SoundManager.PlaySound("select") + Me.index = -1 + EditMailIndex = 0 + End Select + End If + + Dim text As String = ("Text: (" & TempNewMail.MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & TempNewMail.MailText.Replace("
", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600) + Dim yPlus As Integer = CInt(FontManager.MainFont.MeasureString(text).Y) + + If Controls.Accept(True, False, False) = True Then + Dim MailIndex As Integer = -1 + For i = 0 To 8 + If i < Core.Player.Mails.Count + 1 Then + If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then + MailIndex = scrollIndex + i + Exit For + End If + Else + If New Rectangle(46, 82 + 64 * i + 2 * (i - scrollIndex), 288, 64).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 4 + Exit For + End If + End If + Next + If MailIndex <> -1 Then + selectIndex = MailIndex + SoundManager.PlaySound("select") + If Me.selectIndex = 0 Then + Me.index = -1 + Else + Me.index = Me.selectIndex + + Dim m As Items.MailItem.MailData = Core.Player.Mails(Me.index - 1) + Core.Player.Mails(Me.index - 1) = New Items.MailItem.MailData With {.MailHeader = m.MailHeader, .MailID = m.MailID, .MailOriginalTrainerOT = m.MailOriginalTrainerOT, .MailAttachment = m.MailAttachment, .MailRead = True, .MailSender = m.MailSender, .MailSignature = m.MailSignature, .MailText = m.MailText} + End If + End If + If New Rectangle(420, 92, 660, 40).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 0 + End If + If New Rectangle(420, 140, 660, yPlus + 20).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 1 + End If + If New Rectangle(420, yPlus + 200, 660, 40).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 2 + End If + If New Rectangle(440, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 3 + End If + If New Rectangle(640, yPlus + 320, 192, 64).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 4 + End If + + Select Case EditMailIndex + Case 3 + SoundManager.PlaySound("select") + If TempNewMail.MailHeader = "" Or TempNewMail.MailText = "" Or TempNewMail.MailSignature = "" Then + message = "Please fill in the Header, the Message and the Signature." + Else + 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 + + Core.SetScreen(selScreen) + End If + Case 4 + SoundManager.PlaySound("select") + Me.index = -1 + EditMailIndex = 0 + End Select + End If + + If Controls.Dismiss(True, False, True) = True Then + Me.index = -1 + SoundManager.PlaySound("select") End If End If End If - - If Controls.Dismiss(True, True, True) = True Then - SoundManager.PlaySound("select") - If Me.index <> -1 Then - Me.index = -1 - Else - Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.White, False)) - End If - End If - Else - Dim pressedSystemKey As Boolean = False - If Controls.Down(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = False Then - EditMailIndex += 1 - pressedSystemKey = True - End If - If Controls.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then - EditMailIndex -= 1 - pressedSystemKey = True - End If - If Controls.Left(True, True, False, False, False) = True Or Controls.Right(True, True, False, False, False) = True Then - pressedSystemKey = True - End If - - EditMailIndex = EditMailIndex.Clamp(0, 4) - - If pressedSystemKey = False Then - Select Case EditMailIndex - Case 0 - KeyBindings.GetInput(TempNewMail.MailHeader, 25, True, True) - TempNewMail.MailHeader = TempNewMail.MailHeader.Replace("\,", ",").Replace(Environment.NewLine, "").Replace("|", "/") - Case 1 - KeyBindings.GetInput(TempNewMail.MailText, 200, True, True) - TempNewMail.MailText = TempNewMail.MailText.Replace("\,", ",").Replace(Environment.NewLine, "
").Replace("|", "/") - Case 2 - KeyBindings.GetInput(TempNewMail.MailSignature, 25, True, True) - TempNewMail.MailSignature = TempNewMail.MailSignature.Replace("\,", ",").Replace(Environment.NewLine, "").Replace("|", "/") - End Select - End If - - If Controls.Accept(True, True, True) = True Then - Select Case EditMailIndex - Case 3 - If TempNewMail.MailHeader = "" Or TempNewMail.MailText = "" Or TempNewMail.MailSignature = "" Then - message = "Please fill in the Header, the Message and the Signature." - Else - 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 - - Core.SetScreen(selScreen) - End If - Case 4 - Me.index = -1 - End Select - End If - - If Controls.Dismiss(True, False, True) = True Then - Me.index = -1 - SoundManager.PlaySound("select") - End If End If End Sub @@ -321,24 +674,33 @@ End Sub Private Sub ChosenPokemon(ByVal PokeIndex As Integer) + Dim text As String = "Attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "." If Not Core.Player.Pokemons(PokeIndex).Item Is Nothing Then If Core.Player.Pokemons(PokeIndex).Item.IsGameModeItem Then Core.Player.Inventory.AddItem(Core.Player.Pokemons(PokeIndex).Item.gmID, 1) Else Core.Player.Inventory.AddItem(Core.Player.Pokemons(PokeIndex).Item.ID.ToString, 1) End If - + text = "Taken " & Core.Player.Pokemons(PokeIndex).Item.Name & " from " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & ", and attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "." End If Core.Player.Pokemons(PokeIndex).Item = Item.GetItemByID(TempNewMail.MailID.ToString) Core.Player.Pokemons(PokeIndex).Item.AdditionalData = Items.MailItem.GetStringFromMail(TempNewMail) - Core.Player.Inventory.RemoveItem(TempNewMail.MailID.ToString, 1) + If index = 0 Then + Core.Player.Inventory.RemoveItem(TempNewMail.MailID.ToString, 1) + Else + Core.Player.Mails.RemoveAt(Me.index - 1) + selectIndex -= 1 + selectIndex = selectIndex.Clamp(0, Core.Player.Mails.Count) + End If Me.index = -1 - Me.message = "Attached the Mail to " & Core.Player.Pokemons(PokeIndex).GetDisplayName() & "." + Me.message = text End Sub + + #Region "Trophies" Public Structure TrophyInformation @@ -379,4 +741,93 @@ #End Region -End Class \ No newline at end of file +#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 diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb index b9bbd4aee..07b225a4a 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb @@ -207,7 +207,7 @@ CanContinue = False 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 diff --git a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb index 9430ec09a..20450a68f 100644 --- a/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb +++ b/P3D/World/ActionScript/V2/ScriptConstructs/DoPokemon.vb @@ -246,6 +246,24 @@ data = Core.Player.Pokemons(index).Item.AdditionalData End If Return data + Case "mailsendername" + Dim index As Integer = int(argument) + Dim name As String = "" + If Not Core.Player.Pokemons(index).Item Is Nothing Then + If Core.Player.Pokemons(index).Item.IsMail Then + name = Core.Player.Pokemons(index).Item.AdditionalData.GetSplit(1, "\,") + End If + End If + Return name + Case "mailsenderot" + Dim index As Integer = int(argument) + Dim ot As String = "" + If Not Core.Player.Pokemons(index).Item Is Nothing Then + If Core.Player.Pokemons(index).Item.IsMail Then + ot = Core.Player.Pokemons(index).Item.AdditionalData.GetSplit(6, "\,") + End If + End If + Return ot Case "counthalloffame" Return HallOfFameScreen.GetHallOfFameCount() Case "learnedtutormove" diff --git a/P3D/World/ActionScript/V2/ScriptLibrary.vb b/P3D/World/ActionScript/V2/ScriptLibrary.vb index 5709ee53b..ebcf42dd3 100644 --- a/P3D/World/ActionScript/V2/ScriptLibrary.vb +++ b/P3D/World/ActionScript/V2/ScriptLibrary.vb @@ -823,6 +823,8 @@ Namespace ScriptVersion2 r(New ScriptCommand("pokemon", "maxhp", "int", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the Maximum Hit Points of a Pokémon in the player's party.", ",", True)) r(New ScriptCommand("pokemon", "isegg", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the Pokémon in the players party is an Egg.", ",", True)) r(New ScriptCommand("pokemon", "additionaldata", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the additional data for the Pokémon in the player's party.", ",", True)) + r(New ScriptCommand("pokemon", "mailsendername", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the name of the sender of a mail if there's one on the Pokémon in the player's party.", ",", True)) + r(New ScriptCommand("pokemon", "mailsenderot", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the OT of the sender of a mail if there's one on the Pokémon in the player's party.", ",", True)) r(New ScriptCommand("pokemon", "nickname", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the nickname of a Pokémon in the player's party.", ",", True)) r(New ScriptCommand("pokemon", "hasnickname", "bool", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if a Pokémon in the player's party has a nickname.", ",", True)) r(New ScriptCommand("pokemon", "name", "str", {New ScriptArgument("pokemonIndex", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns the name of a Pokémon in the player's party.", ",", True))