diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-10-14 21:01:40 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-10-14 21:01:40 +0100 |
commit | 9a2778eabc7ba968968e41dda9f03525d6c5383d (patch) | |
tree | 6d1c5dc64754d542d68a7f47742a701a4eec9308 /Northstar.Client | |
parent | c0a0c7e502f2bc99185d79a485b965f63de7a203 (diff) | |
download | NorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.tar.gz NorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.zip |
oh fuck i forgot to commit for a while
Diffstat (limited to 'Northstar.Client')
8 files changed, 727 insertions, 32 deletions
diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt Binary files differindex e6175e5b..ede68b36 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut new file mode 100644 index 00000000..9a40f788 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -0,0 +1,623 @@ +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 + +struct +{ + var menu + var versionDisplay + var trialLabel +} file + + +void function InitMainMenu() +{ + RegisterSignal( "EndOnMainMenu_Open" ) + + var menu = GetMenu( "MainMenu" ) + file.menu = menu + + 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 + + // do +map stuff + if ( Dev_CommandLineHasParm( "+map" ) ) + thread DelayedMapCommand() +} + +void function DelayedMapCommand() +{ + // if we do this too early, game won't run the map command, so we have to wait a bit + // 5.0 was determined exclusively by trial and error but seems to work pretty well + // might be possible to just do this in native instead, but idk effort + wait 5.0 + SetConVarBool( "ns_auth_allow_insecure", true ) // good for testing + ClientCommand( "map " + Dev_CommandLineParmValue( "+map" ) ) + Dev_CommandLineRemoveParm( "+map" ) +} + +#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" ) + + 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() + +#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 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_SetVisible( file.trialLabel, lastIsTrialVersion ) + + 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" ) ) +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut index 7ed0d177..29daf0a8 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut @@ -59,7 +59,12 @@ void function UpdateVisibleMaps() if ( buttonID < file.mapsPerPage && mapID < GetPrivateMatchMaps().len() ) { string name = mapsArray[ mapID ] - SetButtonRuiText( button, GetMapDisplayName( name ) ) + + bool sp = name.find( "sp_" ) == 0 + if ( sp ) + SetButtonRuiText( button, Localize( "#PRIVATE_MATCH_SINGLEPLAYER_LEVEL", Localize( GetMapDisplayName( name ) ) ) ) + else + SetButtonRuiText( button, GetMapDisplayName( name ) ) Hud_SetEnabled( button, true ) if ( IsItemInEntitlementUnlock( name ) && IsValid( GetUIPlayer() ) ) @@ -73,7 +78,7 @@ void function UpdateVisibleMaps() bool mapSupportsMode = PrivateMatch_IsValidMapModeCombo( name, PrivateMatch_GetSelectedMode() ) Hud_SetLocked( button, !mapSupportsMode ) - if ( !mapSupportsMode ) + if ( !mapSupportsMode && !sp ) SetButtonRuiText( button, Localize( "#PRIVATE_MATCH_UNAVAILABLE", Localize( GetMapDisplayName( name ) ) ) ) } else diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut index 711cbbbc..be2a1048 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings_categories.nut @@ -25,31 +25,14 @@ void function OnNorthstarCustomMatchSettingsCategoryMenuOpened() array<string> categories = GetPrivateMatchSettingCategories() array<var> buttons = GetElementsByClassname( GetMenu( "CustomMatchSettingsCategoryMenu" ), "MatchSettingCategoryButton" ) - for ( int i = 0, j = 0; j < categories.len() && i < buttons.len(); i++, j++ ) + foreach ( var button in buttons ) { - Hud_SetEnabled( buttons[ i ], false ) - Hud_SetVisible( buttons[ i ], false ) + Hud_SetEnabled( button, false ) + Hud_SetVisible( button, false ) + } - // skip gamemode/playlist categories for modes that aren't the current one - // todo this fucking breaks everything lmao - //bool gamemode = categories[ j ].find( "#GAMEMODE_" ) == 0 - //if ( gamemode || categories[ j ].find( "#PL_" ) == 0 ) - //{ - // if ( gamemode ) - // { - // if ( categories[ j ].slice( 10 ) != PrivateMatch_GetSelectedMode() ) - // { - // i-- - // continue - // } - // } - // else if ( categories[ j ].slice( 4 ) != PrivateMatch_GetSelectedMode() ) - // { - // i-- - // continue - // } - //} - + for ( int i = 0, j = 0; j < categories.len() && i < buttons.len(); i++, j++ ) + { Hud_SetText( buttons[ i ], Localize( categories[ j ] ) + " ->" ) Hud_SetEnabled( buttons[ i ], true ) Hud_SetVisible( buttons[ i ], true ) 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 4a56891e..588fe705 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -1,6 +1,10 @@ global function AddNorthstarModMenu global function AddNorthstarModMenu_MainMenuFooter +struct { + bool shouldReloadModsOnEnd +} file + void function AddNorthstarModMenu() { AddMenu( "ModListMenu", $"resource/ui/menus/modlist.menu", InitModMenu ) @@ -21,15 +25,21 @@ void function InitModMenu() var menu = GetMenu( "ModListMenu" ) AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnModMenuOpened ) + AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnModMenuClosed ) AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( menu, BUTTON_Y, "#Y_RELOAD_MODS", "#RELOAD_MODS", ReloadMods ) + AddMenuFooterOption( menu, BUTTON_Y, "#Y_RELOAD_MODS", "#RELOAD_MODS", OnReloadModsButtonPressed ) foreach ( var button in GetElementsByClassname( GetMenu( "ModListMenu" ), "ModButton" ) ) + { AddButtonEventHandler( button, UIE_GET_FOCUS, OnModMenuButtonFocused ) + AddButtonEventHandler( button, UIE_CLICK, OnModMenuButtonPressed ) + } } void function OnModMenuOpened() { + file.shouldReloadModsOnEnd = false + Hud_SetText( Hud_GetChild( GetMenu( "ModListMenu" ), "Title" ), "#MENU_TITLE_MODS" ) array<var> buttons = GetElementsByClassname( GetMenu( "ModListMenu" ), "ModButton" ) @@ -47,10 +57,36 @@ void function OnModMenuOpened() Hud_SetEnabled( buttons[ i ], true ) Hud_SetVisible( buttons[ i ], true ) - SetButtonRuiText( buttons[ i ], modNames[ i ] + " v" + NSGetModVersionByModName( modNames[ i ] ) ) + SetModMenuNameText( buttons[ i ] ) } } +void function OnModMenuClosed() +{ + if ( file.shouldReloadModsOnEnd ) + ReloadMods() +} + +void function SetModMenuNameText( var button ) +{ + string modName = NSGetModNames()[ int ( Hud_GetScriptID( button ) ) ] + + // should be localisation at some point + if ( NSIsModEnabled( modName ) ) + SetButtonRuiText( button, modName + " v" + NSGetModVersionByModName( modName ) ) + else + SetButtonRuiText( button, modName + " (DISABLED)" ) +} + +void function OnModMenuButtonPressed( var button ) +{ + string modName = NSGetModNames()[ int ( Hud_GetScriptID( button ) ) ] + NSSetModEnabled( modName, !NSIsModEnabled( modName ) ) + SetModMenuNameText( button ) + + file.shouldReloadModsOnEnd = true +} + void function OnModMenuButtonFocused( var button ) { string modName = NSGetModNames()[ int ( Hud_GetScriptID( button ) ) ] @@ -101,8 +137,17 @@ string function FormatModDescription( string modName ) return ret } -void function ReloadMods( var button ) +void function OnReloadModsButtonPressed( var button ) +{ + ReloadMods() +} + +void function ReloadMods() { NSReloadMods() - OnModMenuOpened() // temp, until we start doing uiscript_reset here + ClientCommand( "reload_localization" ) + ClientCommand( "loadPlaylists" ) + // ClientCommand( "weapon_reparse" ) // this doesn't work, weapon_reparse only works if a server is running and sv_cheats is 1, gotta figure this out eventually + // 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" ) }
\ No newline at end of file diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index bbeb0d0b..121de614 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -195,4 +195,22 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) if ( NSWasAuthSuccessful() ) NSConnectToAuthedServer() + else + { + print( "fuck" ) + + DialogData dialogData + dialogData.header = "#ERROR" + dialogData.message = "Authentication Failed" + dialogData.image = $"ui/menu/common/dialog_error" + + #if PC_PROG + AddDialogButton( dialogData, "#DISMISS" ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + #endif // PC_PROG + AddDialogFooter( dialogData, "#B_BUTTON_DISMISS_RUI" ) + + OpenDialog( dialogData ) + } }
\ No newline at end of file diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut index d203a673..41721455 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -91,6 +91,19 @@ const table<asset> mapImages = mp_rise = $"loadscreens/mp_rise_lobby", mp_lf_township = $"loadscreens/mp_lf_township_lobby", mp_lf_uma = $"loadscreens/mp_lf_uma_lobby", + + // not really sure if this should be here, whatever + // might be good to make this modular in the future? + sp_training = $"rui/menu/level_select/level_image1", + sp_crashsite = $"rui/menu/level_select/level_image2", + sp_sewers1 = $"rui/menu/level_select/level_image3", + sp_boomtown_start = $"rui/menu/level_select/level_image4", + sp_hub_timeshift = $"rui/menu/level_select/level_image5", + sp_beacon = $"rui/menu/level_select/level_image6", + sp_tday = $"rui/menu/level_select/level_image7", + sp_s2s = $"rui/menu/level_select/level_image8", + sp_skyway_v1 = $"rui/menu/level_select/level_image9", + } void function MenuPrivateMatch_Init() @@ -630,7 +643,7 @@ function UpdateLobby() { bool shouldBreak = false - foreach ( string category in GetPrivateMatchSettingCategories() ) + foreach ( string category in GetPrivateMatchSettingCategories( true ) ) { foreach ( CustomMatchSettingContainer setting in GetPrivateMatchCustomSettingsForCategory( category ) ) { diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index acd11237..d42a2331 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -32,6 +32,11 @@ const DEBUG_PERMISSIONS = false void function InitMainMenuPanel() { + // disable communities because of the cool openinvite exploit (not required anymore but keeping here anyway + SetConVarBool( "communities_enabled", false ) + SetConVarString( "communities_hostname", "localhost" ) + + RegisterSignal( "EndShowMainMenuPanel" ) file.panel = GetPanel( "MainMenuPanel" ) @@ -77,7 +82,7 @@ void function InitMainMenuPanel() var multiplayerHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MULTIPLAYER_ALLCAPS" ) file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" ) Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate ) - file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#GAMEMODE_COOP" ) + file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" ) Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate ) headerIndex++ @@ -443,7 +448,7 @@ void function UpdatePlayButton( var button ) //else //{ //ComboButton_SetText( file.fdButton, "#MULTIPLAYER_LAUNCH_FD" ) - ComboButton_SetText( file.fdButton, "Launch Northstar" ) // this needs to use localised text at some point when we have a modular way of doing that + 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 ) //} @@ -521,6 +526,9 @@ void function TryAuthWithLocalServer() if ( NSWasAuthSuccessful() ) NSCompleteAuthWithLocalServer() + if ( GetConVarString( "mp_gamemode" ) == "solo" ) + SetConVarString( "mp_gamemode", "tdm" ) + ClientCommand( "setplaylist tdm" ) ClientCommand( "map mp_lobby" ) } |