aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut
blob: b20699f93aa66a4a68a80026788a0dd406c1ef51 (plain)
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
global function InitMainMenu
global function EULA_Dialog
global function UpdateDataCenterFooter
global function LaunchGamePurchase
global function SP_Trial_LaunchGamePurchase
global function LaunchSPNew
global function LaunchSPContinue
global function LaunchSPMissionSelect
global function LaunchMP
global function LaunchGame
global function LaunchSPTrialMission
global function GetUserSignInState
global function NorthstarMasterServerAuthDialog

struct
{
	var menu
	var versionDisplay
	var trialLabel
} file

global const int NS_NOT_DECIDED_TO_SEND_TOKEN = 0
global const int NS_AGREED_TO_SEND_TOKEN = 1
global const int NS_DISAGREED_TO_SEND_TOKEN = 2

void function InitMainMenu()
{
	RegisterSignal( "EndOnMainMenu_Open" )

	var menu = GetMenu( "MainMenu" )
	file.menu = menu

	ClientCommand( "exec autoexec_ns_client" )
	AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnMainMenu_Open )
	AddMenuEventHandler( menu, eUIEvent.MENU_NAVIGATE_BACK, OnMainMenu_NavigateBack )

	var titleRui = Hud_GetRui( Hud_GetChild( file.menu, "TitleRui" ) )
	RuiSetImage( titleRui, "basicImage", $"rui/menu/main_menu/title")

	file.versionDisplay = Hud_GetChild( menu, "versionDisplay" )
	file.trialLabel = Hud_GetChild( menu, "TrialLabel" )

	#if CONSOLE_PROG
		AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT", "", null, IsConsoleSignedIn )
		#if DURANGO_PROG
			AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_SWITCH_PROFILE", "", null, IsConsoleSignedIn )
		#endif // DURANGO_PROG

		AddMenuVarChangeHandler( "CONSOLE_isSignedIn", UpdateFooterOptions )
	#endif // CONSOLE_PROG

	#if PC_PROG
		AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT", "" )
	#endif // PC_PROG

	AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_ACCEPT", "#INBOX_ACCEPT", OpenDataCenterDialog, IsDataCenterFooterValid, UpdateDataCenterFooter )

#if DEV
	if ( DevStartPoints() )
		AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_DEV_MENU", "#DEV_MENU", OpenSinglePlayerDevMenu )
#endif // DEV
}

#if CONSOLE_PROG
	bool function IsConsoleSignedIn()
	{
		return ( GetMenuVarBool( "CONSOLE_isSignedIn" ) )
	}
#endif // CONSOLE_PROG

void function OnMainMenu_Open()
{
	Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )
	EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )

	SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it

	UpdatePromoData() // On script restarts this gives us the last data until the new request is complete
	RequestMainMenuPromos() // This will be ignored if there was a recent request. "infoblock_requestInterval"

	TryUnlockCollectiblesAchievement()
	TryUnlockCompletedGameAchievements()

	Hud_SetText( file.versionDisplay, GetPublicGameVersion() )
	Hud_Show( file.versionDisplay )

	thread UpdateTrialLabel()

	// do +map stuff
	if ( Dev_CommandLineHasParm( "+map" ) )
	{
		SetConVarBool( "ns_auth_allow_insecure", true ) // good for testing
		ClientCommand( "map " + Dev_CommandLineParmValue( "+map" ) )
		Dev_CommandLineRemoveParm( "+map" )
	}

	// do agree to ns remote auth dialog
	if ( !GetConVarBool( "ns_has_agreed_to_send_token" ) )
		NorthstarMasterServerAuthDialog()

#if PC_PROG
	ActivatePanel( GetPanel( "MainMenuPanel" ) )
	return
