From cf283b914afa7cdcd19b80327babc6f848726c75 Mon Sep 17 00:00:00 2001 From: Leonardo Emanuele Date: Thu, 7 Apr 2022 12:18:26 +0200 Subject: [PATCH] Lua TabView: fix OnPauseMenuFocusChanged and OnActivated --- ScaleformUI_Lua/src/PauseMenu/TabView.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ScaleformUI_Lua/src/PauseMenu/TabView.lua b/ScaleformUI_Lua/src/PauseMenu/TabView.lua index 20e7eaa5..e0a172ab 100644 --- a/ScaleformUI_Lua/src/PauseMenu/TabView.lua +++ b/ScaleformUI_Lua/src/PauseMenu/TabView.lua @@ -34,7 +34,7 @@ function TabView.New(title, subtitle, sideTop, sideMid, sideBot) end, OnPauseMenuTabChanged = function(menu, tab, tabIndex) end, - OnPauseMenuFocusChanged = function(menu, tabIndex, focusLevel, leftItem) + OnPauseMenuFocusChanged = function(menu, tab, focusLevel, leftItem) end, OnLeftItemChange = function(menu, tabIndex, focusLevel, leftItem) end, @@ -65,7 +65,7 @@ end function TabView:FocusLevel(index) if index ~= nil then self.focusLevel = index - self.OnPauseMenuFocusChanged(self, self.Tabs[self.Index], index) + self.OnPauseMenuFocusChanged(self, self.Tabs[self.Index], index, self:LeftItemIndex()) else return self.focusLevel end @@ -298,8 +298,12 @@ function TabView:ProcessControl() if (IsControlJustPressed(2, 201)) then result = ScaleformUI.Scaleforms._pauseMenu:SendInputEvent(16) if self:FocusLevel() == 1 then - if (self.Tabs[self.Index].LeftItemList[self:LeftItemIndex()].ItemType == LeftItemType.Info or self.Tabs[self.Index].LeftItemList[self:LeftItemIndex()].ItemType == LeftItemType.Empty) then - self.Tabs[self.Index].LeftItemList[self:LeftItemIndex()].OnActivated(self.Tabs[self.Index].LeftItemList[self:LeftItemIndex()], self:LeftItemIndex()) + local tab = self.Tabs[self.Index] + local _, subt = tab() + if(subt ~= "TabTextItem") then + if (tab.LeftItemList[self:LeftItemIndex()].ItemType == LeftItemType.Info or tab.LeftItemList[self:LeftItemIndex()].ItemType == LeftItemType.Empty) then + tab.LeftItemList[self:LeftItemIndex()].OnActivated(tab.LeftItemList[self:LeftItemIndex()], self:LeftItemIndex()) + end end elseif self:FocusLevel() == 2 then local aa, subt = self.Tabs[self.Index].LeftItemList[self:LeftItemIndex()].ItemList[self:RightItemIndex()]()