Skip to content

Commit fb29453

Browse files
committed
Sync lua with C#
1 parent bf3942b commit fb29453

22 files changed

+574
-632
lines changed

ScaleformUI_Lua/src/Menus/PauseMenus/LobbyMenu/Columns/MissionListColumn.lua

+34-35
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function MissionListColumn.New(label, color, scrollType, _maxItems)
3535
Pagination = handler,
3636
Order = 0,
3737
Parent = nil,
38-
ParentTab = 0,
38+
ParentTab = nil,
3939
Items = {} --[[@type table<number, FriendItem>]],
4040
_unfilteredItems = {} --[[@type table<number, FriendItem>]],
4141
OnIndexChanged = function(index)
@@ -81,10 +81,10 @@ function MissionListColumn:CurrentSelection(value)
8181
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
8282
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
8383
self.Items[self:CurrentSelection()]:Selected(true)
84-
elseif pSubT == "PauseMenu" then
85-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.ParentTab, self.Pagination:ScaleformIndex()) --[[@as number]]
86-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self.ParentTab, self:CurrentSelection(), #self.Items) --[[@as number]]
87-
if self.Parent:Index() == self.ParentTab+1 and self.Parent:FocusLevel() == 1 then
84+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
85+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
86+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
87+
if self.Parent:Index() == IndexOf(self.Parent.Tabs, self.ParentTab) and self.Parent:FocusLevel() == 1 then
8888
self.Items[self:CurrentSelection()]:Selected(true)
8989
end
9090
end
@@ -115,8 +115,8 @@ function MissionListColumn:AddMissionItem(item)
115115
self.Pagination:MaxItem(self.Pagination:CurrentPageEndIndex())
116116
self:_itemCreation(self.Pagination:CurrentPage(), #self.Items, false)
117117
local pSubT = self.Parent()
118-
if pSubT == "PauseMenu" then
119-
if self.Parent.Tabs[self.ParentTab+1].listCol[self.Parent.Tabs[self.ParentTab+1]:Focus()] == self then
118+
if pSubT == "PauseMenu" and self.ParentTab.Visible then
119+
if self.ParentTab.listCol[self.ParentTab:Focus()] == self then
120120
self:CurrentSelection(sel)
121121
end
122122
end
@@ -146,8 +146,8 @@ function MissionListColumn:_itemCreation(page, pageIndex, before, overflow)
146146
local pSubT = self.Parent()
147147
if pSubT == "LobbyMenu" then
148148
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("ADD_MISSIONS_ITEM", before, menuIndex, 0, item.Label, item.MainColor, item.HighlightColor, item.LeftIcon, item.LeftIconColor, item.RightIcon, item.RightIconColor, item.RightIconChecked, item.enabled)
149-
elseif pSubT == "PauseMenu" then
150-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("ADD_PLAYERS_TAB_MISSIONS_ITEM", self.ParentTab, before, menuIndex, 0, item.Label, item.MainColor, item.HighlightColor, item.LeftIcon, item.LeftIconColor, item.RightIcon, item.RightIconColor, item.RightIconChecked, item.enabled)
149+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
150+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("ADD_PLAYERS_TAB_MISSIONS_ITEM", before, menuIndex, 0, item.Label, item.MainColor, item.HighlightColor, item.LeftIcon, item.LeftIconColor, item.RightIcon, item.RightIconColor, item.RightIconChecked, item.enabled)
151151
end
152152
end
153153

@@ -164,9 +164,8 @@ function MissionListColumn:RemoveItem(item)
164164
local pSubT = self.Parent()
165165
if pSubT == "LobbyMenu" then
166166
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("REMOVE_MISSIONS_ITEM", id - 1)
167-
elseif pSubT == "PauseMenu" then
168-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("REMOVE_PLAYERS_TAB_MISSIONS_ITEM",
169-
self.ParentTab, id - 1)
167+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
168+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("REMOVE_PLAYERS_TAB_MISSIONS_ITEM", id - 1)
170169
end
171170
end
172171
table.remove(self.Items, id)
@@ -183,15 +182,15 @@ function MissionListColumn:GoUp()
183182
local pSubT = self.Parent()
184183
if pSubT == "LobbyMenu" then
185184
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_INPUT_EVENT", 8, self._delay) --[[@as number]]
186-
elseif pSubT == "PauseMenu" then
185+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
187186
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_INPUT_EVENT", 8, self._delay) --[[@as number]]
188187
end
189188
elseif self.scrollingType == MenuScrollingType.PAGINATED or (self.scrollingType == MenuScrollingType.CLASSIC and overflow) then
190189
local pSubT = self.Parent()
191190
if pSubT == "LobbyMenu" then
192191
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("CLEAR_MISSIONS_COLUMN") --[[@as number]]
193-
elseif pSubT == "PauseMenu" then
194-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN", self.ParentTab) --[[@as number]]
192+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
193+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN") --[[@as number]]
195194
end
196195
local max = self.Pagination:ItemsPerPage()
197196
for i=1, max, 1 do
@@ -205,9 +204,9 @@ function MissionListColumn:GoUp()
205204
if pSubT == "LobbyMenu" then
206205
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
207206
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
208-
elseif pSubT == "PauseMenu" then
209-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.ParentTab, self.Pagination:ScaleformIndex()) --[[@as number]]
210-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self.ParentTab, self:CurrentSelection(), #self.Items) --[[@as number]]
207+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
208+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
209+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
211210
end
212211
self.Items[self:CurrentSelection()]:Selected(true)
213212
self.OnIndexChanged(self:CurrentSelection())
@@ -224,15 +223,15 @@ function MissionListColumn:GoDown()
224223
local pSubT = self.Parent()
225224
if pSubT == "LobbyMenu" then
226225
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_INPUT_EVENT", 9, self._delay) --[[@as number]]
227-
elseif pSubT == "PauseMenu" then
226+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
228227
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_INPUT_EVENT", 9, self._delay) --[[@as number]]
229228
end
230229
elseif self.scrollingType == MenuScrollingType.PAGINATED or (self.scrollingType == MenuScrollingType.CLASSIC and overflow) then
231230
local pSubT = self.Parent()
232231
if pSubT == "LobbyMenu" then
233232
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("CLEAR_MISSIONS_COLUMN") --[[@as number]]
234-
elseif pSubT == "PauseMenu" then
235-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN", self.ParentTab) --[[@as number]]
233+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
234+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN") --[[@as number]]
236235
end
237236
local max = self.Pagination:ItemsPerPage()
238237
for i=1, max, 1 do
@@ -246,9 +245,9 @@ function MissionListColumn:GoDown()
246245
if pSubT == "LobbyMenu" then
247246
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
248247
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
249-
elseif pSubT == "PauseMenu" then
250-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.ParentTab, self.Pagination:ScaleformIndex()) --[[@as number]]
251-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self.ParentTab, self:CurrentSelection(), #self.Items) --[[@as number]]
248+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
249+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
250+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
252251
end
253252
self.Items[self:CurrentSelection()]:Selected(true)
254253
self.OnIndexChanged(self:CurrentSelection())
@@ -260,8 +259,8 @@ function MissionListColumn:Clear()
260259
local pSubT = self.Parent()
261260
if pSubT == "LobbyMenu" then
262261
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("CLEAR_MISSIONS_COLUMN")
263-
elseif pSubT == "PauseMenu" then
264-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN", self.ParentTab)
262+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
263+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN")
265264
end
266265
end
267266
self.Items = {}
@@ -284,7 +283,7 @@ function MissionListColumn:SortMissions(compare)
284283
local pSubT = self.Parent()
285284
if pSubT == "LobbyMenu" then
286285
self.Parent:buildMissions()
287-
elseif pSubT == "PauseMenu" then
286+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
288287
self.Parent:buildMissions(self.Parent.Tabs[self.ParentTab])
289288
end
290289
end
@@ -310,8 +309,8 @@ function MissionListColumn:FilterMissions(predicate)
310309
local pSubT = self.Parent()
311310
if pSubT == "LobbyMenu" then
312311
self.Parent:buildMissions()
313-
elseif pSubT == "PauseMenu" then
314-
self.Parent:buildMissions(self.Parent.Tabs[self.ParentTab])
312+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
313+
self.Parent:buildMissions(self.ParentTab)
315314
end
316315
end
317316
end
@@ -326,7 +325,7 @@ function MissionListColumn:ResetFilter()
326325
local pSubT = self.Parent()
327326
if pSubT == "LobbyMenu" then
328327
self.Parent:buildMissions()
329-
elseif pSubT == "PauseMenu" then
328+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
330329
self.Parent:buildMissions(self.Parent.Tabs[self.ParentTab])
331330
end
332331
end
@@ -337,8 +336,8 @@ function MissionListColumn:refreshColumn()
337336
local pSubT = self.Parent()
338337
if pSubT == "LobbyMenu" then
339338
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("CLEAR_MISSIONS_COLUMN")
340-
elseif pSubT == "PauseMenu" then
341-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN", self.ParentTab)
339+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
340+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("CLEAR_PLAYERS_TAB_MISSIONS_COLUMN")
342341
end
343342
if #self.Items > 0 then
344343
self._isBuilding = true
@@ -366,9 +365,9 @@ function MissionListColumn:refreshColumn()
366365
if pSubT == "LobbyMenu" then
367366
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
368367
ScaleformUI.Scaleforms._pauseMenu._lobby:CallFunction("SET_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
369-
elseif pSubT == "PauseMenu" then
370-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.ParentTab, self.Pagination:ScaleformIndex()) --[[@as number]]
371-
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self.ParentTab, self:CurrentSelection(), #self.Items) --[[@as number]]
368+
elseif pSubT == "PauseMenu" and self.ParentTab.Visible then
369+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_SELECTION", self.Pagination:ScaleformIndex()) --[[@as number]]
370+
ScaleformUI.Scaleforms._pauseMenu._pause:CallFunction("SET_PLAYERS_TAB_MISSIONS_QTTY", self:CurrentSelection(), #self.Items) --[[@as number]]
372371
end
373372
self._isBuilding = false
374373
end

0 commit comments

Comments
 (0)