#endif // PC_PROG

	int state
	int lastState = -1
	var panel
	var lastPanel

	while ( GetTopNonDialogMenu() == file.menu )
	{
		state = GetUserSignInState()

		if ( state != lastState )
		{
			if ( state == userSignInState.SIGNED_IN )
				panel = GetPanel( "MainMenuPanel" )
			else
				panel = GetPanel( "EstablishUserPanel" )

			if ( panel != lastPanel )
			{
				ActivatePanel( panel )
				lastPanel = panel
			}
		}

		lastState = state

		WaitFrame()
	}
}

void function NorthstarMasterServerAuthDialog()
{
	// todo: this should be in localisation
	DialogData dialogData
	dialogData.header = "#DIALOG_TITLE_INSTALLED_NORTHSTAR"
	dialogData.image = $"rui/menu/fd_menu/upgrade_northstar_chassis"
	dialogData.message = "#AUTHENTICATION_AGREEMENT_DIALOG_TEXT"
	AddDialogButton( dialogData, "#YES", NorthstarMasterServerAuthDialogAgree )
	AddDialogButton( dialogData, "#NO", NorthstarMasterServerAuthDialogDisagree )
	OpenDialog( dialogData )
}

void function NorthstarMasterServerAuthDialogAgree()
{
	int oldValue = GetConVarInt( "ns_has_agreed_to_send_token" )
	SetConVarInt( "ns_has_agreed_to_send_token", NS_AGREED_TO_SEND_TOKEN )

	if ( oldValue != 0 && oldValue != NS_AGREED_TO_SEND_TOKEN )
	{
		DialogData dialogData
		dialogData.header = "#DIALOG_TITLE_INSTALLED_NORTHSTAR"
		dialogData.image = $"rui/menu/fd_menu/upgrade_northstar_chassis"
		dialogData.message = "#AUTHENTICATION_AGREEMENT_RESTART"
		AddDialogButton( dialogData, "#OK" )
		OpenDialog( dialogData )
	}
}

void function NorthstarMasterServerAuthDialogDisagree()
{
	int oldValue = GetConVarInt( "ns_has_agreed_to_send_token" )
	SetConVarInt( "ns_has_agreed_to_send_token", NS_DISAGREED_TO_SEND_TOKEN )

	if ( oldValue != 0 && oldValue != NS_DISAGREED_TO_SEND_TOKEN )
	{
		DialogData dialogData
		dialogData.header = "#DIALOG_TITLE_INSTALLED_NORTHSTAR"
		dialogData.image = $"rui/menu/fd_menu/upgrade_northstar_chassis"
		dialogData.message = "#AUTHENTICATION_AGREEMENT_RESTART"
		AddDialogButton( dialogData, "#OK" )
		OpenDialog( dialogData )
	}
}

void function ActivatePanel( var panel )
{
	Assert( panel != null )

	array<var> elems = GetElementsByClassname( file.menu, "MainMenuPanelClass" )
	foreach ( elem in elems )
	{
		if ( elem != panel && Hud_IsVisible( elem ) )
			HidePanel( elem )
	}

	ShowPanel( panel )
}

void function OnMainMenu_NavigateBack()
{
#if DURANGO_PROG
	Durango_ShowAccountPicker()
#endif // DURANGO_PROG
}

int function GetUserSignInState()
{
#if DURANGO_PROG
	if ( Durango_InErrorScreen() )
	{
		return userSignInState.ERROR
	}
	else if ( Durango_IsSigningIn() )
	{
		return userSignInState.SIGNING_IN
	}
	else if ( !Console_IsSignedIn() && !Console_SkippedSignIn() )
	{
		//printt( "Console_IsSignedIn():", Console_IsSignedIn(), "Console_SkippedSignIn:", Console_SkippedSignIn() )
		return userSignInState.SIGNED_OUT
	}

	Assert( Console_IsSignedIn() || Console_SkippedSignIn() )
#endif
	return userSignInState.SIGNED_IN
}

