aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod/scripts/vscripts
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts')
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut28
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut6
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut43
3 files changed, 45 insertions, 32 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut
index fb05adbc..2c12f796 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut
@@ -10,6 +10,7 @@ global function LaunchMP
global function LaunchGame
global function LaunchSPTrialMission
global function GetUserSignInState
+global function NorthstarMasterServerAuthDialog
struct
{
@@ -18,6 +19,9 @@ struct
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()
{
@@ -90,17 +94,7 @@ void function OnMainMenu_Open()
// do agree to ns remote auth dialog
if ( !GetConVarBool( "ns_has_agreed_to_send_token" ) )
- {
- // todo: this should be in localisation
- DialogData dialogData
- dialogData.header = "Thanks for installing Northstar!"
- dialogData.image = $"rui/menu/fd_menu/upgrade_northstar_chassis"
- dialogData.message = "For Northstar to work, it needs to authenticate using the Northstar master server. This will require sending your origin token to the master server, it will not be stored or used for any other purposes.\n" +
- "Press Yes if you agree to this. This choice can be changed in the mods menu at any time."
- AddDialogButton( dialogData, "#YES", void function() { SetConVarInt( "ns_has_agreed_to_send_token", 1 ) } )
- AddDialogButton( dialogData, "#NO", void function() { SetConVarInt( "ns_has_agreed_to_send_token", 2 ) } )
- OpenDialog( dialogData )
- }
+ NorthstarMasterServerAuthDialog()
#if PC_PROG
ActivatePanel( GetPanel( "MainMenuPanel" ) )
@@ -136,6 +130,18 @@ void function OnMainMenu_Open()
}
}
+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", void function() { SetConVarInt( "ns_has_agreed_to_send_token", NS_AGREED_TO_SEND_TOKEN ) } )
+ AddDialogButton( dialogData, "#NO", void function() { SetConVarInt( "ns_has_agreed_to_send_token", NS_DISAGREED_TO_SEND_TOKEN ) } )
+ OpenDialog( dialogData )
+}
+
void function ActivatePanel( var panel )
{
Assert( panel != null )
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
index e6b0d90a..286cd192 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut
@@ -29,6 +29,7 @@ void function InitModMenu()
AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnModMenuClosed )
AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
AddMenuFooterOption( menu, BUTTON_Y, "#Y_RELOAD_MODS", "#RELOAD_MODS", OnReloadModsButtonPressed )
+ AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_AUTHENTICATION_AGREEMENT", "#AUTHENTICATION_AGREEMENT", OnAuthenticationAgreementButtonPressed )
foreach ( var button in GetElementsByClassname( GetMenu( "ModListMenu" ), "ModButton" ) )
{
@@ -156,4 +157,9 @@ void function ReloadMods()
// note: the logic for this seems really odd, unsure why it doesn't seem to update, since the same code seems to get run irregardless of whether we've read weapon data before
ClientCommand( "uiscript_reset" )
+}
+
+void function OnAuthenticationAgreementButtonPressed( var button )
+{
+ NorthstarMasterServerAuthDialog()
} \ No newline at end of file
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
index 9a0850c0..ffd9bc80 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
@@ -82,6 +82,9 @@ void function InitMainMenuPanel()
Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" )
Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate )
+ Hud_SetLocked( file.fdButton, true )
+
+ thread TryUnlockNorthstarButton()
headerIndex++
buttonIndex = 0
@@ -436,17 +439,8 @@ void function UpdatePlayButton( var button )
ComboButton_SetText( file.mpButton, buttonText )
- //if ( Hud_IsLocked( button ) || buttonText == "#MENU_GET_THE_FULL_GAME" )
- //{
- // ComboButton_SetText( file.fdButton, "" )
- // Hud_SetEnabled( file.fdButton, false )
- //}
- //else
- //{
- //ComboButton_SetText( file.fdButton, "#MULTIPLAYER_LAUNCH_FD" )
- ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" ) // this needs to use localised text at some point when we have a modular way of doing that
- Hud_SetEnabled( file.fdButton, true )
- //}
+ ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" )
+ Hud_SetEnabled( file.fdButton, true )
if ( file.installing )
message = ""
@@ -495,19 +489,26 @@ void function MainMenuButton_Activate( var button )
file.buttonData[buttonID].activateFunc.call( this )
}
-void function OnPlayFDButton_Activate( var button ) // repurposed for launching northstar lobby
+void function TryUnlockNorthstarButton()
{
- //if ( file.mpButtonActivateFunc == null )
- // printt( "file.mpButtonActivateFunc is null" )
+ // unlock "Launch Northstar" button until you're authed with masterserver, are allowing insecure auth, or 7.5 seconds have passed
+ float time = Time()
+
+ while ( Time() < time + 7.5 || GetConVarInt( "ns_has_agreed_to_send_token" ) != NS_AGREED_TO_SEND_TOKEN )
+ {
+ if ( NSIsMasterServerAuthenticated() || GetConVarBool( "ns_auth_allow_insecure" ) )
+ break
+
+ WaitFrame()
+ }
+
+ Hud_SetLocked( file.fdButton, false )
+}
- if ( !Hud_IsLocked( button ) )// && file.mpButtonActivateFunc != null )
+void function OnPlayFDButton_Activate( var button ) // repurposed for launching northstar lobby
+{
+ if ( !Hud_IsLocked( button ) )
{
- //Lobby_SetAutoFDOpen( true )
- //// Lobby_SetFDMode( true )
- //thread file.mpButtonActivateFunc()
-
- //ClientCommand( "setplaylist tdm" )
- //ClientCommand( "map mp_lobby" )
SetConVarBool( "ns_is_modded_server", true )
NSTryAuthWithLocalServer()