Replaced all references to InventoryScreen by references to NewInventoryScreen. Still need to polish minor details.

This commit is contained in:
CaptainSegis 2017-02-22 17:10:40 -05:00
parent 12fbd4c6f8
commit e9619b4ffd
4 changed files with 79 additions and 5 deletions

View File

@ -699,7 +699,13 @@
Private Sub MainMenuOpenBag(ByVal BattleScreen As BattleScreen) Private Sub MainMenuOpenBag(ByVal BattleScreen As BattleScreen)
If BattleScreen.CanUseItems = True Then If BattleScreen.CanUseItems = True Then
TempBattleScreen = BattleScreen TempBattleScreen = BattleScreen
Core.SetScreen(New InventoryScreen(Core.CurrentScreen, {}, AddressOf SelectedItem)) Dim selScreen As New NewInventoryScreen(Core.CurrentScreen)
selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection
selScreen.CanExit = True
AddHandler selScreen.SelectedObject, AddressOf SelectedItemHandler
Core.SetScreen(selScreen)
'Core.SetScreen(New InventoryScreen(Core.CurrentScreen, {}, AddressOf SelectedItem))
End If End If
End Sub End Sub
@ -953,6 +959,10 @@
#Region "UseItem" #Region "UseItem"
Private Shared Sub SelectedItemHandler(ByVal params As Object())
SelectedItem(CInt(params(0)))
End Sub
Private Shared Sub SelectedItem(ByVal itemID As Integer) Private Shared Sub SelectedItem(ByVal itemID As Integer)
Dim Item As Item = Item.GetItemByID(itemID) Dim Item As Item = Item.GetItemByID(itemID)

View File

@ -25,10 +25,20 @@
Public Overrides Sub ResultFunction(ByVal Result As Integer) Public Overrides Sub ResultFunction(ByVal Result As Integer)
If Result = 0 Then If Result = 0 Then
Core.SetScreen(New InventoryScreen(Core.CurrentScreen, {4}, 4, AddressOf Me.PlantBerry)) Dim selScreen As New NewInventoryScreen(Core.CurrentScreen, {2}, 2, Nothing)
selScreen.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection
selScreen.CanExit = True
AddHandler selScreen.SelectedObject, AddressOf PlantBerryHandler
Core.SetScreen(selScreen)
'Core.SetScreen(New NewInventoryScreen(Core.CurrentScreen, {2}, 2, AddressOf Me.PlantBerry))
End If End If
End Sub End Sub
Public Sub PlantBerryHandler(ByVal params As Object())
PlantBerry(CInt(params(0)))
End Sub
Public Sub PlantBerry(ByVal ChosenBerry As Integer) Public Sub PlantBerry(ByVal ChosenBerry As Integer)
Dim testItem As Item = Item.GetItemByID(ChosenBerry) Dim testItem As Item = Item.GetItemByID(ChosenBerry)
If testItem.isBerry = True Then If testItem.isBerry = True Then

View File