void function UpdateDataCenterFooter( InputDef data )
{
	EndSignal( uiGlobal.signalDummy, "EndFooterUpdateFuncs" )

	int index = int( Hud_GetScriptID( data.vguiElem ) )
	int ping
	string name

	while ( data.conditionCheckFunc() )
	{
		ping = GetDatacenterPing()
		name = GetDatacenterName()

		if ( ping > 0 )
		{
			if ( IsControllerModeActive() )
				SetFooterText( file.menu, index, Localize( "#X_BUTTON_DATACENTER_INFO", name, ping ) )
			else
				SetFooterText( file.menu, index, Localize( "#DATACENTER_INFO", name, ping ) )
		}
		else
		{
			if ( IsControllerModeActive() )
				SetFooterText( file.menu, index, "#X_BUTTON_DATACENTER_CALCULATING" )
			else
				SetFooterText( file.menu, index, "#DATACENTER_CALCULATING" )
		}

		WaitFrame()
	}
}

bool function IsDataCenterFooterValid()
{
	#if PC_PROG
		return ( uiGlobal.activeMenu == file.menu )
	#else
		return ( uiGlobal.activeMenu == file.menu ) && Console_IsOnline() && Console_IsSignedIn()
	#endif
}

void function SP_Trial_LaunchGamePurchase()
{
	Disconnect()
	LaunchGamePurchase()
}

void function LaunchGamePurchase()
{
	ShowGamePurchaseStore()
}

void function LaunchSPNew()
{
	uiGlobal.launching = eLaunching.SINGLEPLAYER_NEW
	LaunchGame()
}

void function LaunchSPContinue()
{
	uiGlobal.launching = eLaunching.SINGLEPLAYER_CONTINUE
	LaunchGame()
}

void function LaunchSPMissionSelect()
{
	uiGlobal.launching = eLaunching.SINGLEPLAYER_MISSION_SELECT
	LaunchGame()
}

void function LaunchSPTrialMission()
{
	uiGlobal.launching = eLaunching.SINGLEPLAYER_MISSION_SELECT
	SPTrialMission_Start()
}

void function LaunchMP()
{
	uiGlobal.launching = eLaunching.MULTIPLAYER
	LaunchGame()
}

