From 5ed44da99b2570de2a6632f9b9e95437a2a478e9 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 23 Jul 2023 20:53:21 +0200 Subject: [PATCH 1/7] Mail system progress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made it possible to attach already written mail to a pokémon Added a taken item message if the pokémon that the mail gets attached to already has an item Replaced the MiniFont and InGameFont on the mail screen with MainFont Working on mouse support --- P3D/Content/Data/Scripts/computer_choose.dat | 6 +- P3D/Pokemon/Attacks/Dark/KnockOff.vb | 4 +- P3D/Pokemon/Attacks/Dark/Switcheroo.vb | 4 +- P3D/Pokemon/Attacks/Dark/Thief.vb | 2 +- P3D/Pokemon/Attacks/Normal/Bestow.vb | 2 +- P3D/Pokemon/Attacks/Normal/Covet.vb | 2 +- P3D/Pokemon/Attacks/Psychic/Trick.vb | 4 +- P3D/Screens/PC/MailSystemScreen.vb | 289 ++++++++++++++----- 8 files changed, 232 insertions(+), 81 deletions(-) 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/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..ce797bbc5 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -12,7 +12,7 @@ Me.PreScreen = currentScreen Me.Identification = Identifications.MailSystemScreen - Me.MouseVisible = False + Me.MouseVisible = True Me.CanBePaused = True Me.CanMuteAudio = False Me.CanChat = False @@ -21,7 +21,7 @@ Public Overrides Sub Draw() Canvas.DrawRectangle(Core.windowSize, Color.White) - Core.SpriteBatch.DrawString(FontManager.InGameFont, "Inbox", New Vector2(42, 28), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", 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)) Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 2, New Rectangle(400, 64, 672, 576)) @@ -44,9 +44,9 @@ 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 @@ -64,7 +64,7 @@ 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.DrawString(FontManager.MainFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black) Else Dim item As Item = Item.GetItemByID(mail.MailID.ToString) @@ -82,7 +82,7 @@ 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.DrawString(FontManager.MiniFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black) + Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black) If mail.MailAttachment > -1 Then Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment) @@ -113,74 +113,88 @@ 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)) Else Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Attach", New Vector2(496, yPlus + 334), Color.Black) + 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) 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)) Else Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, "Cancel", New Vector2(696, yPlus + 334), Color.Black) + 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) 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 = ("Text: " & Environment.NewLine & Environment.NewLine & 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 + Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 48, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) + Else + Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(440, yPlus + 320, 160, 32)) + 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) + + 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)) + Else + Canvas.DrawImageBorder(TextureManager.GetTexture("GUI\Menus\Menu", New Rectangle(0, 0, 48, 48), ""), 1, New Rectangle(640, yPlus + 320, 160, 32)) + 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) End If End Sub @@ -194,54 +208,123 @@ End If 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 + 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 - 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.Up(True, True, True, False, True) = True Or KeyBoardHandler.KeyPressed(Keys.Tab) = True And Controls.ShiftDown() = True Then + EditMailIndex -= 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(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 - - AddHandler selScreen.SelectedObject, AddressOf ChosenMailHandler - Core.SetScreen(selScreen) - Else - 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} + If Controls.Left(True, True, False, False, False) = True Then + If EditMailIndex = 1 Then + EditMailIndex -= 1 + End If + End If + If Controls.Right(True, True, False, False, False) = True Then + If EditMailIndex = 0 Then + EditMailIndex += 1 End If End If - End If - If Controls.Dismiss(True, True, True) = True Then - SoundManager.PlaySound("select") - If Me.index <> -1 Then + EditMailIndex = EditMailIndex.Clamp(0, 1) + + If Controls.Accept(False, True, True) = True Then + + If EditMailIndex = 0 Then + 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) + Else + Me.index = -1 + EditMailIndex = 0 + + End If + End If + + Dim text As String = ("Text: (" & Core.Player.Mails(Me.index - 1).MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & Core.Player.Mails(Me.index - 1).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 + If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then + 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) + 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) + Else + Me.index = -1 + EditMailIndex = 0 + + End If + End If + + If Controls.Dismiss(True, True, True) = True Then + SoundManager.PlaySound("select") Me.index = -1 - Else + + End If + Else + + 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(True, 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.Dismiss(True, True, True) = True Then + SoundManager.PlaySound("select") Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.White, False)) End If End If @@ -255,8 +338,27 @@ 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 + If Controls.Left(True, True, False, False, False) = True Then pressedSystemKey = True + If EditMailIndex = 4 Then + EditMailIndex -= 1 + End If + End If + If Controls.Right(True, True, False, False, False) = True Then + pressedSystemKey = True + If EditMailIndex = 3 Then + EditMailIndex += 1 + End If + End If + If Controls.Left(False, False, True, True, True) = True Then + If EditMailIndex = 1 Then + EditMailIndex -= 1 + End If + End If + If Controls.Right(False, False, True, True, True) = True Then + If EditMailIndex = 0 Then + EditMailIndex += 1 + End If End If EditMailIndex = EditMailIndex.Clamp(0, 4) @@ -275,9 +377,10 @@ End Select End If - If Controls.Accept(True, True, True) = True Then + 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 @@ -287,7 +390,48 @@ Core.SetScreen(selScreen) End If Case 4 + SoundManager.PlaySound("select") Me.index = -1 + EditMailIndex = 0 + End Select + End If + + Dim rect As Rectangle = New Rectangle(400, 64, 672, 576) + 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 + 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, 160, 32).Contains(MouseHandler.MousePosition) Then + EditMailIndex = 3 + End If + If New Rectangle(640, yPlus + 320, 160, 32).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 @@ -321,22 +465,29 @@ 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" From 9749ba72bc7c795f6e1bdee848591318e1d1a958 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Mon, 24 Jul 2023 16:22:44 +0200 Subject: [PATCH 2/7] Mouse support added to mailscreen --- P3D/Screens/PC/MailSystemScreen.vb | 134 +++++++++++++++++++++++++---- 1 file changed, 116 insertions(+), 18 deletions(-) diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index ce797bbc5..36bbc6585 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -162,7 +162,7 @@ Canvas.DrawRectangle(New Rectangle(420, 140, 660, 2), Color.DarkGray) - Dim text As String = ("Text: " & Environment.NewLine & Environment.NewLine & mail.MailText).CropStringToWidth(FontManager.MainFont, 600) + 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.MainFont.MeasureString(text).Y) @@ -246,28 +246,67 @@ End If End If - Dim text As String = ("Text: (" & Core.Player.Mails(Me.index - 1).MailText.Length & "/" & 200 & ")" & Environment.NewLine & Environment.NewLine & Core.Player.Mails(Me.index - 1).MailText.Replace("
", Environment.NewLine)).CropStringToWidth(FontManager.MainFont, 600) + 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 - If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then - EditMailIndex = 0 - End If - If New Rectangle(640, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then - EditMailIndex = 1 - End If + 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, 288, 64).Contains(MouseHandler.MousePosition) Then + MailIndex = scrollIndex + i + Exit For + End If + Else + If New Rectangle(46, 82 + 64 * i, 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 - If EditMailIndex = 0 Then - 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 + 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 - Core.SetScreen(selScreen) + 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 - Me.index = -1 - EditMailIndex = 0 + If New Rectangle(440, yPlus + 320, 160, 32).Contains(MouseHandler.MousePosition) Then + 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) + 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) + Else + Me.index = -1 + EditMailIndex = 0 + + End If End If End If @@ -301,7 +340,7 @@ scrollIndex -= 1 End While - If Controls.Accept(True, True, True) = True Then + 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) @@ -322,6 +361,40 @@ 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, 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") @@ -396,11 +469,36 @@ End Select End If - Dim rect As Rectangle = New Rectangle(400, 64, 672, 576) 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, 288, 64).Contains(MouseHandler.MousePosition) Then + MailIndex = scrollIndex + i + Exit For + End If + Else + If New Rectangle(46, 82 + 64 * i, 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 From 970feaefbc5dca769b6c1f289d4b8d6cdb7f5057 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Mon, 24 Jul 2023 19:47:26 +0200 Subject: [PATCH 3/7] Progress trying to make mailscreen prettier --- P3D/Content/GUI/Menus/MailMenuBackground.png | Bin 0 -> 3160 bytes P3D/P3D.vbproj | 3 ++ P3D/Screens/PC/MailSystemScreen.vb | 38 +++++++++++++++---- 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 P3D/Content/GUI/Menus/MailMenuBackground.png diff --git a/P3D/Content/GUI/Menus/MailMenuBackground.png b/P3D/Content/GUI/Menus/MailMenuBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..64bffb2945bffc3ed55d611c984427b9d65553f7 GIT binary patch literal 3160 zcmbVPXH*kd8jZk8F%SlIECB+e7z={TFu>3vAR-J!2?|PyfQmFJ0hN+Oq{MM4I)Eq$ z5tINT1f&K+f+Czs&Fq}E1js-D37{LT z@<-{iQurI-tGGWSz5>1^{x_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I_+?7$e7C^SX$mA z3P1IKe;CJhw-&cChL`KZC{sztLynKY&EOk#%ur&?hBjx@P>>Ad8;^FwR~8eY`f^Z! zjm)N^*hripejK-`ffyUDMAx{MxgBgEj0%>=dMfe@-414tAXtn;*$%~;4z z3`>xnbXmu(BgoBhy2y=oo$h;wJ?lx{-D?S;)_X1_we|mSk$+h|Df~@AUrgiwa+}|n z#;*nb-fezmWWOrmPsMM5FO|t4=(7I@rxxcQmVaO8H*#8u64|rn0!tM?V2AWq0I;`p LK2~Xc{^q{`=3z4h literal 0 HcmV?d00001 diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 8a9d58edf..5630a5f5f 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -11033,6 +11033,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index 36bbc6585..caadbd201 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -19,19 +19,41 @@ End Sub Public Overrides Sub Draw() - Canvas.DrawRectangle(Core.windowSize, Color.White) - Core.SpriteBatch.DrawString(FontManager.MainFont, "Mailbox", 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\MailMenuBackground") + + Core.SpriteBatch.Draw(background, New Rectangle(0, 0, backSize.Width, backSize.Height), Color.White) + Canvas.DrawRectangle(New Rectangle(32, 16, 240, 48), Color.White) + + 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(400, 64, 704, 592), 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), i) End If End If Next @@ -63,7 +85,7 @@ 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)) + 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.DrawString(FontManager.MainFont, "Write new mail.", New Vector2(CInt(P.X) + 13, CInt(P.Y) + 14), Color.Black) Else Dim item As Item = Item.GetItemByID(mail.MailID.ToString) @@ -79,7 +101,7 @@ 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)) + 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(item.Texture, New Rectangle(CInt(P.X), CInt(P.Y), 48, 48), Color.White) Core.SpriteBatch.DrawString(FontManager.MainFont, mail.MailHeader, New Vector2(CInt(P.X) + 52, CInt(P.Y) + 14), Color.Black) From fdcbdfa62b1f7a521f8cd3bd93f3155019357ced Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 25 Jul 2023 12:48:43 +0200 Subject: [PATCH 4/7] Add mail delete menu + modern buttons --- P3D/Content/GUI/Menus/General.png | Bin 10071 -> 2491 bytes ...nuBackground.png => MailboxBackground.png} | Bin P3D/P3D.vbproj | 2 +- P3D/Screens/PC/MailSystemScreen.vb | 891 +++++++++++------- .../V2/ScriptCommands/DoScreen.vb | 2 +- 5 files changed, 537 insertions(+), 358 deletions(-) rename P3D/Content/GUI/Menus/{MailMenuBackground.png => MailboxBackground.png} (100%) diff --git a/P3D/Content/GUI/Menus/General.png b/P3D/Content/GUI/Menus/General.png index 654793d7268fc3d53472ce7a736e0a75bf7cb7d3..9470cb5d5482f379c22aa5a2397d79c00b9dc47e 100644 GIT binary patch literal 2491 zcmX9=c|4Tc8-L#Mju~ScBAUdYZYYwaxTLW**_vok)+{N;oh%hy%R6*+$u0LZ81;Zp9lbbf zr!h3SPrso#=%lyz`E&g@hUQmO(}!*}_l5NvblnI%8SUSEvnY9HW{Ws~r1bCJspmfp z5|+~!#@Y2##n-3Ao%RwhY21%x9wru-g_U`EN?MT^N`Lc#<=~LghVTv=NyFAeQTUXY zAdi_TRcC6b5un`vd!paEbunn>%FL<7D30gR)tKqN-8rf|gdxwwjf`nNf5M|d>-(>M z!h{p6$`5Y!b@_ZRA#yb%W*4XOuk&maTF*!u@ zvO`+i7heSDPZ1z2eMj7GwL%IMnN;ZwME869l&3DH(l{q8lP1*&bY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d4&UUUM@ks@k_#UGco$b+3Lw_gf*-EV5*yX!YzJYMO~@PJ@IZu<9Yd}_~!a{Ntg z)cT0@i!-`8?Zqq|07wZg1IUEHTBf1S9ENSPsD>E)JnK66+Feda)k*3f@%agq005C7 zTsWQJ6efw5bZDh8hfM(ZYV}pY6${AJV=53Q?LS&FfWl`;GE)8UT$3d)3Iw+^41xvv z@s^^6e+xv;#O)zV@@Pg8L)-Mxt>X*V0)&GkAf#auynz4593{*J4kgS1fD4!h&;fub zVG_W9wj2Oea7+l;3II?QTm|BPfD#-C7ZCnG#eaYnfF=l-3X9D@l&=U*0Gw3o6(xzH z22F{cl>)z O0TgA`Wa^~MBmNKH=|ao^ diff --git a/P3D/Content/GUI/Menus/MailMenuBackground.png b/P3D/Content/GUI/Menus/MailboxBackground.png similarity index 100% rename from P3D/Content/GUI/Menus/MailMenuBackground.png rename to P3D/Content/GUI/Menus/MailboxBackground.png diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 5630a5f5f..a6439cdbb 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -11033,7 +11033,7 @@ PreserveNewest - + PreserveNewest diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index caadbd201..5c347309d 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -6,6 +6,10 @@ 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) @@ -39,72 +43,91 @@ backSize.Width = CInt(windowSize.Height / origSize.Height * origSize.Width) 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) Canvas.DrawRectangle(New Rectangle(32, 16, 240, 48), Color.White) 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(400, 64, 704, 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, 624), New Color(255, 255, 255, 224)) For i = scrollIndex To scrollIndex + 8 If i = 0 Then 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(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 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.MainFont, 800) 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), ""), 2, New Rectangle(CInt(P.X), CInt(P.Y), 288, 32)) - Core.SpriteBatch.DrawString(FontManager.MainFont, "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), ""), 2, 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.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 Dim t As TrophyInformation = GetTrophyInformation(mail.MailAttachment) @@ -112,7 +135,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 @@ -162,18 +185,26 @@ 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.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 - 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.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 Dim mail As Items.MailItem.MailData = Core.Player.Mails(index - 1) Dim item As Item = Item.GetItemByID(mail.MailID.ToString) @@ -205,18 +236,37 @@ End If 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 - 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.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 - 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.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 Sub @@ -227,337 +277,375 @@ End If Exit Sub - End If - - 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, False, False) = True Then - If EditMailIndex = 1 Then - EditMailIndex -= 1 - End If - End If - If Controls.Right(True, True, False, False, False) = True Then - If EditMailIndex = 0 Then - EditMailIndex += 1 - End If - End If - - EditMailIndex = EditMailIndex.Clamp(0, 1) - - If Controls.Accept(False, True, True) = True Then - - If EditMailIndex = 0 Then - 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) - Else - Me.index = -1 - EditMailIndex = 0 - - End If - 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, 288, 64).Contains(MouseHandler.MousePosition) Then - MailIndex = scrollIndex + i - Exit For - End If - Else - If New Rectangle(46, 82 + 64 * i, 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, 160, 32).Contains(MouseHandler.MousePosition) Then - 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) - 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) - Else - 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 - - 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, 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.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 Then - pressedSystemKey = True - If EditMailIndex = 4 Then - EditMailIndex -= 1 - End If - End If - If Controls.Right(True, True, False, False, False) = True Then - pressedSystemKey = True - If EditMailIndex = 3 Then - EditMailIndex += 1 - End If - End If - If Controls.Left(False, False, True, True, True) = True Then - If EditMailIndex = 1 Then - EditMailIndex -= 1 - End If - End If - If Controls.Right(False, False, True, True, True) = True Then - If EditMailIndex = 0 Then - EditMailIndex += 1 - End If - End If + 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) - 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, 288, 64).Contains(MouseHandler.MousePosition) Then - MailIndex = scrollIndex + i - Exit For - End If - Else - If New Rectangle(46, 82 + 64 * i, 288, 64).Contains(MouseHandler.MousePosition) Then - EditMailIndex = 4 - Exit For - End If + m.Update(Me) 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} + 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 > -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 + + 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 - 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, 160, 32).Contains(MouseHandler.MousePosition) Then - EditMailIndex = 3 - End If - If New Rectangle(640, yPlus + 320, 160, 32).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 Sub @@ -610,6 +698,8 @@ Me.message = text End Sub + + #Region "Trophies" Public Structure TrophyInformation @@ -650,4 +740,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 From af2831673efed09a4bf12cc2f45279d7cd812628 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 25 Jul 2023 14:11:41 +0200 Subject: [PATCH 5/7] Mail sender name and ot constructs --- .../V2/ScriptConstructs/DoPokemon.vb | 18 ++++++++++++++++++ P3D/World/ActionScript/V2/ScriptLibrary.vb | 2 ++ 2 files changed, 20 insertions(+) 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)) From d390e72c69fd5f1d5f14333d3557883d71f3bb0c Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 25 Jul 2023 18:02:07 +0200 Subject: [PATCH 6/7] Route 32 Spearow quest update --- .../Data/Scripts/goldenrod/gate_spearow.dat | Bin 3518 -> 3926 bytes .../Data/Scripts/route31/sleepy_guy.dat | Bin 8416 -> 4366 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat b/P3D/Content/Data/Scripts/goldenrod/gate_spearow.dat index 9e4c19d4deede85550b65e74b976d9af315171b1..f2d5cc300e05568f5906b84d14d2d8f8d2292369 100644 GIT binary patch delta 949 zcmaJ<%}x_x6g|UqhE7W(gn%)mIum0E2?a%rP$7bnxX`#TZcGTKrUjbPj%kZT7y1Bh z7;lVA9>Aq5H||`c8x!Bajp!qIzHfe*X^4yY=AQePd(XLFrhZ&J+!}79h9>rc*0kXS zM-{6@R1dy?H5_?w%uhL};sCp7phN2k|2>pYfCEQ<8uJ$aw2tjdvN$vs7R%1i$H+fs zwi9by4$TKCbYk8~&;|LMTaZ_|LdLTw-*WkkXC*!zN)jYD;vyq`T07-(>?Bwu%LnG4EX4XF)}_A1}eCw6Ru*J))E#XG!qLz z;yrscTsb&8FMWG61fP!WvN5cs!CK&5meKs=%}8iGoDU&Kesr(Pd{-*r^ delta 572 zcmca6w@-RP9B(m00YfT7B0~{FK12D$RCQh}h7yJhpimwIF9X+PMGo;RPUn%uy`1*AiO*oWPiK@)81Y*xw1F|1ZV9YK?Q*c2vsmlp%z{b#f=iR$xGB002zge4PLQ diff --git a/P3D/Content/Data/Scripts/route31/sleepy_guy.dat b/P3D/Content/Data/Scripts/route31/sleepy_guy.dat index 7b2f562dd4f85179359f2a9ee4f547781d94ec96..869c89121366737f83e9ba51673979122afcca78 100644 GIT binary patch literal 4366 zcmeI0U2hXt5QgVANc|7ntAq$51Fh7e5F(We5Tr#FQdMq{6Pwt=StGB52^apq{0YkY zobhBoyqm^|+@Y22-LvP+*O__WIsWg<2OHYV3LD$ha(iU=?I*is5B2<3-}`zuv{OA5 zHcvD6)<%XlupP~r+C+ClNtx+>U~lZq`dT^B9pe+-yS59vZ3ogd*UWRhLF3j9>%_`7 zty^}OJo~8cJ$X5j?F;$y%8u+;>sgk3&+JeAp6cy9c|}zAY}cOYd0VS8d75e6*iP)7 z-VOA0CQ10a)SQvt&o$;z?CU*oxzNaoA~4tZZkjdJ$Wwc%@2TSNQVY!->Uys=xopUE zpX+m`_1N&2=5men#I=;|uFowiq@%A$Gn)&mGg-iXZzro3dY`Aexki_1HI`>~tT*^F zNW0#b&O#DyU+x&YT4<*4U{@?%?`!*%E`P$$b7^`kd;Y1}8_{|!z5mLd^O{9RvWVDa ziqBM55$B<#giX~vdaoJm20M|xtv{;p(2#I|ag-z{e>`FJvxjGb%g@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<<&)tR|f35o+2Az4W24z^CId92lGBkK_s?+)D@Y^o@I<*@4B&=S)8tVZ7K|ZCyq3r~K_MZE@#gtbGQAzn6Ak z_B#WTKY(yt!gv8(v}Od04ScOg;SVR4HPhJE0u{((l*5g0Nm;~vW^?qhBGclDa& zJMBx48x~goZHAOST&*F2G+B{Af+v&j;5}Li{IXqX=iHK^C}X4keZJj`XM6$+hCIaA zX6?n!+-BQ79AVBK!^y=I7N8gMNtv4=2GBGAnRzCCn{oOcbEeKmx51LhY&PQr`DtU3 zi|-mO7<~p989RnDnk8tF*C{SW7GsK`t-Bw&Q|l~bH_n|O8|JOl`o{CQJBz34Kg*n2 z%UP%Tz1ZZPsBfP|keJQ*My#4&H_smr=~~S5PXqDh@xC7N_w)@suihgTUM04gj>n9xb^IiTkZ1aQUmq`h9{I@p@z8GOdtdPla~gO*KQ*51 zEzL8NXv#B_Z^ko|UWI3-W1T!BhLC6a-u!*=Y#-k>cxKY8 z@XU0qlV`;6%rpC|_~6O&>|kl0nM6~bnS3*zne-|=Gac*X88JNb%y@SAiFMAQm%CuS?as+44pwO>%gisW+x?2zR@aPf z=2l99V+fRG&Cyq@yu=9e&3U~?bIE3V`jMWCt~3I+>PXQ79<43xU{_iz+(gFXz|}RX zVoXtzdmG_uLxg9F3VjVIo_$7HXE%EoGoAB#&Gwft&OF)}gE^4z-)0iQGmWiF<$UX<65ixps2 zmlYf1tVSuVVDtY4_$xBDS&X{E>Ti)9L0hLG6 AIRF3v From 3761524fba26666715379a665aaaa1692c32bdb5 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Tue, 25 Jul 2023 18:14:44 +0200 Subject: [PATCH 7/7] Header polish --- P3D/Screens/PC/MailSystemScreen.vb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/P3D/Screens/PC/MailSystemScreen.vb b/P3D/Screens/PC/MailSystemScreen.vb index 5c347309d..4c0c605db 100644 --- a/P3D/Screens/PC/MailSystemScreen.vb +++ b/P3D/Screens/PC/MailSystemScreen.vb @@ -46,9 +46,10 @@ 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), 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(48, 24), Color.Black) + 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))