@ -115,7 +115,17 @@ Public Class NewInventoryScreen
Private _messageDelay As Single = 0F Private _messageDelay As Single = 0F
Private _messageText As String = "" Private _messageText As String = ""
Public Sub New(ByVal currentScreen As Screen) 'experiment
Public Delegate Sub DoStuff(ByVal ItemID As Integer)
Dim ReturnItem As DoStuff
Dim AllowedPages() As Integer
Public Sub New(ByVal currentScreen As Screen, ByVal AllowedPages As Integer(), ByVal StartPageIndex As Integer, ByVal DoStuff As DoStuff)
_tabIndex = StartPageIndex
Me.AllowedPages = AllowedPages
ReturnItem = DoStuff
_translation = New Globalization.Classes.LOCAL_InventoryScreen() _translation = New Globalization.Classes.LOCAL_InventoryScreen()
target_1 = New RenderTarget2D(GraphicsDevice, 816, 400 - 32, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents) target_1 = New RenderTarget2D(GraphicsDevice, 816, 400 - 32, False, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents)
target_2 = New RenderTarget2D(GraphicsDevice, 500, 368) target_2 = New RenderTarget2D(GraphicsDevice, 500, 368)
@ -158,6 +168,14 @@ Public Class NewInventoryScreen
LoadItems() LoadItems()
End Sub End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal AllowedPages() As Integer, ByVal DoStuff As DoStuff)
Me.New(currentScreen, AllowedPages, Player.Temp.BagIndex, DoStuff)
End Sub
Public Sub New(ByVal currentScreen As Screen)
Me.New(currentScreen, {}, Player.Temp.BagIndex, Nothing)
End Sub
Public Overrides Sub Draw() Public Overrides Sub Draw()
'PreScreen.Draw() 'PreScreen.Draw()
@ -532,8 +550,21 @@ Public Class NewInventoryScreen
Private Sub UpdateTabs() Private Sub UpdateTabs()
If Controls.Left(True, True, True, True, True, True) And _tabInControl Or ControllerHandler.ButtonPressed(Buttons.LeftShoulder) Then If Controls.Left(True, True, True, True, True, True) And _tabInControl Or ControllerHandler.ButtonPressed(Buttons.LeftShoulder) Then
_tabIndex -= 1 _tabIndex -= 1
If AllowedPages.Count > 0 And AllowedPages.Contains(_tabIndex) = False Then
While AllowedPages.Contains(_tabIndex) = False
_tabIndex -= 1
If _tabIndex < 0 Then
_tabIndex = 7
ElseIf _tabIndex > 7 Then
_tabIndex = 0
End If
End While
End If
If _tabIndex < 0 Then If _tabIndex < 0 Then
_tabIndex = 7 _tabIndex = 7
ElseIf _tabIndex > 7 Then
_tabIndex = 0
End If End If
_itemIntro = 0F _itemIntro = 0F
ResetAnimation() ResetAnimation()
@ -541,7 +572,20 @@ Public Class NewInventoryScreen
End If End If
If Controls.Right(True, True, True, True, True, True) And _tabInControl Or ControllerHandler.ButtonPressed(Buttons.RightShoulder) Then If Controls.Right(True, True, True, True, True, True) And _tabInControl Or ControllerHandler.ButtonPressed(Buttons.RightShoulder) Then
_tabIndex += 1 _tabIndex += 1
If _tabIndex > 7 Then If AllowedPages.Count > 0 And AllowedPages.Contains(_tabIndex) = False Then
While AllowedPages.Contains(_tabIndex) = False
_tabIndex += 1
If _tabIndex < 0 Then
_tabIndex = 7
ElseIf _tabIndex > 7 Then
_tabIndex = 0
End If
End While
End If
If _tabIndex < 0 Then
_tabIndex = 7
ElseIf _tabIndex > 7 Then
_tabIndex = 0 _tabIndex = 0
End If End If
_itemIntro = 0F _itemIntro = 0F

View File

@ -219,7 +219,13 @@
If Controls.Accept(True, True, True) = True Then If Controls.Accept(True, True, True) = True Then
If Me.selectIndex = 0 Then If Me.selectIndex = 0 Then
Core.SetScreen(New InventoryScreen(Me, {5}, 5, AddressOf Me.ChosenMail)) 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)
'Core.SetScreen(New InventoryScreen(Me, {5}, 5, AddressOf Me.ChosenMail))
Else Else
If Me.index = Me.selectIndex Then If Me.index = Me.selectIndex Then
Me.index = -1 Me.index = -1
@ -288,6 +294,10 @@
End If End If
End Sub End Sub
Private Sub ChosenMailHandler(ByVal params As Object())
ChosenMail(CInt(params(0)))
End Sub
Private Sub ChosenMail(ByVal ItemID As Integer) Private Sub ChosenMail(ByVal ItemID As Integer)
Me.index = 0 Me.index = 0
Me.EditMailIndex = 0 Me.EditMailIndex = 0