void function LaunchGame()
{
	Assert( uiGlobal.launching == eLaunching.SINGLEPLAYER_NEW ||
			uiGlobal.launching == eLaunching.SINGLEPLAYER_CONTINUE ||
			uiGlobal.launching == eLaunching.SINGLEPLAYER_MISSION_SELECT ||
			uiGlobal.launching == eLaunching.MULTIPLAYER ||
			uiGlobal.launching == eLaunching.MULTIPLAYER_INVITE )

	if ( uiGlobal.activeMenu == GetMenu( "PlayVideoMenu" ) )
	{
		SetVideoCompleteFunc( null )
		CloseActiveMenu()
	}

	if ( !IsGamePartiallyInstalled() )
	{
		DoGameNeedsToInstallDialog()
		return
	}

	// Because accepting an invite tries to launch the game we need this here
	if ( !IsGameFullyInstalled() )
	{
		printt( "Game is not fully installed." )

		if ( uiGlobal.launching == eLaunching.SINGLEPLAYER_CONTINUE )
		{
			string saveName = GetSaveName()
			string mapName = SaveGame_GetMapName( saveName )
			int startPointIndex = SaveGame_GetStartPoint( saveName )

			printt( mapName )
			printt( startPointIndex )

			bool isInTraining = (mapName == "sp_training" && startPointIndex < 5)  // "Titanfall" start point

			if ( !isInTraining )
			{
				DoGameNeedsToInstallDialog()
				return
			}

			printt( "Allowing 'continue' option to load into training." )
		}
		else if ( uiGlobal.launching != eLaunching.SINGLEPLAYER_NEW )
		{
			DoGameNeedsToInstallDialog()
			return
		}
	}

	#if CONSOLE_PROG
		if ( !Console_IsSignedIn() )
		{
			printt( "Not signed in." )
			return
		}

		if ( GetEULAVersionAccepted() < 1 ) // Treat as binary for now, as discussed with Preston.
		{
			if ( uiGlobal.activeMenu == GetMenu( "EULADialog" ) )
				return

			if ( IsDialog( uiGlobal.activeMenu ) )
				CloseActiveMenu( true )

			EULA_Dialog()
			return
		}

		if ( Nucleus_GetState() == NUCLEUS_STATE_INACTIVE )
			Nucleus_Login()

		if ( !uiGlobal.triedNucleusRegistration && uiGlobal.launching == eLaunching.MULTIPLAYER && !Nucleus_GetSkipRegistration() )
		{
			uiGlobal.triedNucleusRegistration = true
			thread Nucleus_HandleLoginResponse()
			return
		}

		if ( !GetConVarBool( "gamma_adjusted" ) )
		{
			if ( IsDialog( uiGlobal.activeMenu ) )
				CloseActiveMenu( true )

			AdvanceMenu( GetMenu( "GammaMenu" ) )
			return
		}
	#endif // CONSOLE_PROG

	if ( ( uiGlobal.launching == eLaunching.MULTIPLAYER || uiGlobal.launching == eLaunching.MULTIPLAYER_INVITE ) && !IsAdvocateGiftComplete() )
	{
		if ( IsDialog( uiGlobal.activeMenu ) )
			CloseActiveMenu( true )

		AdvanceMenu( GetMenu( "AdvocateGiftDialog" ) )
		return
	}

	SetMenuWasMultiplayerPlayedLast( true )
	if ( uiGlobal.launching == eLaunching.SINGLEPLAYER_NEW )
		NewGameSelected()
	else if ( uiGlobal.launching == eLaunching.SINGLEPLAYER_CONTINUE )
		LoadLastCheckpoint()
	else if ( uiGlobal.launching == eLaunching.SINGLEPLAYER_MISSION_SELECT )
		AdvanceMenu( GetMenu( "SinglePlayerMenu" ) )
	else
		thread StartSearchForPartyServer()

	uiGlobal.launching = eLaunching.FALSE
}

