1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
// Events for handlers
// UIE_CLICK
// UIE_GET_FOCUS
// UIE_LOSE_FOCUS
global function UICodeCallback_UIInit
global function UICodeCallback_ControllerModeChanged
global function UICodeCallback_OnVideoOver
global function AddUICallback_OnLevelInit
global struct TabDef
{
var panel
string title
}
global struct InputDef
{
int input
string gamepadLabel
var vguiElem
string mouseLabel
bool functionref() conditionCheckFunc
bool lastConditionCheckResult
void functionref( var ) activateFunc
void functionref( InputDef ) updateFunc
}
global struct DialogButtonData
{
string label
void functionref() activateFunc
string focusMessage
bool startFocused
}
global struct DialogFooterData
{
string label
void functionref() activateFunc
}
global struct DialogMessageRuiData
{
string message = ""
vector style1Color = <1.0, 1.0, 1.0>
vector style2Color = <0.5, 0.5, 0.5>
vector style3Color = <0.5, 0.5, 0.5>
float style1FontScale = 1.0
float style2FontScale = 1.0
float style3FontScale = 1.0
}
global struct DialogData
{
var menu
string header
string message
DialogMessageRuiData &ruiMessage
array messageColor = [161, 161, 161, 255]
asset image
asset rightImage = $""
bool forceChoice = false
bool noChoice = false
bool noChoiceWithNavigateBack = false
bool showSpinner = false
bool showPCBackButton = false
float inputDisableTime = 0
table<int,bool> coloredButton
bool darkenBackground = false
bool useFullMessageHeight = false
array<DialogButtonData> buttonData
array<DialogFooterData> footerData
}
global struct MenuDef
{
void functionref() initFunc
void functionref() openFunc
void functionref() closeFunc
void functionref() showFunc // TODO: Needs hooking up
void functionref() hideFunc // TODO: Needs hooking up
void functionref() thinkFunc
void functionref() navBackFunc
void functionref() tabChangedFunc
void functionref() inputModeChangedFunc
void functionref() entitlementsChangedFunc
array<InputDef> footerData
table<int, void functionref( var )> registeredInput
bool hasTabs = false
array<TabDef> tabsData
int tabIndex = 0
bool isDialog = false
DialogData& dialogData
bool isDynamicHeight = false
bool isPVEMenu = false
var lastFocus // Only used for restoring submenu focus so far
}
global struct PanelDef
{
void functionref() initFunc
void functionref() showFunc
void functionref() hideFunc
string tabTitle = "Default"
array<InputDef> footerData
table<int, void functionref( var )> registeredInput
var defaultFocus
}
global struct PieChartEntry
{
string displayName
float numValue
array<int> color = [127, 127, 127, 255]
float fracValue = 0.0
}
global struct PieChartData
{
array<PieChartEntry> entries
array<int> labelColor = [46, 49, 51, 255]
bool timeBased = false
float sum = 0.0
}
global struct UIGlobals
{
table menus = {}
array allMenus = []
array<var> menuStack
string loadingLevel = ""
string loadedLevel = ""
string previousLevel = ""
string previousPlaylist = ""
var activeMenu = null
bool lastMenuNavDirection = MENU_NAV_FORWARD
bool lobbyFromLoadingScreen = false
bool eventHandlersAdded = false
bool loadoutsInitialized = false
bool itemsInitialized = false
bool matchmaking = false
var dialogCloseCallback = null
table signalDummy = {}
float dialogInputEnableTime = 0.0
bool lobbyMenusLeftOpen = false
bool playingMusic = false
var mainMenuFocus = null
int announcementVersionSeen = -1
var lastCategoryFocus = null
int pilotSpawnLoadoutIndex = -1
int titanSpawnLoadoutIndex = -1
bool updatePilotSpawnLoadout = false
bool updateTitanSpawnLoadout = false
string editingLoadoutType = "pilot"
string editingLoadoutProperty = ""
int editingLoadoutIndex = -1
string editingItemRef = ""
int editingItemType = -1
var editingSubitemRef = null
int editingSubitemType = -1
var editingParentItemRef = null
int editingWeaponCategory = -1
int entitlementId = -1
string testStoreWeaponRef // TODO: Remove when done testing
bool EOGAutoAdvance = true
bool EOGOpenInLobby = false
string EOGChallengeFilter = ""
var eogCoopFocusedButton = null
var eogCoopSelectedButton = null
var eogScoreboardFocusedButton = null
bool eogNavigationButtonsRegistered = false
table<string, var> ui_ChallengeProgress = {}
int decalScrollState = 0
bool isLobby
var ConfirmMenuMessage
var ConfirmMenuErrorCode
array<DialogButtonData> dialogButtonData
bool updatingLobbyUI = false
array buttonConfigs
array stickConfigs
var playlistList
table< string, array > eog_challengesToShow
table< string, array > eog_unlocks
bool videoSettingsChanged = false
bool playingVideo = false
bool playingCredits = false
bool mapSupportsMenuModels = false
bool mapSupportsMenuModelsUpdated = false
bool interpolateCameraMoves = true
int activePresentationType = ePresentationType.INACTIVE
bool rotateCharacterInputRegistered = false
table<var,MenuDef> menuData
table<string, int> intVars
table<string, bool> boolVars
table<string, var> varVars
table<string, array<void functionref()> > varChangeFuncs
array<void functionref()> onLevelInitCallbacks
bool tabButtonsRegistered = false
table panels = {}
array<var> allPanels
table<var,PanelDef> panelData
bool sp_showAlternateMissionLog = false
int launching = eLaunching.FALSE
bool triedNucleusRegistration = false
int consoleSettingMenu = eConsoleSettingsMenu.FALSE
bool updateCachedNewItems = true
var menuToOpenFromPromoButton = null
bool isLoading = false
}
global UIGlobals uiGlobal
global const MAINMENU_MUSIC_DELAY = 4.0
void function UICodeCallback_UIInit()
{
ScriptCompilerTest()
ShUtilityAll_Init()
LevelVarInit()
VPKNotifyFile( "media/intro_captions.txt" )
UtilityUI_Init()
Settings_Init() // UI script doesn't need everything in this, reorganize
GameModes_Init()
UIVars_Init()
PassivesShared_Init()
ChallengesShared_Init()
ChallengesContent_Init()
XP_Init()
MenuLobby_Init()
MenuPrivateMatch_Init()
MenuGamepadLayout_Init()
MenuChallenges_Init()
MenuEOG_Init()
MenuUtility_Init()
MenuAdvocateLetter_Init()
MenuCredits_Init()
MenuMapSelect_Init()
RegisterSignal( "LevelShutdown" )
RegisterSignal( "CleanupInGameMenus" )
RegisterSignal( "OnCloseLobbyMenu" )
RegisterSignal( "OnCancelConnect" )
RegisterSignal( "PlayVideoEnded" )
RegisterSignal( "ActiveMenuChanged" )
RegisterSignal( "LevelFinishedLoading")
RegisterSignal( "OpenErrorDialog" )
RegisterSignal( "BoughtItem" )
thread UpdateClientMenuOpenState()
InitGamepadConfigs()
Store_Init()
InitMenus()
if ( !IsSingleplayer() )
thread UpdateCachedLoadouts() // Needs to wait for persistent data to ready
}
void function UICodeCallback_ControllerModeChanged( bool controllerModeEnabled )
{
//printt( "CONTROLLER! " + controllerModeEnabled + ", " + IsControllerModeActive() )
if ( uiGlobal.activeMenu == null )
return
if ( uiGlobal.menuData[ uiGlobal.activeMenu ].inputModeChangedFunc != null )
thread uiGlobal.menuData[ uiGlobal.activeMenu ].inputModeChangedFunc()
UpdateFooterOptions()
if ( IsDialog( uiGlobal.activeMenu ) )
UpdateDialogFooterVisibility( uiGlobal.activeMenu, controllerModeEnabled )
}
void function UICodeCallback_OnVideoOver()
{
SetIntroViewed( true )
Signal( uiGlobal.signalDummy, "PlayVideoEnded" )
}
void function UpdateClientMenuOpenState()
{
for ( ;; )
{
WaitSignal( uiGlobal.signalDummy, "ActiveMenuChanged" )
if ( IsMultiplayer() && !IsLobby() )
{
int newState = 0
if ( IsDialogOnlyActiveMenu() )
newState = 2
else if ( uiGlobal.activeMenu != null)
newState = 1
RunMenuClientFunction( "SetMenuOpenState", newState )
}
}
}
void function AddUICallback_OnLevelInit( void functionref() callbackFunc )
{
Assert( !( uiGlobal.onLevelInitCallbacks.contains( callbackFunc ) ), "Already added " + string( callbackFunc ) + " with AddUICallback_OnLevelInit" )
uiGlobal.onLevelInitCallbacks.append( callbackFunc )
}
|