Skip to content

Commit

Permalink
Lua TabView: fix OnPauseMenuFocusChanged and OnActivated
Browse files Browse the repository at this point in the history
  • Loading branch information
manups4e committed Apr 7, 2022
1 parent 7149b81 commit cf283b9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ScaleformUI_Lua/src/PauseMenu/TabView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()]()
Expand Down

0 comments on commit cf283b9

Please sign in to comment.