void function StartSearchForPartyServer()
{
	printt( "StartSearchForPartyServer" )

#if DURANGO_PROG
		// IMPORTANT: As a safety measure leave any party view we are in at this point.
		// Otherwise, if you are unlucky enough to get stuck in a party view, you will
		// trash its state by pointing it to your private lobby.
		Durango_LeaveParty()

		// IMPORTANT: It's possible that you have permission to play multiplayer
		// because your friend is signed in with his gold account on your machine,
		// but once that guy signs out, you shouldn't be able to play like you have
		// xboxlive gold anymore. To fix this, we need to check permissions periodically.
		// One of the places where we do this periodic check is when you press "PLAY"
		printt( "Durango - verifying MP permissions" )
		if ( !Console_HasPermissionToPlayMultiplayer() )
			Durango_VerifyMultiplayerPermissions()
#endif // DURANGO_PROG

	Signal( uiGlobal.signalDummy, "OnCancelConnect" )
	EndSignal( uiGlobal.signalDummy, "OnCancelConnect" )

	if ( IsDialog( uiGlobal.activeMenu ) )
		CloseActiveMenu( true )
	OpenConnectingDialog()

	Hud_SetText( uiGlobal.ConfirmMenuMessage, "" )
	Hud_SetText( uiGlobal.ConfirmMenuErrorCode, "" )

	Hud_Show( uiGlobal.ConfirmMenuMessage )
	Hud_Show( uiGlobal.ConfirmMenuErrorCode )

#if DURANGO_PROG
		if( !Console_IsOnline() )
		{
			printt( "Durango - finding empty party server failed - not online" )
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#DURANGO_NOT_ONLINE" )
			return
		}
#endif // DURANGO_PROG

#if PS4_PROG
		if(  !Console_IsOnline() )
		{
			printt( "PS4 - finding empty party server failed - not online" )
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#INTERNET_NOT_FOUND" )
			return
		}

		if ( PS4_isNetworkingDown() )
		{
			printt( "PS4 - finding empty party server failed - networking is down" )
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_CANNOT_CONNECT" )
			return
		}

		if(  !PS4_isUserNetworkingEnabled() )
		{
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_CHECKING_USABILITY" )
			PS4_ScheduleUserNetworkingEnabledTest()
			WaitFrame()

			if( !PS4_isUserNetworkingResolved() )
			{
				printt( "PS4 - finding empty party server stalled - networking isn't resolved yet" )
				// offer cancel ??
				while( !PS4_isUserNetworkingResolved())
					WaitFrame()
			}

			if( PS4_getUserNetworkingResolution() == PS4_NETWORK_STATUS_NOT_LOGGED_IN )
			{
  				Hud_SetText( uiGlobal.ConfirmMenuErrorCode, string(PS4_getUserNetworkingErrorStatus()) )
				Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_LOGIN" )

				Ps4_LoginDialog_Schedule()
				while( Ps4_LoginDialog_Running() )
					WaitFrame()

				PS4_ScheduleUserNetworkingEnabledTest()
				WaitFrame()
				if( !PS4_isUserNetworkingResolved() )
				{
					Hud_SetText( uiGlobal.ConfirmMenuErrorCode, "" )
					Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_CHECKING_USABILITY" )
					while( !PS4_isUserNetworkingResolved())
						WaitFrame()
				}
			}

			if( PS4_getUserNetworkingResolution() == PS4_NETWORK_STATUS_AGE_RESTRICTION )
			{
  		        Hud_SetText( uiGlobal.ConfirmMenuErrorCode, string(PS4_getUserNetworkingErrorStatus()) )
				Hud_SetText( uiGlobal.ConfirmMenuMessage, "#MULTIPLAYER_AGE_RESTRICTED" )
				return
			}

			if( PS4_getUserNetworkingResolution() == PS4_NETWORK_STATUS_IN_ERROR )
			{
  		        Hud_SetText( uiGlobal.ConfirmMenuErrorCode, string(PS4_getUserNetworkingErrorStatus()) )
				Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_HAD_ERROR" )
				return
			}

			if(  !PS4_isUserNetworkingEnabled() )
			{
				Hud_SetText( uiGlobal.ConfirmMenuErrorCode, string(PS4_getUserNetworkingErrorStatus()) )
				Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_NOT_ALLOWED" )
				return
   			}

			Hud_SetText( uiGlobal.ConfirmMenuErrorCode, "" )
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "" )
		}

		if ( !Ps4_PSN_Is_Loggedin() )
		{
			Ps4_LoginDialog_Schedule()
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_LOGIN" )

			while( Ps4_LoginDialog_Running() )
				WaitFrame()

			if ( !Ps4_PSN_Is_Loggedin() )
				return
		}

		if( Ps4_CheckPlus_Schedule() )
		{
			while( Ps4_CheckPlus_Running() )
				WaitFrame()
			if( !Ps4_CheckPlus_Allowed() )
			{
				if( Ps4_CheckPlus_GetLastRequestResults() != 0 )
				{
  					Hud_SetText( uiGlobal.ConfirmMenuErrorCode, string( Ps4_CheckPlus_GetLastRequestResults()) )
					Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_HAD_ERROR" )
					return
				}

				if( Ps4_ScreenPlusDialog_Schedule() )
				{
					while( Ps4_ScreenPlusDialog_Running() )
						WaitFrame()
					if( !Ps4_ScreenPlusDialog_Allowed() )
					{
						Hud_SetText( uiGlobal.ConfirmMenuMessage, "#PSN_MUST_BE_PLUS_USER" )
						return
					}
				}
				else
				{
  					return
				}
			}
		}

        Hud_SetText( uiGlobal.ConfirmMenuErrorCode, "" )
		Hud_SetText( uiGlobal.ConfirmMenuMessage, "" )
