diff options
author | RoyalBlue <11448698+RoyalBlue1@users.noreply.github.com> | 2023-10-15 02:09:29 +0200 |
---|---|---|
committer | RoyalBlue <11448698+RoyalBlue1@users.noreply.github.com> | 2023-10-15 02:09:29 +0200 |
commit | ad70253601a77844347d8aa1989ae5ab4fb4217c (patch) | |
tree | 336778ee63ed5bd82a0245dda2eedd8c99e47e83 /Northstar.Client/mod/scripts/vscripts/ui | |
parent | 9c13170e72f04050055695c25bc3b0a807d400e3 (diff) | |
parent | a7d40aac072c6725548c2ba6d6a9ab649191594f (diff) | |
download | NorthstarMods-ad70253601a77844347d8aa1989ae5ab4fb4217c.tar.gz NorthstarMods-ad70253601a77844347d8aa1989ae5ab4fb4217c.zip |
Merge remote-tracking branch 'upsteam/main' into gamemode_fd
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
11 files changed, 1541 insertions, 74 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut new file mode 100644 index 00000000..89b7f719 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut @@ -0,0 +1,56 @@ +global function AtlasAuthDialog + +void function AtlasAuthDialog() +{ + thread AtlasAuthDialog_Threaded() +} + +void function AtlasAuthDialog_Threaded() +{ + // wait at least 1 frame so that the main menu can be loaded first + WaitFrame() + + while ( !NSIsMasterServerAuthenticated() || GetConVarBool( "ns_auth_allow_insecure" ) ) + WaitFrame() + + if ( GetConVarBool( "ns_auth_allow_insecure" ) ) + return + + MasterServerAuthResult res = NSGetMasterServerAuthResult() + + // do nothing on successful authentication + if ( res.success ) + return + + EmitUISound( "blackmarket_purchase_fail" ) + + DialogData dialogData + dialogData.image = $"ui/menu/common/dialog_error" + dialogData.header = Localize( "#AUTHENTICATION_FAILED_HEADER" ) + + // if we got a special error message from Atlas, display it + if ( res.errorMessage != "" ) + dialogData.message = res.errorMessage + else + dialogData.message = Localize( "#AUTHENTICATION_FAILED_BODY" ) + + if ( res.errorCode != "" ) + dialogData.message += format( "\n\n%s", Localize( "#AUTHENTICATION_FAILED_ERROR_CODE", res.errorCode ) ) + + string link = "https://r2northstar.gitbook.io/r2northstar-wiki/installing-northstar/troubleshooting" + // link to generic troubleshooting page if we don't have an error code from Atlas + if ( res.errorCode != "" ) + link = format( "%s#%s", link, res.errorCode ) + + CloseAllDialogs() + AddDialogButton( dialogData, "#OK" ) + AddDialogButton( dialogData, Localize( "#AUTHENTICATION_FAILED_HELP" ), void function() : ( dialogData, link ) + { + // todo: get MS to redirect, so i can use an MS link or something? + LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) + // keep the dialog open + OpenDialog( dialogData ) + } ) + + OpenDialog( dialogData ) +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/chatroom.nut b/Northstar.Client/mod/scripts/vscripts/ui/chatroom.nut new file mode 100644 index 00000000..4e98ee8a --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/chatroom.nut @@ -0,0 +1,902 @@ +untyped + +global function Chatroom_GlobalInit +global function InitChatroom +global function UpdateChatroomUI +global function UICodeCallback_ShowUserInfo +global function UICodeCallback_RemoteMatchInfoUpdated +global function UICodeCallback_SetChatroomMode +global function UpdateOpenInvites +global function HideOpenInvite +global function ShowOpenInvite +global function FillInUserInfoPanel +global function UpdateChatroomThread +global function IsVoiceChatPushToTalk + +global function bsupdate + +global const LOBBY_MATERIAL_OWNER = $"rui/menu/common/lobby_icon_owner" +global const LOBBY_MATERIAL_ADMIN = $"rui/menu/common/lobby_icon_admin" + +struct RemoteMatchPlayerInfoRow +{ + var playerPanel + var name + var score + var kills + var deaths +} + +struct RemoteMatchInfoPanel +{ + var panel + var PlaylistName + var MapName + var ModeName + var TimeLeft + var ScoreLimit + var Team1Score + var Team2Score + array<RemoteMatchPlayerInfoRow> team1Players + array<RemoteMatchPlayerInfoRow> team2Players +} + +struct OpenInviteUI +{ + var openInviteJoinButton + var openInvitePanel + var openInviteMessage + var openInviteCountdownText + array openInvitePlayerSlots + array openInvitePlaylistSlots +} + +global struct UserInfoPanel +{ + var Panel + var Name + var Kills + var Wins + var Losses + var Deaths + var XP + var callsignCard + array communityLabels + array communityNames +} + +struct ChatroomWidget +{ + var chatroomPanel + var chatroomWidget + var chatroomTextChat + + var chatroomBackground + var chatroomDivider + var chatroomHappyHour + var chatroomMode + + UserInfoPanel userInfoPanel + + RemoteMatchInfoPanel remoteMatchInfoPanelWidgets + + var communityChatroomModeButton + var chatroomHintText + var happyHourTimeLeft + + OpenInviteUI openInviteUI +} + +struct +{ + string userInfoPanel_hardware = "" + string userInfoPanel_userId = "0" + var communityChatroomMode + bool currentUserIsStreaming = false + array<ChatroomWidget> chatroomUIs + bool hasFocus +} file + +bool function IsVoiceChatPushToTalk() +{ + if ( GetPartySize() > 1 ) + return true + return DoesCurrentCommunitySupportChat() +} + +void function UICodeCallback_SetChatroomMode( string mode ) +{ + file.communityChatroomMode = mode + UpdateChatroomUI() +} + +void function UpdateChatroomUI() +{ + foreach ( chatroomUI in file.chatroomUIs ) + { + if ( file.communityChatroomMode == "chatroom" ) + { + int communityId = GetCurrentCommunityId() + CommunitySettings ornull communitySettings = GetCommunitySettings( communityId ) + + string communityName + if ( communitySettings != null ) + { + expect CommunitySettings( communitySettings ) + communityName = GetCurrentCommunityName() + " [" + communitySettings.clanTag + "]" + } + else + { + communityName = expect string( GetCurrentCommunityName() ) + } + + if ( IsChatroomMuted() ) + SetLabelRuiText( chatroomUI.communityChatroomModeButton, Localize( "#COMMUNITY_CHATROOM_MUTED", communityName ) ) + else + SetLabelRuiText( chatroomUI.communityChatroomModeButton, Localize( "#COMMUNITY_CHATROOM", communityName ) ) + } + else if ( file.communityChatroomMode == "party" ) + { + SetLabelRuiText( chatroomUI.communityChatroomModeButton, Localize( "#COMMUNITY_PARTY", GetPartyLeaderName() ) ) + } + else + { + SetLabelRuiText( chatroomUI.communityChatroomModeButton, Localize( file.communityChatroomMode ) ) + } + + int meritsLeft = GetHappyHourMeritsLeft() + if ( meritsLeft == 0 ) + { + SetLabelRuiText( chatroomUI.happyHourTimeLeft, Localize( "#HAPPYHOUR_NOMERITSLEFT", meritsLeft ) ) + SetNamedRuiText( chatroomUI.happyHourTimeLeft, "happyHourHintString", "" ) + //SetNamedRuiText( chatroomUI.happyHourTimeLeft, "happyHourHintString", Localize( "#HAPPYHOUR_HINT_ACTIVE_01" ) ) + } + else if ( meritsLeft >= 1 ) + { + SetLabelRuiText( chatroomUI.happyHourTimeLeft, Localize( GetHappyHourStatus() ) ) + SetNamedRuiText( chatroomUI.happyHourTimeLeft, "happyHourHintString", Localize( "#HAPPYHOUR_HINT_MERITS", 5 ) ) + } + UICodeCallback_ShowUserInfo( file.userInfoPanel_hardware, file.userInfoPanel_userId ) + } + + UpdateFooterOptions() +} + +bool function FillInCommunityMembership( UserInfoPanel userInfoPanel, CommunityMembership membershipData, int communityIndex ) +{ + if ( userInfoPanel.communityNames.len() <= communityIndex ) + return false; + + string title + title = "[" + membershipData.communityClantag + "] " + Localize( membershipData.communityName ); + + if ( membershipData.membershipLevel == "owner" ) + Hud_SetText( userInfoPanel.communityLabels[communityIndex], "#COMMUNITY_MEMBERSHIP_OWNER" ) + else if ( membershipData.membershipLevel == "admin" ) + Hud_SetText( userInfoPanel.communityLabels[communityIndex], "#COMMUNITY_MEMBERSHIP_ADMIN" ) + else if ( membershipData.membershipLevel == "member" ) + Hud_SetText( userInfoPanel.communityLabels[communityIndex], "#COMMUNITY_MEMBERSHIP_MEMBER" ) + else + Assert( false, "Unknown membership level " + membershipData.membershipLevel + " in FillInCommunityMembership" ) + + Hud_SetText( userInfoPanel.communityNames[communityIndex], title ) + Hud_Show( userInfoPanel.communityLabels[communityIndex] ); + Hud_Show( userInfoPanel.communityNames[communityIndex] ); + + return true +} + +void function FillInUserInfoPanel( UserInfoPanel userInfoPanel, CommunityUserInfo userInfo ) +{ + file.currentUserIsStreaming = userInfo.isLivestreaming + + Hud_SetText( userInfoPanel.Name, userInfo.name ) + string killsText = "" + userInfo.kills + Hud_SetText( userInfoPanel.Kills, killsText ) + string winsText = "" + userInfo.wins + Hud_SetText( userInfoPanel.Wins, winsText ) + string lossesText = "" + userInfo.losses + Hud_SetText( userInfoPanel.Losses, lossesText ) + string deathsText = "" + userInfo.deaths + Hud_SetText( userInfoPanel.Deaths, deathsText ) + string xpText = ShortenNumber( userInfo.xp ) + Hud_EnableKeyBindingIcons( userInfoPanel.XP ) + Hud_SetText( userInfoPanel.XP, Localize( "#CREDITSIGN_N", xpText ) ) + + CallingCard callingCard = CallingCard_GetByIndex( userInfo.callingCardIdx ) + CallsignIcon callsignIcon = CallsignIcon_GetByIndex( userInfo.callSignIdx ) + + var card = userInfoPanel.callsignCard + var rui = Hud_GetRui( userInfoPanel.callsignCard ) + RuiSetImage( rui, "cardImage", callingCard.image ) + RuiSetImage( rui, "iconImage", callsignIcon.image ) + RuiSetInt( rui, "layoutType", callingCard.layoutType ) + RuiSetImage( rui, "cardGenImage", GetGenIcon( userInfo.gen, userInfo.lvl ) ) + RuiSetString( rui, "playerLevel", PlayerXPDisplayGenAndLevel( userInfo.gen, userInfo.lvl ) ) + RuiSetString( rui, "playerName", userInfo.name ) + + array<CommunityMembership> ownerCommunities + array<CommunityMembership> adminCommunities + array<CommunityMembership> memberCommunities + + for ( int i = 0; i < userInfo.numCommunities; i++ ) + { + CommunityMembership ornull communityInfo = GetCommunityUserMembershipInfo( userInfo.hardware, userInfo.uid, i ) + if ( !communityInfo ) + continue; + expect CommunityMembership( communityInfo ) + string membershipLevel = communityInfo.membershipLevel + if ( membershipLevel == "owner" ) + { + ownerCommunities.append( communityInfo ) + } + else if ( membershipLevel == "admin" ) + { + adminCommunities.append( communityInfo ) + } + else if ( membershipLevel == "member" ) + { + memberCommunities.append( communityInfo ) + } + else + { + printt( "Unknown membershipLevel " + membershipLevel ) + Assert( false, "Unknown membershipLevel" ) + } + } + + array<CommunityMembership> allCommunities + for ( int i = 0; i < ownerCommunities.len(); i++ ) + allCommunities.append( ownerCommunities[i] ) + for ( int i = 0; i < adminCommunities.len(); i++ ) + allCommunities.append( adminCommunities[i] ) + for ( int i = 0; i < memberCommunities.len(); i++ ) + allCommunities.append( memberCommunities[i] ) + + int currentCommunityIndex = 0 + for ( ; currentCommunityIndex < allCommunities.len(); currentCommunityIndex++ ) + { + if ( !FillInCommunityMembership( userInfoPanel, allCommunities[currentCommunityIndex], currentCommunityIndex ) ) + break; + } + + for ( ; currentCommunityIndex < userInfoPanel.communityNames.len(); currentCommunityIndex++ ) + { + Hud_Hide( userInfoPanel.communityLabels[currentCommunityIndex] ); + Hud_Hide( userInfoPanel.communityNames[currentCommunityIndex] ); + } + + UpdateFooterOptions() +} + +void function GetUserInfoThread( string hardware, string userId ) +{ + EndSignal( uiGlobal.signalDummy, "StopUserInfoLookups" ) + + printt( "getting userinfo for user " + userId ) + + CommunityUserInfo fakeSettings + fakeSettings.name = Localize( "#COMMUNITY_FETCHING" ) + foreach ( chatroomUI in file.chatroomUIs ) + FillInUserInfoPanel( chatroomUI.userInfoPanel, fakeSettings ) + + while ( true ) + { + printt( "asking for userinfo for " + hardware + "=" + userId ) + + CommunityUserInfo ornull userInfo = GetCommunityUserInfo( hardware, userId ) + if ( !userInfo ) + { + wait 0.05 + } + else + { + printt( "Got user info for user " + userId + " on hardware " + hardware ) + expect CommunityUserInfo( userInfo ) + + printt( "User " + userId + " is in " + userInfo.numCommunities + " communities" ) + + foreach ( chatroomUI in file.chatroomUIs ) + FillInUserInfoPanel( chatroomUI.userInfoPanel, userInfo ) + break + } + } +} + + +void function UICodeCallback_ShowUserInfo( string hardware, string userId ) +{ + Signal( uiGlobal.signalDummy, "StopUserInfoLookups" ) + + // printt( "Showing user info for UID " + userId + " on hardware " + hardware ) + + file.userInfoPanel_userId = userId + file.userInfoPanel_hardware = hardware + + if ( hardware == "" && userId == "0" ) + { + foreach ( chatroomUI in file.chatroomUIs ) + Hud_Hide( chatroomUI.userInfoPanel.Panel ) + + foreach ( chatroomUI in file.chatroomUIs ) + { + // Hud_SetWidth( chatrooUI.chatroomWidget, Hud_GetBaseWidth( chatrooUI.chatroomWidget ) ) + Hud_SetWidth( chatroomUI.chatroomBackground, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) ) + Hud_Show( chatroomUI.chatroomDivider ) + // Hud_SetWidth( chatrooUI.chatroomHeader, Hud_GetBaseWidth( chatrooUI.chatroomHeader ) ) + // Hud_SetWidth( chatrooUI.chatroomMode, Hud_GetBaseWidth( chatrooUI.chatroomBackground ) ) + #if CONSOLE_PROG + Hud_Show( chatroomUI.chatroomHintText ) + #else + Hud_Show( chatroomUI.chatroomTextChat ) + #endif + } + } + else + { + foreach ( chatroomUI in file.chatroomUIs ) + Hud_Show( chatroomUI.userInfoPanel.Panel ) + + foreach ( chatroomUI in file.chatroomUIs ) + { + // Hud_SetWidth( chatroomUI.chatroomWidget, Hud_GetBaseWidth( chatroomUI.chatroomWidget ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 24 ) + Hud_SetWidth( chatroomUI.chatroomBackground, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 12 ) + Hud_Hide( chatroomUI.chatroomDivider ) + // Hud_SetWidth( chatroomUI.chatroomHeader, Hud_GetBaseWidth( chatroomUI.chatroomHeader ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 12 ) + // Hud_SetWidth( chatroomUI.chatroomMode, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 24 ) + #if CONSOLE_PROG + Hud_Hide( chatroomUI.chatroomHintText ) + #else + Hud_Hide( chatroomUI.chatroomTextChat ) + #endif + } + + thread GetUserInfoThread( hardware, userId ) + } +} + +void function FindRemoteMatchInfoWidgetsInPanel( RemoteMatchInfoPanel infostruct, var panel ) +{ + infostruct.PlaylistName = Hud_GetChild( panel, "PlaylistName" ) + infostruct.MapName = Hud_GetChild( panel, "MapName" ) + infostruct.ModeName = Hud_GetChild( panel, "ModeName" ) + infostruct.TimeLeft = Hud_GetChild( panel, "TimeLeft" ) + infostruct.ScoreLimit = Hud_GetChild( panel, "ScoreLimit" ) + infostruct.Team1Score = Hud_GetChild( panel, "Team1Score" ) + infostruct.Team2Score = Hud_GetChild( panel, "Team2Score" ) + for ( int i = 1; i <= 2; i++ ) + { + array<RemoteMatchPlayerInfoRow> teamPlayers + if ( i == 1 ) + teamPlayers = infostruct.team1Players + else + teamPlayers = infostruct.team2Players + + for ( int j = 1; j <= 8; j++ ) + { + RemoteMatchPlayerInfoRow teamPlayer + string key = "Team" + i + "Player" + j + teamPlayer.playerPanel = Hud_GetChild( panel, key ) + teamPlayer.name = Hud_GetChild( teamPlayer.playerPanel, "Name" ) + teamPlayer.score = Hud_GetChild( teamPlayer.playerPanel, "Score" ) + teamPlayer.kills = Hud_GetChild( teamPlayer.playerPanel, "Kills" ) + teamPlayer.deaths = Hud_GetChild( teamPlayer.playerPanel, "Deaths" ) + teamPlayers.append( teamPlayer ) + } + } +} + +int function RemoteMatchInfoPlayerSort( RemoteClientInfoFromMatchInfo a, RemoteClientInfoFromMatchInfo b ) +{ + return ( b.score - a.score ) +} + +void function FillInRemoteMatchInfoPanel( RemoteMatchInfo info, RemoteMatchInfoPanel panel ) +{ + Hud_Show( panel.panel ) + + Hud_SetText( panel.PlaylistName, GetPlaylistDisplayName( info.playlist ) ) + Hud_SetText( panel.MapName, Localize( "#" + info.map ) ) + + string modeName + + if ( IsFDMode( info.gamemode ) ) + { + modeName = "#GAMEMODE_COOP" + // HACK because fd has multiple gamemodes in playlists + } + else + { + modeName = GAMETYPE_TEXT[ info.gamemode ] + } + + if ( IsFullyConnected() ) + modeName = GetGameModeDisplayName( info.gamemode ) + + Hud_SetText( panel.ModeName, modeName ) + int minsLeft = info.timeLeftSecs / 60 + int secsLeft = info.timeLeftSecs % 60 + string timeLeft = "" + minsLeft + if ( secsLeft < 10 ) + timeLeft = timeLeft + ":0" + secsLeft + else + timeLeft = timeLeft + ":" + secsLeft + Hud_SetText( panel.TimeLeft, timeLeft ) + string scoreLimit = "" + info.maxScore + Hud_SetText( panel.ScoreLimit, scoreLimit ) + string imcScore = "" + info.teamScores[TEAM_IMC] + string milScore = "" + info.teamScores[TEAM_MILITIA] + Hud_SetText( panel.Team1Score, imcScore ) + Hud_SetText( panel.Team2Score, milScore ) + + int team1PlayerCount = 0 + int team2PlayerCount = 0 + + info.clients.sort( RemoteMatchInfoPlayerSort ) + + for ( int i = 0; i < info.clients.len(); i++ ) + { + RemoteMatchPlayerInfoRow teamPlayer + if ( info.clients[i].teamNum == TEAM_IMC ) + { + if ( team1PlayerCount >= panel.team1Players.len() ) + { + printt( "too many team players" ) + continue + } + + teamPlayer = panel.team1Players[team1PlayerCount] + team1PlayerCount++ + } + else if ( info.clients[i].teamNum == TEAM_MILITIA ) + { + if ( team2PlayerCount >= panel.team2Players.len() ) + { + printt( "too many team players" ) + continue + } + + teamPlayer = panel.team2Players[team2PlayerCount] + team2PlayerCount++ + } + else + { + printt( "Unhandled player team " + info.clients[i].teamNum ) + continue + } + string score = "" + info.clients[i].score + string kills = "" + info.clients[i].kills + string deaths = "" + info.clients[i].deaths + + Hud_Hide( teamPlayer.playerPanel ) // not enough room for these + Hud_SetText( teamPlayer.name, info.clients[i].name ) + Hud_SetText( teamPlayer.score, score ) + Hud_SetText( teamPlayer.kills, kills ) + Hud_SetText( teamPlayer.deaths, deaths ) + } + for ( int i = team1PlayerCount; i < panel.team1Players.len(); i++ ) + Hud_Hide( panel.team1Players[i].playerPanel ) + for ( int i = team2PlayerCount; i < panel.team2Players.len(); i++ ) + Hud_Hide( panel.team2Players[i].playerPanel ) + +} + +void function RemoteMatchInfoVisibilityThread() +{ + EndSignal( uiGlobal.signalDummy, "StopRemoteMatchInfoThread" ) + wait 2 + foreach ( chatroomUI in file.chatroomUIs ) + Hud_Hide( chatroomUI.remoteMatchInfoPanelWidgets.panel ) +} + +void function UICodeCallback_RemoteMatchInfoUpdated() +{ + printt( "Remote Match Info Updated!" ) + + RemoteMatchInfo info = GetRemoteMatchInfo() + foreach ( chatroomUI in file.chatroomUIs ) + FillInRemoteMatchInfoPanel( info, chatroomUI.remoteMatchInfoPanelWidgets ) + + Signal( uiGlobal.signalDummy, "StopRemoteMatchInfoThread" ) + thread RemoteMatchInfoVisibilityThread() +} + +void function Chatroom_GlobalInit() +{ + RegisterSignal( "StopRemoteMatchInfoThread" ) +} + +bool function IsSelectedUserStreaming() +{ + if ( !ChatroomHasFocus() ) + return false + return file.currentUserIsStreaming +} + +void function InitChatroom( var parentMenu ) +{ + RegisterSignal( "StopUserInfoLookups" ) + + file.communityChatroomMode = "chatroom" + + var menu = Hud_GetChild( parentMenu, "ChatroomPanel" ) + + ChatroomWidget chatroomUI + file.chatroomUIs.append( chatroomUI ) + + chatroomUI.chatroomPanel = menu + chatroomUI.chatroomWidget = Hud_GetChild( menu, "ChatRoom" ) + chatroomUI.chatroomTextChat = Hud_GetChild( menu, "ChatRoomTextChat" ) + chatroomUI.chatroomBackground = Hud_GetChild( menu, "ChatbarBackground" ) + chatroomUI.chatroomDivider = Hud_GetChild( menu, "ChatroomHeaderBackground" ) + chatroomUI.chatroomHappyHour = Hud_GetChild( menu, "HappyHourTimeLeft" ) + chatroomUI.chatroomMode = Hud_GetChild( menu, "CommunityChatRoomMode" ) + + var remoteMatchInfoPanel = Hud_GetChild( parentMenu, "MatchDetails" ) + chatroomUI.remoteMatchInfoPanelWidgets.panel = remoteMatchInfoPanel + FindRemoteMatchInfoWidgetsInPanel( chatroomUI.remoteMatchInfoPanelWidgets, remoteMatchInfoPanel ) + + chatroomUI.userInfoPanel.Panel = Hud_GetChild( parentMenu, "UserInfo" ) + chatroomUI.userInfoPanel.Name = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Name" ) + chatroomUI.userInfoPanel.Kills = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Kills" ) + chatroomUI.userInfoPanel.Wins = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Wins" ) + chatroomUI.userInfoPanel.Losses = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Losses" ) + chatroomUI.userInfoPanel.Deaths = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Deaths" ) + chatroomUI.userInfoPanel.XP = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "XP" ) + chatroomUI.userInfoPanel.callsignCard = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "CallsignCard" ) + + // chatroomUI.userInfoPanel.ViewUserCardButton = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "ViewUserCard" ) + + for ( int i = 0; i < 6; i++ ) + { + if ( !Hud_HasChild( chatroomUI.userInfoPanel.Panel, "Community" + i + "Label" ) ) + break; + var communityLabel = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Community" + i + "Label" ) + var communityName = Hud_GetChild( chatroomUI.userInfoPanel.Panel, "Community" + i ) + Assert( communityName, "found Community" + i + "Label, but no Community" + i + " in userInfo panel" ); + chatroomUI.userInfoPanel.communityLabels.append( communityLabel ) + chatroomUI.userInfoPanel.communityNames.append( communityName ) + } + + chatroomUI.communityChatroomModeButton = Hud_GetChild( menu, "CommunityChatRoomMode" ) +#if CONSOLE_PROG + chatroomUI.chatroomHintText = Hud_GetChild( menu, "TextChatHintForConsole" ) +#endif + chatroomUI.happyHourTimeLeft = Hud_GetChild( menu, "HappyHourTimeLeft" ) + // Hud_EnableKeyBindingIcons( chatroomUI.communityChatroomModeButton ) + + OpenInviteUI openInviteUI = chatroomUI.openInviteUI + openInviteUI.openInvitePanel = Hud_GetChild( parentMenu, "OpenInvitePanel" ) + openInviteUI.openInviteMessage = Hud_GetChild( openInviteUI.openInvitePanel, "OpenInviteMessage" ) + openInviteUI.openInviteCountdownText = Hud_GetChild( openInviteUI.openInvitePanel, "OpenInviteCountdownText" ) + + var openInviteBackground = Hud_GetChild( openInviteUI.openInvitePanel, "OpenInviteBox" ) + RuiSetColorAlpha( Hud_GetRui( openInviteBackground ), "backgroundColor", <0, 0, 0>, 0.9 ) + + int i = 0; + while ( i < 8 ) + { + int count = i + 1 + var widget = Hud_GetChild( openInviteUI.openInvitePanel, "OpenInvitePlayer" + count ) + if ( !widget ) + break + openInviteUI.openInvitePlayerSlots.append( widget ) + i++ + } + for ( int idx = 0; idx < 9; ++idx ) + { + string widgetName = ("OpenInvitePlaylist" + format( "%02d", idx )) + var widget = Hud_GetChild( openInviteUI.openInvitePanel, widgetName ) + openInviteUI.openInvitePlaylistSlots.append( widget ) + i++ + } + + openInviteUI.openInviteJoinButton = Hud_GetChild( openInviteUI.openInvitePanel, "JoinOpenInviteButton" ) + Hud_EnableKeyBindingIcons( openInviteUI.openInviteJoinButton ) + + AddEventHandlerToButton( openInviteUI.openInvitePanel, "JoinOpenInviteButton", UIE_CLICK, JoinOpenInvite_OnClick ) + AddEventHandlerToButton( openInviteUI.openInvitePanel, "OpenInviteCountdownText", UIE_CLICK, JoinOpenInvite_OnClick ) + AddEventHandlerToButton( openInviteUI.openInvitePanel, "OpenInviteMessageButtonOverlay", UIE_CLICK, JoinOpenInvite_OnClick ) + + AddMenuFooterOption( parentMenu, BUTTON_SHOULDER_LEFT, "#LB_MUTEROOM", "#MUTEROOM", MuteRoom, ChatroomIsNotMuted ) + AddMenuFooterOption( parentMenu, BUTTON_SHOULDER_LEFT, "#LB_UNMUTEROOM", "#UNMUTEROOM", UnmuteRoom, ChatroomIsMuted ) + AddMenuFooterOption( parentMenu, BUTTON_Y, "#Y_BUTTON_OPENINVITE_DESTROY_FOOTER", "#OPENINVITE_DESTROY", LeaveOpenInviteButton, CanDestroyOpenInvite ) + AddMenuFooterOption( parentMenu, BUTTON_Y, "#Y_BUTTON_OPENINVITE_JOIN_FOOTER", "#OPENINVITE_JOIN", JoinOpenInvite, CanJoinOpenInvite ) + AddMenuFooterOption( parentMenu, BUTTON_Y, "#Y_BUTTON_OPENINVITE_LEAVE_FOOTER", "#OPENINVITE_LEAVE", LeaveOpenInviteButton, CanLeaveOpenInvite ) + AddMenuFooterOption( parentMenu, BUTTON_A, "#BUTTON_VIEW_PLAYER_PROFILE", "#MOUSE1_VIEW_PROFILE", null, IsChatroomViewProfileValid ) + AddMenuFooterOption( parentMenu, BUTTON_SHOULDER_RIGHT, "#COMMUNITY_RB_CHATROOM_VIEWSTREAM", "#COMMUNITY_CHATROOM_VIEWSTREAM", null, IsSelectedUserStreaming ) + AddMenuFooterOption( parentMenu, BUTTON_X, "#BUTTON_MUTE", "#MOUSE2_MUTE", null, ChatroomHasFocus ) + + UpdateChatroomUI() + + Hud_AddEventHandler( chatroomUI.chatroomWidget, UIE_LOSE_FOCUS, LostFocus ) + Hud_AddEventHandler( chatroomUI.chatroomWidget, UIE_GET_FOCUS, GotFocus ) +} + +void function bsupdate() +{ + ShowOpenInvite() + + OpenInvite openInvite + openInvite.amILeader = false + openInvite.amIInThis = false + openInvite.numSlots = 5 + openInvite.numClaimedSlots = 1 + + string inviteString = openInvite.amILeader ? "#OPENINVITE_SENDER_PLAYLIST" : "#OPENINVITE_PLAYLIST" + + float endTime = Time() + 10.0 + while ( Time() < endTime ) + { + openInvite.timeLeft = endTime - Time() + + int remainingTime = int( ceil( endTime - Time() ) ) + UpdateOpenInvites( openInvite, inviteString, "scriptacus", "Bounty Hunt", remainingTime ) + + if ( remainingTime == 8 ) + openInvite.numClaimedSlots = 2 + + if ( remainingTime == 6 ) + openInvite.numClaimedSlots = 4 + + //if ( remainingTime == 5 ) + // openInvite.numClaimedSlots = 5 + // + //if ( remainingTime == 4 ) + // openInvite.numClaimedSlots = 6 + + WaitFrame() + } +} + +void function UpdateOpenInvites( OpenInvite openInvite, string message, string param1, string ornull param2, int countdown ) +{ + foreach ( chatroomUI in file.chatroomUIs ) + { + if ( param2 ) + Hud_SetText( chatroomUI.openInviteUI.openInviteMessage, message, param1, param2 ); + else + Hud_SetText( chatroomUI.openInviteUI.openInviteMessage, message, param1 ); + + string countdownText = "" + countdown +// Hud_SetText( chatroomUI.openInviteUI.openInviteCountdownText, "#OPENINVITE_COUNTDOWN", countdownText ) + var countdownRui = Hud_GetRui( chatroomUI.openInviteUI.openInviteCountdownText ) + RuiSetFloat( countdownRui, "timeLeft", openInvite.timeLeft ) + RuiSetFloat( countdownRui, "maxTime", GetConVarFloat( "openinvite_duration_default" ) ) + + bool started = openInvite.timeLeft <= 0 || openInvite.numFreeSlots == 0 + + if ( started ) + { + Hud_Hide( chatroomUI.openInviteUI.openInviteJoinButton ) + } + else if ( CanDestroyOpenInvite() ) + { + Hud_Show( chatroomUI.openInviteUI.openInviteJoinButton ) + if ( IsControllerModeActive() ) + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#Y_BUTTON_OPENINVITE_DESTROY" ) + else + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#OPENINVITE_DESTROY" ) + } + else if ( CanLeaveOpenInvite() ) + { + Hud_Show( chatroomUI.openInviteUI.openInviteJoinButton ) + if ( IsControllerModeActive() ) + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#Y_BUTTON_OPENINVITE_LEAVE" ) + else + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#OPENINVITE_LEAVE" ) + } + else if ( CanJoinOpenInvite() ) + { + Hud_Show( chatroomUI.openInviteUI.openInviteJoinButton ) + if ( IsControllerModeActive() ) + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#Y_BUTTON_OPENINVITE_JOIN" ) + else + SetNamedRuiText( chatroomUI.openInviteUI.openInviteJoinButton, "buttonText", "#OPENINVITE_JOIN" ) + } + + string myUID = GetPlayerUID() + int i = 0 + foreach ( player in chatroomUI.openInviteUI.openInvitePlayerSlots ) + { + var rui = Hud_GetRui( player ) + Hud_Show( player ) + + if ( i >= openInvite.numSlots ) + { + //Hud_Hide( player ) + RuiSetBool( rui, "isEnabled", false ) + RuiSetBool( rui, "hasPlayer", false ) + } + else + { + CallsignIcon callsignIcon + bool isMe = false + // asset playerImage + + if ( i < openInvite.numClaimedSlots ) + { + PartyMember member = openInvite.members[i] + isMe = ( member.uid == myUID ) + if ( isMe ) + { + if ( GetUIPlayer() != null ) // this can happen sometimes after a resolution/windowed mode change + callsignIcon = PlayerCallsignIcon_GetActive( GetUIPlayer() ) + else + callsignIcon = CallsignIcon_GetByRef( "gc_icon_happyface" ) + } + else + { + callsignIcon = CallsignIcon_GetByIndex( member.callsignIdx ) + } + } + else + { + callsignIcon = CallsignIcon_GetByRef( "gc_icon_happyface" ) + } + + Hud_Show( player ) + RuiSetBool( rui, "isEnabled", true ) + + RuiSetBool( rui, "hasPlayer", i < openInvite.numClaimedSlots ) + RuiSetBool( rui, "isViewPlayer", isMe ) + RuiSetImage( rui, "playerImage", callsignIcon.image ) + + //if ( i < openInvite.numClaimedSlots ) + // Hud_SetImage( player, $"ui/menu/main_menu/openinvite_occupiedslot" ) + //else + // Hud_SetImage( player, $"ui/menu/main_menu/openinvite_emptyslot" ) + } + i++ + } + + array<string> checklistPlaylists = GetChecklistPlaylistsArray() + + if ( Lobby_IsFDMode() ) + checklistPlaylists = GetFDDifficultyArray() + + array<string> invitePlaylists = split( openInvite.playlistName, "," ) + bool shouldShowCheckboxPlaylists = true + if ( !MixtapeMatchmakingIsEnabled() ) + shouldShowCheckboxPlaylists = false + else if ( invitePlaylists.len() == 0 ) + shouldShowCheckboxPlaylists = false + else if ( (invitePlaylists.len() == 1) && (!checklistPlaylists.contains( invitePlaylists[0] )) ) + shouldShowCheckboxPlaylists = false + + int playlistSlotCount = chatroomUI.openInviteUI.openInvitePlaylistSlots.len() + for( int idx = 0; idx < playlistSlotCount; ++idx ) + { + var slot = chatroomUI.openInviteUI.openInvitePlaylistSlots[idx] + + string thisPlaylistName = idx < checklistPlaylists.len() ? checklistPlaylists[idx] : "" + if ( (thisPlaylistName == "") || !shouldShowCheckboxPlaylists ) + { + Hud_Hide( slot ) + continue + } + + Hud_Show( slot ) + var slotRui = Hud_GetRui( slot ) + asset playlistThumbnail = GetPlaylistThumbnailImage( thisPlaylistName ) + RuiSetImage( slotRui, "checkImage", playlistThumbnail ) + + bool isChecked = invitePlaylists.contains( thisPlaylistName ) + RuiSetBool( slotRui, "isChecked", isChecked ) + + string abbr = GetPlaylistVarOrUseValue( thisPlaylistName, "abbreviation", "" ) + RuiSetString( slotRui, "abbreviation", Localize( abbr ) ) + } + } +} + + +void function HideOpenInvite() +{ + foreach ( chatroomUI in file.chatroomUIs ) + { + Hud_Hide( chatroomUI.openInviteUI.openInvitePanel ) + } +} + +void function ShowOpenInvite() +{ + foreach ( chatroomUI in file.chatroomUIs ) + { + Hud_Show( chatroomUI.openInviteUI.openInvitePanel ) + } +} + + +void function LostFocus( panel ) +{ + Signal( uiGlobal.signalDummy, "StopUserInfoLookups" ) + printt( "Chatroom lost focus" ) + foreach ( chatroomUI in file.chatroomUIs ) + Hud_Hide( chatroomUI.userInfoPanel.Panel ) + file.hasFocus = false + + foreach ( chatroomUI in file.chatroomUIs ) + { + // Hud_SetWidth( chatrooUI.chatroomWidget, Hud_GetBaseWidth( chatrooUI.chatroomWidget ) ) + Hud_SetWidth( chatroomUI.chatroomBackground, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) ) + Hud_Show( chatroomUI.chatroomDivider ) + // Hud_SetWidth( chatrooUI.chatroomMode, Hud_GetBaseWidth( chatrooUI.chatroomBackground ) ) + Hud_Show( chatroomUI.chatroomTextChat ) + } +} + + +void function OnChatroomWidgetGetFocus( var widget ) +{ +} + +void function OnChatroomWidgetLoseFocus( var widget ) +{ +} + +void function GotFocus( panel ) +{ + printt( "Chatroom got focus" ) + file.hasFocus = true + + foreach ( chatroomUI in file.chatroomUIs ) + { + // Hud_SetWidth( chatroomUI.chatroomWidget, Hud_GetBaseWidth( chatroomUI.chatroomWidget ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 24 ) + Hud_SetWidth( chatroomUI.chatroomBackground, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 12 ) + Hud_Hide( chatroomUI.chatroomDivider ) + // Hud_SetWidth( chatroomUI.chatroomMode, Hud_GetBaseWidth( chatroomUI.chatroomBackground ) - Hud_GetBaseWidth( chatroomUI.userInfoPanel.Panel ) - 24 ) + Hud_Hide( chatroomUI.chatroomTextChat ) + } +} + +bool function IsChatroomViewProfileValid() +{ + #if PC_PROG + if ( !Origin_IsOverlayAvailable() ) + return false + #endif // PC_PROG + + return ChatroomHasFocus() +} + +bool function ChatroomHasFocus() +{ + return file.hasFocus +} + +bool function ChatroomIsMuted() +{ + if ( IsControllerModeActive() ) + return ChatroomHasFocus() && IsChatroomMuted() + return IsChatroomMuted() +} + +bool function ChatroomIsNotMuted() +{ + if ( IsControllerModeActive() ) + return ChatroomHasFocus() && !IsChatroomMuted() + return !IsChatroomMuted() +} + +void function MuteRoom( var button ) +{ + printt( "muting the room" ) + ClientCommand( "muteroom" ) +} + +void function UnmuteRoom( var button ) +{ + printt( "unmuting the room" ) + ClientCommand( "unmuteroom" ) +} + +void function UpdateChatroomThread() +{ + EndSignal( uiGlobal.signalDummy, "OnCloseLobbyMenu" ) + while ( true ) + { + UpdateChatroomUI() + wait 30 + } +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut new file mode 100644 index 00000000..89479a76 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_edit_pilot_loadouts.nut @@ -0,0 +1,170 @@ +untyped + +global function InitEditPilotLoadoutsMenu + +struct +{ + var menu + var loadoutPanel + var[NUM_PERSISTENT_PILOT_LOADOUTS] loadoutHeaders + var[NUM_PERSISTENT_PILOT_LOADOUTS] activateButtons + bool enteringEdit = false + var unlockReq +} file + +void function InitEditPilotLoadoutsMenu() +{ + file.menu = GetMenu( "EditPilotLoadoutsMenu" ) + var menu = file.menu + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnPilotLoadoutsMenu_Open ) + AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnPilotLoadoutsMenu_Close ) + AddMenuEventHandler( menu, eUIEvent.MENU_INPUT_MODE_CHANGED, OnPilotLoadoutsMenu_InputModeChanged ) + + for ( int i = 0; i < NUM_PERSISTENT_PILOT_LOADOUTS; i++ ) + { + var activateButton = Hud_GetChild( menu, "Button" + i ) + activateButton.s.rowIndex <- i + Hud_SetVisible( activateButton, true ) + Hud_AddEventHandler( activateButton, UIE_CLICK, OnLoadoutButton_Activate ) + Hud_AddEventHandler( activateButton, UIE_GET_FOCUS, OnLoadoutButton_Focused ) + Hud_AddEventHandler( activateButton, UIE_LOSE_FOCUS, OnLoadoutButton_LostFocus ) + file.activateButtons[i] = activateButton + } + + Hud_SetFocused( file.activateButtons[0] ) + + file.loadoutPanel = Hud_GetChild( menu, "PilotLoadoutDisplay" ) + file.unlockReq = Hud_GetChild( menu, "UnlockReq" ) + + AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) +} + +void function OnPilotLoadoutsMenu_Open() +{ + entity player = GetUIPlayer() + if ( player == null ) + return + + RunMenuClientFunction( "ClearEditingPilotLoadoutIndex" ) + + int loadoutIndex = uiGlobal.pilotSpawnLoadoutIndex + UpdatePilotLoadoutButtons( loadoutIndex, file.activateButtons ) + UpdatePilotLoadoutPanel( file.loadoutPanel, GetCachedPilotLoadout( loadoutIndex ) ) + UI_SetPresentationType( ePresentationType.PILOT ) + + RefreshCreditsAvailable() +} + +void function OnPilotLoadoutsMenu_Close() +{ + entity player = GetUIPlayer() + if ( player == null ) + return + + foreach ( i, button in file.activateButtons ) + { + string pilotLoadoutRef = "pilot_loadout_" + ( i + 1 ) + if ( !IsItemNew( player, pilotLoadoutRef ) ) + continue + + ClearNewStatus( button, pilotLoadoutRef ) + } +} + +void function OnPilotLoadoutsMenu_InputModeChanged() +{ + UpdatePilotLoadoutPanelBinds( file.loadoutPanel ) +} + +void function OnLoadoutButton_Focused( var button ) +{ + int index = expect int( button.s.rowIndex ) + + // update the editingLoadoutIndex on focus so that it always matches + // with the pilot loadout panel + uiGlobal.editingLoadoutIndex = index + uiGlobal.editingLoadoutType = "pilot" + + UpdatePilotLoadout( index ) + + string pilotLoadoutRef = "pilot_loadout_" + ( index + 1 ) + string unlockReq = GetItemUnlockReqText( pilotLoadoutRef ) + RHud_SetText( file.unlockReq, unlockReq ) +} + +void function UpdatePilotLoadout( int loadoutIndex ) +{ + PilotLoadoutDef loadout = GetCachedPilotLoadout( loadoutIndex ) + + UpdatePilotLoadoutPanel( file.loadoutPanel, loadout ) + RunMenuClientFunction( "UpdatePilotModel", loadoutIndex ) +} + +void function OnLoadoutButton_Activate( var button ) +{ + if ( !IsFullyConnected() ) + return + + if ( Hud_IsLocked( button ) ) + { + int index = expect int ( button.s.rowIndex ) + string pilotLoadoutRef = "pilot_loadout_" + ( index + 1 ) + + array<var> buttons + foreach ( button in file.activateButtons ) + { + buttons.append( button ) + } + + OpenBuyItemDialog( buttons, button, GetItemName( pilotLoadoutRef ), pilotLoadoutRef ) + return + } + + int loadoutIndex = expect int ( button.s.rowIndex ) + SetEditLoadout( "pilot", loadoutIndex ) + + if ( EDIT_LOADOUT_SELECTS ) + { + bool indexChanged = loadoutIndex != uiGlobal.pilotSpawnLoadoutIndex + + if ( indexChanged ) + { + EmitUISound( "Menu_LoadOut_Pilot_Select" ) + + if ( !IsLobby() ) + uiGlobal.updatePilotSpawnLoadout = true + } + + uiGlobal.pilotSpawnLoadoutIndex = loadoutIndex + ClientCommand( "RequestPilotLoadout " + loadoutIndex ) + } + + if ( PRE_RELEASE_DEMO && loadoutIndex < 3 ) + { + UpdatePilotLoadoutButtons( loadoutIndex, file.activateButtons ) + return + } + + RunMenuClientFunction( "SetEditingPilotLoadoutIndex", loadoutIndex ) + AdvanceMenu( GetMenu( "EditPilotLoadoutMenu" ) ) +} + +void function OnLoadoutButton_LostFocus( var button ) +{ + entity player = GetUIPlayer() + if ( !IsValid( player ) ) + return + + int loadoutIndex = expect int ( button.s.rowIndex ) + string pilotLoadoutRef = "pilot_loadout_" + ( loadoutIndex + 1 ) + ClearNewStatus( button, pilotLoadoutRef ) + + if ( IsItemLocked( player, pilotLoadoutRef ) ) + return + + PilotLoadoutDef loadout = GetCachedPilotLoadout( loadoutIndex ) + if ( (RefHasAnyNewSubitem( player, loadout.primary ) || RefHasAnyNewSubitem( player, loadout.secondary ) || RefHasAnyNewSubitem( player, loadout.weapon3 )) ) + Hud_SetNew( button, true ) +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index 2bef0e20..23dae99d 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -178,6 +178,8 @@ void function InitLobbyMenu() AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_BUTTON_POSTGAME_REPORT", "#POSTGAME_REPORT", OpenPostGameMenu, IsPostGameMenuValid ) AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk ) + // Client side progression toggle + AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_TOGGLE_PROGRESSION", "#TOGGLE_PROGRESSION", ShowToggleProgressionDialog ) InitChatroom( menu ) @@ -226,6 +228,57 @@ void function InitLobbyMenu() RegisterSignal( "LeaveParty" ) } +void function ShowToggleProgressionDialog( var button ) +{ + bool enabled = Progression_GetPreference() + + DialogData dialogData + dialogData.menu = GetMenu( "AnnouncementDialog" ) + dialogData.header = enabled ? "#PROGRESSION_TOGGLE_ENABLED_HEADER" : "#PROGRESSION_TOGGLE_DISABLED_HEADER" + dialogData.message = enabled ? "#PROGRESSION_TOGGLE_ENABLED_BODY" : "#PROGRESSION_TOGGLE_DISABLED_BODY" + dialogData.image = $"ui/menu/common/dialog_announcement_1" + + AddDialogButton( dialogData, "#NO" ) + AddDialogButton( dialogData, "#YES", enabled ? DisableProgression : EnableProgression ) + + OpenDialog( dialogData ) +} + +void function EnableProgression() +{ + Progression_SetPreference( true ) + + // update the cache just in case something changed + UpdateCachedLoadouts_Delayed() + + DialogData dialogData + dialogData.menu = GetMenu( "AnnouncementDialog" ) + dialogData.header = "#PROGRESSION_ENABLED_HEADER" + dialogData.message = "#PROGRESSION_ENABLED_BODY" + dialogData.image = $"ui/menu/common/dialog_announcement_1" + + AddDialogButton( dialogData, "#OK" ) + + EmitUISound( "UI_Menu_Item_Purchased_Stinger" ) + + OpenDialog( dialogData ) +} + +void function DisableProgression() +{ + Progression_SetPreference( false ) + + DialogData dialogData + dialogData.menu = GetMenu( "AnnouncementDialog" ) + dialogData.header = "#PROGRESSION_DISABLED_HEADER" + dialogData.message = "#PROGRESSION_DISABLED_BODY" + dialogData.image = $"ui/menu/common/dialog_announcement_1" + + AddDialogButton( dialogData, "#OK" ) + + OpenDialog( dialogData ) +} + void function SetupComboButtonTest( var menu ) { ComboStruct comboStruct = ComboButtons_Create( menu ) @@ -235,44 +288,21 @@ void function SetupComboButtonTest( var menu ) int buttonIndex = 0 file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" ) - bool isModded = IsNorthstarServer() - - - // this will be the server browser - if ( isModded ) - { - file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) - file.lobbyButtons.append( file.findGameButton ) - Hud_SetLocked( file.findGameButton, true ) - Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser ) - } - else - { - file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" ) - file.lobbyButtons.append( file.findGameButton ) - Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate ) - } + // server browser + file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) + file.lobbyButtons.append( file.findGameButton ) + Hud_SetLocked( file.findGameButton, true ) + Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser ) - // this is used for launching private matches now - if ( isModded ) - { - file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) - Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch ) - } - else - { - file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" ) - Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed ) - } + // private match + file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) + Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch ) file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed ) - - if ( isModded ) - { - Hud_SetEnabled( file.inviteFriendsButton, false ) - Hud_SetVisible( file.inviteFriendsButton, false ) - } + + Hud_SetEnabled( file.inviteFriendsButton, false ) + Hud_SetVisible( file.inviteFriendsButton, false ) // file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" ) // Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut index a45082c7..8c13955c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut @@ -949,6 +949,7 @@ void function SendTextPanelChanges( var textPanel ) ThrowInvalidValue( "This setting is an integer, and only accepts whole numbers." ) Hud_SetText( textPanel, GetConVarString( c.conVar ) ) } + break case "bool": if ( newSetting != "0" && newSetting != "1" ) { diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut index b757d089..3d1cc15f 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut @@ -18,8 +18,8 @@ void function InitModesMenu() AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleModesBack, IsNorthstarServer ) - AddMenuFooterOption( menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleModesForward, IsNorthstarServer ) + AddMenuFooterOption( menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleModesBack ) + AddMenuFooterOption( menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleModesForward ) } void function OnOpenModesMenu() @@ -58,13 +58,7 @@ void function UpdateVisibleModes() else if( IsFDMode( modesArray[ i ] ) ) Hud_SetLocked( buttons[ i ], false ) else - Hud_SetLocked( buttons[ i ], true ) - - if ( !PrivateMatch_IsValidMapModeCombo( PrivateMatch_GetSelectedMap(), modesArray[ modeIndex ] ) && !IsNorthstarServer() ) - { - Hud_SetLocked( buttons[ i ], true ) - SetButtonRuiText( buttons[ i ], Localize( "#PRIVATE_MATCH_UNAVAILABLE", Localize( GetGameModeDisplayName( modesArray[ modeIndex ] ) ) ) ) - } + Hud_SetLocked( buttons[ i ], true ) } } @@ -92,9 +86,7 @@ void function ModeButton_GetFocus( var button ) string mapName = PrivateMatch_GetSelectedMap() bool mapSupportsMode = PrivateMatch_IsValidMapModeCombo( mapName, modeName ) - if ( !mapSupportsMode && !IsNorthstarServer() ) - Hud_SetText( nextModeDesc, Localize( "#PRIVATE_MATCH_MODE_NO_MAP_SUPPORT", Localize( GetGameModeDisplayName( modeName ) ), Localize( GetMapDisplayName( mapName ) ) ) ) - else if ( IsFDMode( modeName ) ) // HACK! + if ( IsFDMode( modeName ) ) // HACK! Hud_SetText( nextModeDesc, Localize( "#FD_PLAYERS_DESC", Localize( GetGameModeDisplayHint( modeName ) ) ) ) else Hud_SetText( nextModeDesc, GetGameModeDisplayHint( modeName ) ) @@ -116,7 +108,7 @@ void function ModeButton_Click( var button ) // on modded servers set us to the first map for that mode automatically // need this for coliseum mainly which is literally impossible to select without this - if ( IsNorthstarServer() && !PrivateMatch_IsValidMapModeCombo( PrivateMatch_GetSelectedMap(), modesArray[ modeID ] ) ) + if ( !PrivateMatch_IsValidMapModeCombo( PrivateMatch_GetSelectedMap(), modesArray[ modeID ] ) ) ClientCommand( "SetCustomMap " + GetPrivateMatchMapsForMode( modeName )[ 0 ] ) // set it 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 7ea8134a..efc8d66c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -1059,15 +1059,39 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) if ( NSWasAuthSuccessful() ) { - bool modsChanged + bool modsChanged = false - // unload mods we don't need, load necessary ones and reload mods before connecting + // disable all RequiredOnClient mods that are not required by the server and are currently enabled + foreach ( string modName in NSGetModNames() ) + { + if ( NSIsModRequiredOnClient( modName ) && NSIsModEnabled( modName ) ) + { + // find the mod name in the list of server required mods + bool found = false + foreach ( RequiredModInfo mod in file.lastSelectedServer.requiredMods ) + { + if (mod.name == modName) + { + found = true + break + } + } + // if we didnt find the mod name, disable the mod + if (!found) + { + modsChanged = true + NSSetModEnabled( modName, false ) + } + } + } + + // enable all RequiredOnClient mods that are required by the server and are currently disabled foreach ( RequiredModInfo mod in file.lastSelectedServer.requiredMods ) { - if ( NSIsModRequiredOnClient( mod.name ) ) + if ( NSIsModRequiredOnClient( mod.name ) && !NSIsModEnabled( mod.name )) { - modsChanged = modsChanged || NSIsModEnabled( mod.name ) != file.lastSelectedServer.requiredMods.contains( mod ) - NSSetModEnabled( mod.name, file.lastSelectedServer.requiredMods.contains( mod ) ) + modsChanged = true + NSSetModEnabled( mod.name, true ) } } @@ -1250,10 +1274,16 @@ void function RemoveConnectToServerCallback( void functionref( ServerInfo ) call file.connectCallbacks.fastremovebyvalue( callback ) } -void function TriggerConnectToServerCallbacks() +void function TriggerConnectToServerCallbacks( ServerInfo ornull targetServer = null ) { + ServerInfo server; + if (targetServer == null) + { + targetServer = file.lastSelectedServer + } + foreach( callback in file.connectCallbacks ) { - callback( file.lastSelectedServer ) + callback( expect ServerInfo( targetServer ) ) } } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut new file mode 100644 index 00000000..f0139e04 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_pilot_loadouts_shared.nut @@ -0,0 +1,300 @@ + +global function UpdatePilotLoadoutPanel +global function UpdatePilotLoadoutPanelBinds +global function UpdatePilotLoadoutButtons +global function UpdatePilotItemButton + +void function UpdatePilotLoadoutButtons( int selectedIndex, var[NUM_PERSISTENT_PILOT_LOADOUTS] buttons, bool focusSelected = true ) +{ + entity player = GetUIPlayer() + if ( player == null ) + return + + int numLoadouts = GetAllCachedPilotLoadouts().len() + + // HACK: num_pilot_loadouts is just used to disable certain loadouts for FNF + int numLoadoutsForPlaylist = GetCurrentPlaylistVarInt( "num_pilot_loadouts", 0 ) + if ( numLoadoutsForPlaylist > 0 ) + numLoadouts = numLoadoutsForPlaylist + + foreach ( index, button in buttons ) + { + PilotLoadoutDef loadout = GetCachedPilotLoadout( index ) + RHud_SetText( button, GetPilotLoadoutName( loadout ) ) + Hud_SetPanelAlpha( button, 0 ) + + bool isSelected = ( index == selectedIndex ) ? true : false + Hud_SetSelected( button, isSelected ) + + string pilotLoadoutRef = "pilot_loadout_" + ( index + 1 ) + Hud_SetLocked( button, IsItemLocked( player, pilotLoadoutRef ) ) + + bool shouldShowNew = ButtonShouldShowNew( eItemTypes.FEATURE, pilotLoadoutRef ) + if ( !shouldShowNew && (RefHasAnyNewSubitem( player, loadout.primary ) || RefHasAnyNewSubitem( player, loadout.secondary ) || RefHasAnyNewSubitem( player, loadout.weapon3 )) ) + shouldShowNew = true + + if ( IsItemLocked( player, pilotLoadoutRef ) ) + shouldShowNew = false + + Hud_SetNew( button, shouldShowNew ) + + RefreshButtonCost( button, pilotLoadoutRef ) + } + + if ( focusSelected ) + Hud_SetFocused( buttons[ selectedIndex ] ) +} + +void function UpdatePilotLoadoutPanel( var loadoutPanel, PilotLoadoutDef loadout ) +{ + SetLabelRuiText( Hud_GetChild( loadoutPanel, "TacticalName" ), Localize( GetItemName( loadout.special ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "PrimaryName" ), Localize( GetItemName( loadout.primary ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "SecondaryName" ), Localize( GetItemName( loadout.secondary ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "Weapon3Name" ), Localize( GetItemName( loadout.weapon3 ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "OrdnanceName" ), Localize( GetItemName( loadout.ordnance ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "Kit1Name" ), Localize( GetItemName( loadout.passive1 ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "Kit2Name" ), Localize( GetItemName( loadout.passive2 ) ) ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "ExecutionName" ), Localize( GetItemName( loadout.execution ) ) ) + + UpdatePilotLoadoutPanelBinds( loadoutPanel ) + + var menu = Hud_GetParent( loadoutPanel ) + array<var> buttons = GetElementsByClassname( menu, "PilotLoadoutPanelButtonClass" ) + + /*if ( button ) + { + // TEMP disabled since Hud_GetChild( menu, "ButtonTooltip" ) will fail + //if ( HandleLockedMenuItem( menu, button ) ) + // return + }*/ + bool isEdit + if ( Hud_GetHudName( loadoutPanel ) == "PilotLoadoutButtons" ) // Edit menu + isEdit = true + else // Select menu + isEdit = false + + foreach ( button in buttons ) + UpdatePilotItemButton( button, loadout, isEdit ) + + var renameEditBox = Hud_GetChild( loadoutPanel, "RenameEditBox" ) + + asset pilotAppearanceImage = loadout.camoIndex > 0 ? CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.camoIndex ) ) : $"rui/menu/common/appearance_button_swatch" + + asset primaryAppearanceImage + if ( loadout.primarySkinIndex == 0 ) // default skin + primaryAppearanceImage = $"rui/menu/common/appearance_button_swatch" + else if ( loadout.primarySkinIndex == 1 ) // camo + primaryAppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.primaryCamoIndex ) ) + else // warpaint skin + primaryAppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.primary, loadout.primarySkinIndex, "primarySkinIndex" ) + + asset secondaryAppearanceImage + if ( loadout.secondarySkinIndex == 0 ) // default skin + secondaryAppearanceImage = $"rui/menu/common/appearance_button_swatch" + else if ( loadout.secondarySkinIndex == 1 ) // camo + secondaryAppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.secondaryCamoIndex ) ) + else // warpaint skin + secondaryAppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.secondary, loadout.secondarySkinIndex, "secondarySkinIndex" ) + + asset weapon3AppearanceImage + if ( loadout.weapon3SkinIndex == 0 ) // default skin + weapon3AppearanceImage = $"rui/menu/common/appearance_button_swatch" + else if ( loadout.weapon3SkinIndex == 1 ) // camo + weapon3AppearanceImage = CamoSkin_GetImage( CamoSkins_GetByIndex( loadout.weapon3CamoIndex ) ) + else // warpaint skin + weapon3AppearanceImage = GetItemImageFromWeaponRefAndPersistenceValue( loadout.weapon3, loadout.weapon3SkinIndex, "weapon3SkinIndex" ) + + RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonPilotCamo" ) ), "camoImage", pilotAppearanceImage ) + RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonPrimarySkin" ) ), "camoImage", primaryAppearanceImage ) + RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonSecondarySkin" ) ), "camoImage", secondaryAppearanceImage ) + RuiSetImage( Hud_GetRui( Hud_GetChild( loadoutPanel, "ButtonWeapon3Skin" ) ), "camoImage", weapon3AppearanceImage ) + + array<var> nonItemElements + nonItemElements.append( Hud_GetChild( loadoutPanel, "ButtonPilotCamo" ) ) + nonItemElements.append( Hud_GetChild( loadoutPanel, "ButtonGender" ) ) + nonItemElements.append( Hud_GetChild( loadoutPanel, "ButtonPrimarySkin" ) ) + nonItemElements.append( Hud_GetChild( loadoutPanel, "ButtonSecondarySkin" ) ) + nonItemElements.append( Hud_GetChild( loadoutPanel, "ButtonWeapon3Skin" ) ) + nonItemElements.append( renameEditBox ) + + foreach ( elem in nonItemElements ) + { + if ( isEdit ) + Hud_Show( elem ) + else + Hud_Hide( elem ) + } + Hud_SetEnabled( renameEditBox, isEdit ) +} + +void function UpdatePilotItemButton( var button, PilotLoadoutDef loadout, bool isEdit ) +{ + string propertyName = Hud_GetScriptID( button ) + string itemRef = GetPilotLoadoutValue( loadout, propertyName ) + int itemType = GetItemTypeFromPilotLoadoutProperty( propertyName ) + asset image + + ItemDisplayData parentItem + + if ( itemType == eItemTypes.PILOT_PRIMARY_ATTACHMENT || itemType == eItemTypes.PILOT_PRIMARY_MOD || itemType == eItemTypes.PILOT_SECONDARY_MOD || itemType == eItemTypes.PILOT_WEAPON_MOD3 ) + { + string parentProperty = GetParentLoadoutProperty( "pilot", propertyName ) + Assert( parentProperty == "primary" || parentProperty == "secondary" || parentProperty == "weapon3" ) + + if ( parentProperty == "primary" ) + parentItem = GetItemDisplayData( loadout.primary ) + else if ( parentProperty == "secondary" ) + parentItem = GetItemDisplayData( loadout.secondary ) + else + parentItem = GetItemDisplayData( loadout.weapon3 ) + + bool isHiddenAttachment = false + + if ( itemType == eItemTypes.PILOT_PRIMARY_ATTACHMENT ) + { + // Disable attachment option for "special" primary weapons + if ( "menuCategory" in parentItem.i && ( expect int( parentItem.i.menuCategory ) == ePrimaryWeaponCategory.SPECIAL || expect int( parentItem.i.menuCategory ) == ePrimaryWeaponCategory.HANDGUN ) ) + { + isHiddenAttachment = true + + Hud_SetWidth( button, 0 ) + Hud_SetPos( button, 0, 0 ) // Clear sibling offset + } + else + { + int defaultButtonWidth = int( ContentScaledX( 72 ) ) + int defaultOffsetX = int( ContentScaledX( 6 ) ) + + Hud_SetWidth( button, defaultButtonWidth ) + Hud_SetPos( button, defaultOffsetX, 0 ) + } + } + + if ( !isHiddenAttachment ) + image = GetImage( itemType, parentItem.ref, itemRef ) + } + else + { + image = GetImage( itemType, itemRef ) + } + + if ( itemType == eItemTypes.PILOT_PRIMARY || itemType == eItemTypes.PILOT_SECONDARY ) + { + //if ( isEdit ) + //{ + // RuiSetString( Hud_GetRui( button ), "subText", "" ) + // RuiSetFloat( Hud_GetRui( button ), "numSegments", 0 ) + // RuiSetFloat( Hud_GetRui( button ), "filledSegments", 0 ) + //} + //else + { + int currentXP = WeaponGetXP( GetLocalClientPlayer(), itemRef ) + int numPips = WeaponGetNumPipsForXP( itemRef, currentXP ) + int filledPips = WeaponGetFilledPipsForXP( itemRef, currentXP ) + RuiSetString( Hud_GetRui( button ), "subText", WeaponGetDisplayGenAndLevelForXP( itemRef, currentXP ) ) + RuiSetFloat( Hud_GetRui( button ), "numSegments", float( numPips ) ) + RuiSetFloat( Hud_GetRui( button ), "filledSegments", float( filledPips ) ) + } + } + + var rui = Hud_GetRui( button ) + + if ( image == $"" ) + { + RuiSetBool( rui, "isVisible", false ) + Hud_SetEnabled( button, false ) + } + else + { + RuiSetBool( rui, "isVisible", true ) + RuiSetImage( rui, "buttonImage", image ) + + Hud_SetEnabled( button, true ) + } + + bool isLocked = false + bool shouldShowNew = false + + // For unlock and subitem checks below, treat weapon3 as secondary + if ( propertyName == "weapon3Mod1" ) + propertyName = "secondaryMod1" + else if ( propertyName == "weapon3Mod2" ) + propertyName = "secondaryMod2" + else if ( propertyName == "weapon3Mod3" ) + propertyName = "secondaryMod3" + + string propertyRef = propertyName.tolower() + + if ( !IsSubItemType( itemType ) ) + { + if ( IsUnlockValid( propertyRef ) && IsItemLocked( GetUIPlayer(), propertyRef ) ) + { + RefreshButtonCost( button, propertyRef ) + isLocked = true + } + shouldShowNew = ButtonShouldShowNew( itemType, itemRef ) + } + else + { + if ( IsUnlockValid( propertyRef, parentItem.ref ) && IsSubItemLocked( GetUIPlayer(), propertyRef, parentItem.ref ) ) + { + RefreshButtonCost( button, propertyRef ) + isLocked = true + } + shouldShowNew = ButtonShouldShowNew( itemType, itemRef, parentItem.ref ) + } + + Hud_SetLocked( button, isLocked ) + + if ( !shouldShowNew && IsUnlockValid( propertyRef, parentItem.ref ) ) + shouldShowNew = ButtonShouldShowNew( GetSubitemType( parentItem.ref, propertyRef ), propertyRef, parentItem.ref ) + Hud_SetNew( button, shouldShowNew ) + +#if HAS_THREAT_SCOPE_SLOT_LOCK + if ( propertyName == "primaryMod2" ) + { + string attatchmentRef = GetPilotLoadoutValue( loadout, "primaryAttachment" ) + if ( attatchmentRef == "threat_scope" ) + { + Hud_SetLocked( button, true ) + RefreshButtonCost( button, propertyRef, "", 0, 0 ) + Hud_SetNew( button, false ) + } + } +#endif +} + +void function UpdatePilotLoadoutPanelBinds( var loadoutPanel ) +{ + if ( IsControllerModeActive() ) + { + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "PrimaryBind" ), "%weaponCycle%" ) + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "SecondaryBind" ), "%weaponCycle%" ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "Weapon3Bind" ), Localize( "#WEAPON3_HOLD_HINT" ) ) + } + else + { + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "PrimaryBind" ), "%weaponSelectPrimary0%" ) + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "SecondaryBind" ), "%weaponSelectPrimary1%" ) + SetLabelRuiText( Hud_GetChild( loadoutPanel, "Weapon3Bind" ), Localize( "#WEAPON3_PRESS_HINT" ) ) + } + + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "TacticalBind" ), Localize( "%offhand1%" ) ) + //SetLabelRuiText( Hud_GetChild( loadoutPanel, "OrdnanceBind" ), Localize( "%offhand0%" ) ) +} + +asset function GetItemImageFromWeaponRefAndPersistenceValue(string weaponRef, int persistenceValue, string loadoutProperty) +{ + string skinRef = GetSkinRefFromWeaponRefAndPersistenceValue( weaponRef, persistenceValue ) + if (!IsRefValid(skinRef)) + { + if (uiGlobal.editingLoadoutIndex != -1) + { + printt( "Resetting invalid " + loadoutProperty + " for weapon " + weaponRef ) + SetCachedLoadoutValue(GetUIPlayer(), "pilot", uiGlobal.editingLoadoutIndex, loadoutProperty, "0") + } + return $"rui/menu/common/appearance_button_swatch" + } + + return GetItemImage( skinRef ) +} 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 d7c7442f..e3c1f268 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -247,10 +247,7 @@ void function OnSelectMatchSettings_Activate( var button ) if ( Hud_IsLocked( button ) ) return - if ( !IsNorthstarServer() ) - AdvanceMenu( GetMenu( "MatchSettingsMenu" ) ) - else - AdvanceMenu( GetMenu( "CustomMatchSettingsCategoryMenu" ) ) + AdvanceMenu( GetMenu( "CustomMatchSettingsCategoryMenu" ) ) } void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) @@ -274,13 +271,6 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) file.matchSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MATCH_SETTINGS" ) Hud_AddEventHandler( file.matchSettingsButton, UIE_CLICK, OnSelectMatchSettings_Activate ) - if ( !IsNorthstarServer() ) - { - var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) - file.inviteFriendsButton = friendsButton - Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed ) - } - headerIndex++ buttonIndex = 0 file.customizeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_LOADOUTS" ) @@ -575,17 +565,12 @@ function UpdatePrivateMatchButtons() Hud_SetLocked( file.selectMapButton, true ) Hud_SetLocked( file.selectModeButton, true ) Hud_SetLocked( file.matchSettingsButton, true ) - - if ( !IsNorthstarServer() ) - Hud_SetLocked( file.inviteFriendsButton, true ) } else { RHud_SetText( file.startMatchButton, "#START_MATCH" ) Hud_SetLocked( file.selectMapButton, false ) Hud_SetLocked( file.selectModeButton, false ) - if ( !IsNorthstarServer() ) - Hud_SetLocked( file.inviteFriendsButton, false ) string modeName = PrivateMatch_GetSelectedMode() bool settingsLocked = IsFDMode( modeName ) @@ -648,7 +633,7 @@ function UpdateLobby() { float varOrigVal = float( GetCurrentPlaylistGamemodeByIndexVar( gamemodeIdx, varName, false ) ) float varOverrideVal = float( GetCurrentPlaylistGamemodeByIndexVar( gamemodeIdx, varName, true ) ) - if ( varOrigVal == varOverrideVal && !IsNorthstarServer() ) // stuff seems to break outside of northstar servers since we dont always use private_match playlist + if ( varOrigVal == varOverrideVal ) // stuff seems to break outside of northstar servers since we dont always use private_match playlist continue string label = Localize( MatchSettings_PlaylistVarLabels[varName] ) + ": " diff --git a/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut index 4b3d0f55..f91231b6 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut @@ -202,7 +202,10 @@ void function UpdateOpenInvite_Thread() void function UICodeCallback_OpenInviteUpdated() { - if ( file.openInviteVisible || IsNorthstarServer() ) + // don't support on northstar + return + + if ( file.openInviteVisible ) return int currentPartySize = GetPartySize() diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index eef19b5e..c97c8cdc 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -531,7 +531,6 @@ void function OnPlayFDButton_Activate( var button ) // repurposed for launching { if ( !Hud_IsLocked( button ) ) { - SetConVarBool( "ns_is_modded_server", true ) SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it NSTryAuthWithLocalServer() thread TryAuthWithLocalServer() @@ -601,7 +600,6 @@ void function OnPlayMPButton_Activate( var button ) { Lobby_SetAutoFDOpen( false ) // Lobby_SetFDMode( false ) - SetConVarBool( "ns_is_modded_server", false ) thread file.mpButtonActivateFunc() } } |