#endif // #if PS4_PROG

	printt( "Checking if this user has permission to play MP\n" )
	if ( !Console_HasPermissionToPlayMultiplayer() )
	{
		Hud_SetText( uiGlobal.ConfirmMenuMessage, "#MULTIPLAYER_NOT_AVAILABLE" )
		return
	}

	Plat_ShowUGCRestrictionNotice()
	while ( Plat_IsSystemMessageDialogOpen() )
		WaitFrame()

	Plat_ShowChatRestrictionNotice()
	while ( Plat_IsSystemMessageDialogOpen() )
		WaitFrame()

#if PC_PROG
		if ( Origin_IsEnabled() )
		{
			Origin_RequestTicket()
			Hud_SetText( uiGlobal.ConfirmMenuMessage, "#WAITING_FOR_ORIGIN" )

			while ( !Origin_IsReady() )
				WaitFrame()
		}
#endif // PC_PROG

	printt( "SearchForPartyServer" )
	SetMenuWasMultiplayerPlayedLast( true )
	SearchForPartyServer()

	Hud_SetAutoText( uiGlobal.ConfirmMenuMessage, "", HATT_MATCHMAKING_EMPTY_SERVER_SEARCH_STATE, 0 )
	Hud_SetAutoText( uiGlobal.ConfirmMenuErrorCode, "", HATT_MATCHMAKING_EMPTY_SERVER_SEARCH_ERROR, 0 )
}

void function EULA_Dialog()
{
	if ( GetUserSignInState() != userSignInState.SIGNED_IN  )
		return

	if ( GetEULAVersionAccepted() >= 1 )
		return

	AdvanceMenu( GetMenu( "EULADialog" ) )
}

void function DoGameNeedsToInstallDialog()
{
	DialogData dialogData
	dialogData.header = "#MENU_WAIT_FOR_INTALL"

	int installProgress = int( GetGameFullyInstalledProgress()*100 )

	if ( uiGlobal.launching == eLaunching.MULTIPLAYER && IsGamePartiallyInstalled() && !Script_IsRunningTrialVersion() )
	{
		dialogData.message = Localize("#MENU_WAIT_FOR_INTALL_HINT", installProgress )
		AddDialogButton( dialogData, "#YES", LaunchSPNew )
		AddDialogButton( dialogData, "#NO" )
	}
	else
	{
		dialogData.message = Localize("#MENU_WAIT_FOR_INTALL_HINT_NOTRAINING", installProgress )
		AddDialogButton( dialogData, "#OK" )
	}

	AddDialogFooter( dialogData, "#A_BUTTON_SELECT" )
	AddDialogFooter( dialogData, "#B_BUTTON_CANCEL" )

	OpenDialog( dialogData )
}

void function UpdateTrialLabel()
{
	//bool isTrialVersion
	//bool lastIsTrialVersion = Script_IsRunningTrialVersion()

	Hud_SetColor( file.trialLabel, 101, 109, 207, 255 )
	Hud_SetText( file.trialLabel, "+ NORTHSTAR" )
	Hud_SetVisible( file.trialLabel, true )

	//while ( GetTopNonDialogMenu() == file.menu )
	//{
	//	isTrialVersion = Script_IsRunningTrialVersion()
	//
	//	if ( isTrialVersion != lastIsTrialVersion )
	//		Hud_SetVisible( file.trialLabel, isTrialVersion )
	//
	//	lastIsTrialVersion = isTrialVersion
	//
	//	WaitFrame()
	//}
}

void function OpenSinglePlayerDevMenu( var button )
{
	AdvanceMenu( GetMenu( "SinglePlayerDevMenu" ) )
}