diff --git a/data/cdata/ui_scripts/SystemLinkMenu/ServerBrowser.lua b/data/cdata/ui_scripts/SystemLinkMenu/ServerBrowser.lua new file mode 100644 index 0000000..881ffaa --- /dev/null +++ b/data/cdata/ui_scripts/SystemLinkMenu/ServerBrowser.lua @@ -0,0 +1,138 @@ +local SetBlurHeight = function ( element, height ) + assert( height ) + local height_limited = math.min( height, 16 ) + element.ListBlur:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, 0, _1080p * 40 + height_limited * _1080p * 35 + height_limited * _1080p * 5, 0 ) +end + +local PostLoadFunc = function ( element, controllerIndex, controller ) + element.SetBlurHeight = SetBlurHeight +end + +function ServerBrowser( menu, controller ) + local self = LUI.UIElement.new() + self:SetAnchorsAndPosition( 0, 1, 0, 1, 0, 1790 * _1080p, 0, 675 * _1080p ) + self.id = "ServerBrowser" + local controllerIndex = controller and controller.controllerIndex + if not controllerIndex and not Engine.InFrontend() then + controllerIndex = self:getRootController() + end + assert( controllerIndex ) + + local ListBlur = nil + + ListBlur = LUI.UIBlur.new() + ListBlur.id = "ListBlur" + ListBlur:SetBlurStrength( 2.75, 0 ) + ListBlur:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, 0, _1080p * 40 ) + self:addElement( ListBlur ) + self.ListBlur = ListBlur + + local ServerList = nil + + ServerList = LUI.UIDataSourceGrid.new( nil, { + maxVisibleColumns = 1, + maxVisibleRows = 16, + controllerIndex = controllerIndex, + buildChild = function () + return MenuBuilder.BuildRegisteredType( "SystemLinkJoinMenuRow", { + controllerIndex = controllerIndex + } ) + end, + wrapX = true, + wrapY = true, + spacingX = _1080p * 5, + spacingY = _1080p * 5, + columnWidth = _1080p * 1790, + rowHeight = _1080p * 35, + scrollingThresholdX = 1, + scrollingThresholdY = 1, + adjustSizeToContent = false, + horizontalAlignment = LUI.Alignment.Left, + verticalAlignment = LUI.Alignment.Top, + springCoefficient = 400, + maxVelocity = 5000 + } ) + ServerList.id = "ServerList" + ServerList:setUseStencil( true ) + ServerList:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, _1080p * 40, _1080p * 675 ) + self:addElement( ServerList ) + self.ServerList = ServerList + + local VerticalMinimalScrollbar = nil + + VerticalMinimalScrollbar = MenuBuilder.BuildRegisteredType( "VerticalMinimalScrollbar", { + controllerIndex = controllerIndex + } ) + VerticalMinimalScrollbar.id = "VerticalMinimalScrollbar" + VerticalMinimalScrollbar:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * -16, 0, _1080p * 40, _1080p * 675 ) + self:addElement( VerticalMinimalScrollbar ) + self.VerticalMinimalScrollbar = VerticalMinimalScrollbar + + local ArrowUp = nil + + ArrowUp = MenuBuilder.BuildRegisteredType( "ArrowUp", { + controllerIndex = controllerIndex + } ) + ArrowUp.id = "ArrowUp" + ArrowUp:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 638, _1080p * 658, _1080p * 676, _1080p * 716 ) + self:addElement( ArrowUp ) + self.ArrowUp = ArrowUp + + local ArrowDown = nil + + ArrowDown = MenuBuilder.BuildRegisteredType( "ArrowDown", { + controllerIndex = controllerIndex + } ) + ArrowDown.id = "ArrowDown" + ArrowDown:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 473, _1080p * 493, _1080p * 675, _1080p * 715 ) + self:addElement( ArrowDown ) + self.ArrowDown = ArrowDown + + local ListCount = nil + + ListCount = LUI.UIText.new() + ListCount.id = "ListCount" + ListCount:setText( "1/15", 0 ) + ListCount:SetFontSize( 24 * _1080p ) + ListCount:SetFont( FONTS.GetFont( FONTS.MainMedium.File ) ) + ListCount:SetAlignment( LUI.Alignment.Center ) + ListCount:SetAnchorsAndPosition( 0, 1, 0, 1, _1080p * 493, _1080p * 638, _1080p * 683, _1080p * 707 ) + self:addElement( ListCount ) + self.ListCount = ListCount + + local TitleRow = nil + + TitleRow = MenuBuilder.BuildRegisteredType( "SystemLinkJoinMenuTitleRow", { + controllerIndex = controllerIndex + } ) + TitleRow.id = "TitleRow" + TitleRow:SetAnchorsAndPosition( 0, 0, 0, 1, 0, 0, 0, _1080p * 40 ) + self:addElement( TitleRow ) + self.TitleRow = TitleRow + + local scrollbar = LUI.UIScrollbar.new + local scrollbardata = { + direction = LUI.DIRECTION.vertical, + eventListener = VerticalMinimalScrollbar, + startCap = VerticalMinimalScrollbar.startCap, + endCap = VerticalMinimalScrollbar.endCap + } + local slider = VerticalMinimalScrollbar.sliderArea + if slider then + slider = VerticalMinimalScrollbar.sliderArea.slider + end + scrollbardata.slider = slider + slider = VerticalMinimalScrollbar.sliderArea + if slider then + slider = VerticalMinimalScrollbar.sliderArea.fixedSizeSlider + end + scrollbardata.fixedSizeSlider = slider + ServerList:AddScrollbar( scrollbar( scrollbardata ) ) + ServerList:AddArrow( ArrowUp ) + ServerList:AddArrow( ArrowDown ) + ServerList:AddItemNumbers( ListCount ) + PostLoadFunc( self, controllerIndex, controller ) + return self +end + +MenuBuilder.m_types["ServerBrowser"] = ServerBrowser diff --git a/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua b/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua deleted file mode 100644 index 370e866..0000000 --- a/data/cdata/ui_scripts/SystemLinkMenu/SysLinkBrowser.lua +++ /dev/null @@ -1,695 +0,0 @@ -local serverBrowserPath = "frontEnd.systemLinkMenu.serverBrowser" - -local leaveMenuHandler = function(menu, controller) - -- Engine.StopGameMode() - LUI.FlowManager.RequestLeaveMenu(menu, true) -end - -local updateServerDisplayListAndCreateModels - -updateServerDisplayListAndCreateModels = function(menu, controller, index) - local waitDuration = menu:Wait(250) - waitDuration.onComplete = function() - return updateServerDisplayListAndCreateModels(menu, controller) - end - - Lobby.UpdateServerDisplayList(controller) - Lobby.CreateServersDataModels(controller) -end - -local setupSystemLinkMenu = function(menu, controller, index) - assert(menu.ServerBrowser) - assert(menu.ServerBrowser.ServerList) - menu:setPriority(-1) - menu.isSignInMenu = true - local isAliensMode = Engine.IsAliensMode() - - if isAliensMode then - Engine.SetFrontEndSceneSection("zm_main", 1) - else - menu.MenuTitle.MenuBreadcrumbs:setText(ToUpperCase( - Engine.Localize("LUA_MENU_BREADCRUMB_2_ITEMS", "IW7-Mod", "MULTIPLAYER")), 0) - end - - menu.addButtonHelperFunction = function(helperMenu, helperController) - menu:AddButtonHelperText({ - helper_text = Engine.Localize("MENU_SB_TOOLTIP_BTN_REFRESH"), - button_ref = "button_alt1", - side = "left", - priority = 2, - clickable = true - }) - end - - menu:addEventHandler("menu_create", menu.addButtonHelperFunction) - - assert(Engine.IsUserSignedIn(controller)) - if isAliensMode then - Engine.ExecNow(CPConfig.default_systemlink, controller) - else - Engine.ExecNow(MPConfig.default_systemlink, controller) - end - - Engine.Exec(MPConfig.default_dvars) - - menu:addEventHandler("menu_create", function(menuHandler, eventHandler) - assert(menu.bindButton) - - if CONDITIONS.IsThirdGameMode(menu) then - ACTIONS.AnimateSequence(menu, "DisplayServerBrowser") - end - - menu.bindButton:addEventHandler("button_secondary", function(buttonHandler, buttonEvent) - local scopedData = LUI.FlowManager.GetScopedData(menu) - if scopedData.serverBrowserFocused then - scopedData.serverBrowserFocused = false - ACTIONS.LoseFocus(menu, "ServerBrowser", controller) - ACTIONS.GainFocus(menu.SystemLinkMenuButtons, "JoinGameButton", controller) - else - leaveMenuHandler(buttonHandler, buttonEvent) - end - end) - - menu.bindButton:addEventHandler("button_alt1", function(buttonHandler, buttonEvent) - Lobby.RefreshServerList(controller) - ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) - end) - end) - - menu.SystemLinkMenuButtons:addEventHandler("gain_focus", function(menuHandler, eventHandler) - local scopedData = LUI.FlowManager.GetScopedData(menu) - if scopedData.serverBrowserFocused then - scopedData.serverBrowserFocused = false - ACTIONS.LoseFocus(menu, "ServerBrowser", controller) - if CONDITIONS.IsThirdGameMode(menu) then - ACTIONS.AnimateSequence(menu, "DisplayServerBrowser") - menu:RemoveButtonHelperText("button_alt1", "left") - end - end - end) - - Engine.PLMRefreshData() - if Engine.IsCoreMode() then - ClientWeapon.SetWeaponVisible(0, false) - ClientCharacter.SetCharacterVisible(0, false) - end - - Lobby.SetPartyUIRoot(PartyUIRoot.SYSTEM_LINK) - local scopedData = LUI.FlowManager.GetScopedData(menu) - if scopedData.optionsMenuOpened then - scopedData.optionsMenuOpened = nil - if scopedData.serverBrowserFocused then - scopedData.serverBrowserFocused = false - menu:clearSavedState() - if isAliensMode then - LUI.FlowManager.ClearSavedMenuState("CPSystemLinkMenu") - else - LUI.FlowManager.ClearSavedMenuState("MPSystemLinkMenu") - end - end - else - scopedData.serverBrowserFocused = false - end - - Lobby.BuildServerList(controller) - Lobby.RefreshServerList(controller) - - assert(menu.ServerBrowser) - assert(menu.ServerBrowser.ServerList) - local serverCountDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. ".serverCount") - menu:SubscribeToModel(serverCountDataSource:GetModel(controller), function() - local serverCount = serverCountDataSource:GetValue(controller) - if serverCount ~= nil then - if serverCount == 0 then - local scopedData = LUI.FlowManager.GetScopedData(menu) - if scopedData.serverBrowserFocused then - scopedData.serverBrowserFocused = false - ACTIONS.LoseFocus(menu, "ServerBrowser", controller) - end - end - menu.ServerBrowser:SetBlurHeight(serverCount) - end - end) - - local serverListDataSource = LUI.DataSourceFromList.new(serverCountDataSource) - serverListDataSource.MakeDataSourceAtIndex = function(dataSource, index, controller) - local color = index % 2 == 0 and COLORS.white or COLORS.black - local statusDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".status") - return { - index = index, - color = color, - host = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".host"), - map = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".map"), - players = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".players"), - type = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".type"), - status = statusDataSource:Filter("status", function(value, model) - if value == 1 then - return Engine.Localize("MENU_LOBBY") - else - return Engine.Localize("MENU_IN_GAME_CAPS") - end - end) - } - end - - menu.ServerBrowser.ServerList:SetGridDataSource(serverListDataSource) - - assert(menu.bindButton) - menu.bindButton:addEventHandler("button_start", function(buttonHandler, buttonEvent) - local scopedData = LUI.FlowManager.GetScopedData(menu) - scopedData.optionsMenuOpened = true - ACTIONS.OpenMenu("OptionsMenu", true, buttonEvent.controller) - ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) - end) - - local waitDuration = menu:Wait(250) - waitDuration.onComplete = function() - return updateServerDisplayListAndCreateModels(menu, controller) - end - - Engine.StopMenuVideo() -end - -MenuBuilder.m_types["SystemLinkMenu"] = function(menu, controller) - local self = LUI.UIElement.new() - self.id = "SystemLinkMenu" - self._animationSets = {} - self._sequences = {} - local controllerIndex = controller and controller.controllerIndex - if not controllerIndex and not Engine.InFrontend() then - controllerIndex = self:getRootController() - end - assert(controllerIndex) - self.soundSet = "cpMainMenuDefault" - self:playSound("menu_open") - local OuterMaskTop = nil - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskTop = MenuBuilder.BuildRegisteredType("CPMenuOuterMask", { - controllerIndex = controllerIndex - }) - OuterMaskTop.id = "OuterMaskTop" - OuterMaskTop:SetZRotation(-168, 0) - OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, _1080p * 100) - self:addElement(OuterMaskTop) - self.OuterMaskTop = OuterMaskTop - end - local OuterMaskBottom = nil - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskBottom = MenuBuilder.BuildRegisteredType("CPMenuOuterMask", { - controllerIndex = controllerIndex - }) - OuterMaskBottom.id = "OuterMaskBottom" - OuterMaskBottom:SetZRotation(-168, 0) - OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, _1080p * 215) - self:addElement(OuterMaskBottom) - self.OuterMaskBottom = OuterMaskBottom - end - local MenuTitle = nil - if CONDITIONS.IsCoreMultiplayer(self) then - MenuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", { - controllerIndex = controllerIndex - }) - MenuTitle.id = "MenuTitle" - MenuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("SERVER BROWSER")), 0) - MenuTitle.MenuBreadcrumbs:setText(ToUpperCase(Engine.Localize("EXE_LOCAL_PLAY")), 0) - MenuTitle.Icon:SetTop(_1080p * -28.5, 0) - MenuTitle.Icon:SetBottom(_1080p * 61.5, 0) - MenuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134) - self:addElement(MenuTitle) - self.MenuTitle = MenuTitle - end - local ButtonHelperBar = nil - - ButtonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", { - controllerIndex = controllerIndex - }) - ButtonHelperBar.id = "ButtonHelperBar" - ButtonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0) - self:addElement(ButtonHelperBar) - self.ButtonHelperBar = ButtonHelperBar - - local SocialFeed = nil - - SocialFeed = MenuBuilder.BuildRegisteredType("SocialFeed", { - controllerIndex = controllerIndex - }) - SocialFeed.id = "SocialFeed" - SocialFeed:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -115, _1080p * -85) - self:addElement(SocialFeed) - self.SocialFeed = SocialFeed - - local SystemLinkMenuButtons = nil - - SystemLinkMenuButtons = MenuBuilder.BuildRegisteredType("SystemLinkMenuButtons", { - controllerIndex = controllerIndex - }) - SystemLinkMenuButtons.id = "SystemLinkMenuButtons" - SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 438) - self:addElement(SystemLinkMenuButtons) - self.SystemLinkMenuButtons = SystemLinkMenuButtons - - local LobbyMembers = nil - if CONDITIONS.IsThirdGameMode(self) then - LobbyMembers = MenuBuilder.BuildRegisteredType("LobbyMembers", { - controllerIndex = controllerIndex - }) - LobbyMembers.id = "LobbyMembers" - LobbyMembers:SetAlpha(0, 0) - LobbyMembers:SetAnchorsAndPosition(1, 0, 0, 1, _1080p * -1790, _1080p * -1090, _1080p * 791.5, _1080p * 1435.5) - self:addElement(LobbyMembers) - self.LobbyMembers = LobbyMembers - end - local ServerBrowser = nil - - ServerBrowser = MenuBuilder.BuildRegisteredType("ServerBrowser", { - controllerIndex = controllerIndex - }) - ServerBrowser.id = "ServerBrowser" - ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, _1080p * 885) - self:addElement(ServerBrowser) - self.ServerBrowser = ServerBrowser - - local BloodSplat = nil - if CONDITIONS.IsThirdGameMode(self) then - BloodSplat = LUI.UIImage.new() - BloodSplat.id = "BloodSplat" - BloodSplat:SetAlpha(0.5, 0) - BloodSplat:setImage(RegisterMaterial("cp_menu_zombies_blood_splats_large"), 0) - BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 48, _1080p * 678, _1080p * -71, _1080p * 441) - self:addElement(BloodSplat) - self.BloodSplat = BloodSplat - end - local ZombiesLogo = nil - if CONDITIONS.IsThirdGameMode(self) then - ZombiesLogo = LUI.UIImage.new() - ZombiesLogo.id = "ZombiesLogo" - ZombiesLogo:setImage(RegisterMaterial("cp_menu_zombies_logo"), 0) - ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 60, _1080p * 740, _1080p * 34, _1080p * 434) - self:addElement(ZombiesLogo) - self.ZombiesLogo = ZombiesLogo - end - local ZomLanPartyShadow = nil - if CONDITIONS.IsThirdGameMode(self) then - ZomLanPartyShadow = LUI.UIStyledText.new() - ZomLanPartyShadow.id = "ZomLanPartyShadow" - ZomLanPartyShadow:SetRGBFromInt(0, 0) - ZomLanPartyShadow:setText(Engine.Localize("Server Browser"), 0) - ZomLanPartyShadow:SetFontSize(36 * _1080p) - ZomLanPartyShadow:SetFont(FONTS.GetFont(FONTS.ZmClean.File)) - ZomLanPartyShadow:SetAlignment(LUI.Alignment.Center) - ZomLanPartyShadow:SetOptOutRightToLeftAlignmentFlip(true) - ZomLanPartyShadow:SetShadowRGBFromInt(0, 0) - ZomLanPartyShadow:SetOutlineRGBFromInt(0, 0) - ZomLanPartyShadow:SetDecodeLetterLength(25) - ZomLanPartyShadow:SetDecodeMaxRandChars(3) - ZomLanPartyShadow:SetDecodeUpdatesPerLetter(4) - ZomLanPartyShadow:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338) - self:addElement(ZomLanPartyShadow) - self.ZomLanPartyShadow = ZomLanPartyShadow - end - local ZomLanParty = nil - if CONDITIONS.IsThirdGameMode(self) then - ZomLanParty = LUI.UIStyledText.new() - ZomLanParty.id = "ZomLanParty" - ZomLanParty:SetRGBFromInt(14042667, 0) - ZomLanParty:setText(Engine.Localize("Server Browser"), 0) - ZomLanParty:SetFontSize(36 * _1080p) - ZomLanParty:SetFont(FONTS.GetFont(FONTS.ZmClean.File)) - ZomLanParty:SetAlignment(LUI.Alignment.Center) - ZomLanParty:SetOptOutRightToLeftAlignmentFlip(true) - ZomLanParty:SetShadowRGBFromInt(0, 0) - ZomLanParty:SetOutlineRGBFromInt(0, 0) - ZomLanParty:SetDecodeLetterLength(25) - ZomLanParty:SetDecodeMaxRandChars(3) - ZomLanParty:SetDecodeUpdatesPerLetter(4) - ZomLanParty:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 272, _1080p * 597.5, _1080p * 302, _1080p * 338) - self:addElement(ZomLanParty) - self.ZomLanParty = ZomLanParty - end - local MPLobbyMembersPlayercards = nil - - MPLobbyMembersPlayercards = MenuBuilder.BuildRegisteredType("MPLobbyMembersPlayercards", { - controllerIndex = controllerIndex - }) - MPLobbyMembersPlayercards.id = "MPLobbyMembersPlayercards" - MPLobbyMembersPlayercards:SetAnchorsAndPosition(0, 1, 1, 0, _1080p * 130, _1080p * 630, _1080p * -255, _1080p * -189) - self:addElement(MPLobbyMembersPlayercards) - self.MPLobbyMembersPlayercards = MPLobbyMembersPlayercards - - local ButtonDescriptionText = nil - - ButtonDescriptionText = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", { - controllerIndex = controllerIndex - }) - ButtonDescriptionText.id = "ButtonDescriptionText" - ButtonDescriptionText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 550, _1080p * 334, _1080p * 366) - self:addElement(ButtonDescriptionText) - self.ButtonDescriptionText = ButtonDescriptionText - - self._animationSets.DefaultAnimationSet = function() - ServerBrowser:RegisterAnimationSequence("DefaultSequence", {{function() - return self.ServerBrowser:SetAlpha(1, 0) - end}, {function() - return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, - _1080p * 885, 0) - end}}) - self._sequences.DefaultSequence = function() - ServerBrowser:AnimateSequence("DefaultSequence") - end - - SystemLinkMenuButtons:RegisterAnimationSequence("IntroCore", {{function() - return self.SystemLinkMenuButtons:SetAlpha(1, 0) - end}, {function() - return self.SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, - _1080p * 216, _1080p * 438, 0) - end}}) - ServerBrowser:RegisterAnimationSequence("IntroCore", {{function() - return self.ServerBrowser:SetAlpha(1, 0) - end}, {function() - return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 659, _1080p * 1790, _1080p * 216, - _1080p * 885, 0) - end}}) - self._sequences.IntroCore = function() - SystemLinkMenuButtons:AnimateSequence("IntroCore") - ServerBrowser:AnimateSequence("IntroCore") - end - - end - - self._animationSets.ThirdGameModeAnimationSet = function() - self._sequences.DefaultSequence = function() - - end - - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskTop:RegisterAnimationSequence("Intro", {{function() - return self.OuterMaskTop:SetAlpha(0, 0) - end, function() - return self.OuterMaskTop:SetAlpha(0.6, 500, LUI.EASING.outBack) - end}, {function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, - _1080p * -215, 0) - end, function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -635, - _1080p * -215, 500, LUI.EASING.outBack) - end, function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, - _1080p * 100, 500, LUI.EASING.outQuadratic) - end, function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, - _1080p * 100, 139) - end, function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -280, - _1080p * 140, 9) - end, function() - return self.OuterMaskTop:SetAnchorsAndPosition(0, 0, 0, 1, _1080p * -190, _1080p * 76, _1080p * -320, - _1080p * 100, 200, LUI.EASING.outQuadratic) - end}}) - end - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskBottom:RegisterAnimationSequence("Intro", {{function() - return self.OuterMaskBottom:SetAlpha(0, 0) - end, function() - return self.OuterMaskBottom:SetAlpha(0.6, 500, LUI.EASING.outBack) - end}, {function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, - _1080p * 645, 0) - end, function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * 225, - _1080p * 645, 500, LUI.EASING.outBack) - end, function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, - _1080p * 215, 500, LUI.EASING.outQuadratic) - end, function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, - _1080p * 215, 139) - end, function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -245, - _1080p * 175, 9) - end, function() - return self.OuterMaskBottom:SetAnchorsAndPosition(0, 0, 1, 0, _1080p * -83, _1080p * 183, _1080p * -205, - _1080p * 215, 200, LUI.EASING.outQuadratic) - end}}) - end - SystemLinkMenuButtons:RegisterAnimationSequence("Intro", {{function() - return self.SystemLinkMenuButtons:SetAlpha(0, 0) - end, function() - return self.SystemLinkMenuButtons:SetAlpha(0, 1220) - end, function() - return self.SystemLinkMenuButtons:SetAlpha(1, 490) - end}, {function() - return self.SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, - _1080p * 406, _1080p * 628, 0) - end}}) - if CONDITIONS.IsThirdGameMode(self) then - LobbyMembers:RegisterAnimationSequence("Intro", {{function() - return self.LobbyMembers:SetAlpha(0, 0) - end, function() - return self.LobbyMembers:SetAlpha(0, 2000) - end}}) - end - ServerBrowser:RegisterAnimationSequence("Intro", {{function() - return self.ServerBrowser:SetAlpha(0, 0) - end}, {function() - return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 789, _1080p * 1920, _1080p * 133, - _1080p * 802, 0) - end}}) - if CONDITIONS.IsThirdGameMode(self) then - BloodSplat:RegisterAnimationSequence("Intro", {{function() - return self.BloodSplat:SetAlpha(0, 0) - end, function() - return self.BloodSplat:SetAlpha(0, 1000) - end, function() - return self.BloodSplat:SetAlpha(0, 140) - end, function() - return self.BloodSplat:SetAlpha(0.5, 10) - end, function() - return self.BloodSplat:SetAlpha(0.5, 200, LUI.EASING.outQuadratic) - end, function() - return self.BloodSplat:SetAlpha(0.4, 650, LUI.EASING.outQuadratic) - end}, {function() - return self.BloodSplat:SetZRotation(-5, 1000) - end, function() - return self.BloodSplat:SetZRotation(-5, 150) - end, function() - return self.BloodSplat:SetZRotation(0, 850, LUI.EASING.outQuadratic) - end}, {function() - return self.BloodSplat:playSound("splat", false, 1150) - end}, {function() - return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 218.92, _1080p * 547.08, - _1080p * 51.65, _1080p * 318.35, 1149) - end, function() - return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 88, _1080p * 718, _1080p * -71, - _1080p * 441, 70) - end, function() - return self.BloodSplat:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 80, _1080p * 710, _1080p * -71, - _1080p * 441, 129, LUI.EASING.outQuadratic) - end}}) - end - if CONDITIONS.IsThirdGameMode(self) then - ZombiesLogo:RegisterAnimationSequence("Intro", {{function() - return self.ZombiesLogo:SetAlpha(0, 0) - end, function() - return self.ZombiesLogo:SetAlpha(0, 1000) - end, function() - return self.ZombiesLogo:SetAlpha(1, 150) - end}, {function() - return self.ZombiesLogo:SetZRotation(5, 1000) - end, function() - return self.ZombiesLogo:SetZRotation(5, 150) - end, function() - return self.ZombiesLogo:SetZRotation(0, 850, LUI.EASING.outQuadratic) - end}, {function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * -429.8, _1080p * 1249.8, - _1080p * -260, _1080p * 728, 1000) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 80, _1080p * 720, _1080p * 51.65, - _1080p * 416.35, 149) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, - _1080p * 434, 200) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 36, - _1080p * 436, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68, _1080p * 748, _1080p * 35.68, - _1080p * 435.68, 50) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.35, _1080p * 750.35, - _1080p * 33.39, _1080p * 433.39, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.28, _1080p * 750.28, - _1080p * 31.51, _1080p * 431.51, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.22, _1080p * 748.22, - _1080p * 34.03, _1080p * 434.03, 50) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.64, _1080p * 750.64, - _1080p * 34.02, _1080p * 434.02, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70.47, _1080p * 750.47, - _1080p * 36.01, _1080p * 436.01, 50) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.33, _1080p * 748.33, - _1080p * 35.4, _1080p * 435.4, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 68.93, _1080p * 748.93, - _1080p * 32.9, _1080p * 432.9, 59) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 69.4, _1080p * 749.4, _1080p * 35.38, - _1080p * 435.38, 40) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 69.73, _1080p * 749.73, - _1080p * 36.61, _1080p * 436.61, 49) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 71.93, _1080p * 751.93, - _1080p * 34.65, _1080p * 434.65, 50) - end, function() - return self.ZombiesLogo:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 70, _1080p * 750, _1080p * 34, - _1080p * 434, 49, LUI.EASING.outQuadratic) - end}}) - end - if CONDITIONS.IsThirdGameMode(self) then - ZomLanPartyShadow:RegisterAnimationSequence("Intro", {{function() - return self.ZomLanPartyShadow:SetAlpha(0, 0) - end, function() - return self.ZomLanPartyShadow:SetAlpha(0, 1710) - end, function() - return self.ZomLanPartyShadow:SetAlpha(1, 290) - end}}) - end - if CONDITIONS.IsThirdGameMode(self) then - ZomLanParty:RegisterAnimationSequence("Intro", {{function() - return self.ZomLanParty:SetAlpha(0, 0) - end, function() - return self.ZomLanParty:SetAlpha(0, 1220) - end, function() - return self.ZomLanParty:SetAlpha(1, 490) - end}, {function() - return self.ZomLanParty:SetRGBFromInt(14042667, 0) - end}}) - end - MPLobbyMembersPlayercards:RegisterAnimationSequence("Intro", {{function() - return self.MPLobbyMembersPlayercards:SetAlpha(0, 0) - end, function() - return self.MPLobbyMembersPlayercards:SetAlpha(0, 700) - end, function() - return self.MPLobbyMembersPlayercards:SetAlpha(0, 1010) - end, function() - return self.MPLobbyMembersPlayercards:SetAlpha(1, 290) - end}}) - ButtonDescriptionText:RegisterAnimationSequence("Intro", {{function() - return self.ButtonDescriptionText:SetAlpha(0, 0) - end, function() - return self.ButtonDescriptionText:SetAlpha(0, 1220) - end, function() - return self.ButtonDescriptionText:SetAlpha(1, 490) - end}, {function() - return self.ButtonDescriptionText:SetRGBFromTable(SWATCHES.text.primaryText, 0) - end}, {function() - return self.ButtonDescriptionText:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 132, _1080p * 552, - _1080p * 524, _1080p * 556, 0) - end}}) - self._sequences.Intro = function() - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskTop:AnimateSequence("Intro") - end - if CONDITIONS.IsThirdGameMode(self) then - OuterMaskBottom:AnimateSequence("Intro") - end - SystemLinkMenuButtons:AnimateSequence("Intro") - if CONDITIONS.IsThirdGameMode(self) then - LobbyMembers:AnimateSequence("Intro") - end - ServerBrowser:AnimateSequence("Intro") - if CONDITIONS.IsThirdGameMode(self) then - BloodSplat:AnimateSequence("Intro") - end - if CONDITIONS.IsThirdGameMode(self) then - ZombiesLogo:AnimateSequence("Intro") - end - if CONDITIONS.IsThirdGameMode(self) then - ZomLanPartyShadow:AnimateSequence("Intro") - end - if CONDITIONS.IsThirdGameMode(self) then - ZomLanParty:AnimateSequence("Intro") - end - MPLobbyMembersPlayercards:AnimateSequence("Intro") - ButtonDescriptionText:AnimateSequence("Intro") - end - - ServerBrowser:RegisterAnimationSequence("DisplayServerBrowser", {{function() - return self.ServerBrowser:SetAlpha(0, 0) - end, function() - return self.ServerBrowser:SetAlpha(1, 80) - end}, {function() - return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 727, _1080p * 1858, _1080p * 216, - _1080p * 885, 0) - end}}) - self._sequences.DisplayServerBrowser = function() - ServerBrowser:AnimateSequence("DisplayServerBrowser") - end - - ServerBrowser:RegisterAnimationSequence("HideServerBrowser", {{function() - return self.ServerBrowser:SetAlpha(1, 0) - end, function() - return self.ServerBrowser:SetAlpha(0, 80) - end}}) - self._sequences.HideServerBrowser = function() - ServerBrowser:AnimateSequence("HideServerBrowser") - end - - end - - self._animationSets.DefaultAnimationSet() - self.addButtonHelperFunction = function(arg0, arg1) - arg0:AddButtonHelperText({ - helper_text = Engine.Localize("LUA_MENU_SELECT"), - button_ref = "button_primary", - side = "left", - clickable = true - }) - arg0:AddButtonHelperText({ - helper_text = Engine.Localize("LUA_MENU_BACK"), - button_ref = "button_secondary", - side = "left", - priority = 1, - clickable = true - }) - arg0:AddButtonHelperText({ - helper_text = Engine.Localize("LUA_MENU_OPTIONS_CAPS"), - button_ref = "button_start", - side = "left", - priority = 4, - clickable = true - }) - end - - self:addEventHandler("menu_create", self.addButtonHelperFunction) - - local bindButton = LUI.UIBindButton.new() - bindButton.id = "selfBindButton" - self:addElement(bindButton) - self.bindButton = bindButton - - setupSystemLinkMenu(self, controllerIndex, controller) - ACTIONS.AnimateSequence(self, "DefaultSequence") - if CONDITIONS.IsThirdGameMode(self) then - ACTIONS.SetAnimationSet(self, "ThirdGameModeAnimationSet") - ACTIONS.AnimateSequence(self, "Intro") - end - if CONDITIONS.IsCoreMultiplayer(self) then - ACTIONS.SetAnimationSet(self, "DefaultAnimationSet") - ACTIONS.AnimateSequence(self, "IntroCore") - end - - return self -end - -local PopFunc = function() - clearMatchData() - WipeGlobalModelsAtPath(serverBrowserPath) -end - -LUI.FlowManager.RegisterStackPushBehaviour("SystemLinkMenu", PushFunc) -LUI.FlowManager.RegisterStackPopBehaviour("SystemLinkMenu", PopFunc) diff --git a/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuRow.lua b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuRow.lua index f698516..f82567c 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuRow.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuRow.lua @@ -7,7 +7,7 @@ end function SystemLinkJoinMenuRow(menu, controller) local self = LUI.UIButton.new() - self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 1131 * _1080p, 0, 35 * _1080p) + self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 1790 * _1080p, 0, 35 * _1080p) self.id = "SystemLinkJoinMenuRow" self._animationSets = {} self._sequences = {} @@ -52,7 +52,7 @@ function SystemLinkJoinMenuRow(menu, controller) Host:SetCrossfadeTime(400) Host:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH) Host:SetMaxVisibleLines(1) - Host:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 12, _1080p * 279, _1080p * -12, _1080p * 12) + Host:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 9, _1080p * 275, _1080p * -12, _1080p * 12) Host:SubscribeToModelThroughElement(self, "host", function() local dataSource = self:GetDataSource() dataSource = dataSource.host:GetValue(controllerIndex) @@ -70,8 +70,8 @@ function SystemLinkJoinMenuRow(menu, controller) Players:SetRGBFromInt(14277081, 0) Players:SetFontSize(24 * _1080p) Players:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) - Players:SetAlignment(LUI.Alignment.Left) - Players:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 286, _1080p * 421, _1080p * -12, _1080p * 12) + Players:SetAlignment(LUI.Alignment.Center) + Players:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 283, _1080p * 418, _1080p * -12, _1080p * 12) Players:SubscribeToModelThroughElement(self, "players", function() local dataSource = self:GetDataSource() dataSource = dataSource.players:GetValue(controllerIndex) @@ -90,7 +90,7 @@ function SystemLinkJoinMenuRow(menu, controller) Status:SetFontSize(24 * _1080p) Status:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) Status:SetAlignment(LUI.Alignment.Left) - Status:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 426, _1080p * 626, _1080p * -12, _1080p * 12) + Status:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 426, _1080p * 620, _1080p * -12, _1080p * 12) Status:SubscribeToModelThroughElement(self, "status", function() local dataSource = self:GetDataSource() dataSource = dataSource.status:GetValue(controllerIndex) @@ -111,7 +111,7 @@ function SystemLinkJoinMenuRow(menu, controller) Map:SetAlignment(LUI.Alignment.Left) Map:SetStartupDelay(1250) Map:SetLineHoldTime(400) - Map:SetAnimMoveTime(300) + Map:SetAnimMoveTime(3000) Map:SetEndDelay(1000) Map:SetCrossfadeTime(500) Map:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH) @@ -135,7 +135,7 @@ function SystemLinkJoinMenuRow(menu, controller) Type:SetFontSize(24 * _1080p) Type:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) Type:SetAlignment(LUI.Alignment.Left) - Type:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 862, _1080p * 1119, _1080p * -12, _1080p * 12) + Type:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 862, _1080p * 1115, _1080p * -12, _1080p * 12) Type:SubscribeToModelThroughElement(self, "type", function() local dataSource = self:GetDataSource() dataSource = dataSource.type:GetValue(controllerIndex) @@ -146,6 +146,70 @@ function SystemLinkJoinMenuRow(menu, controller) self:addElement(Type) self.Type = Type + local Mod = nil + + Mod = LUI.UIStyledText.new() + Mod.id = "Mod" + Mod:SetRGBFromInt(14277081, 0) + Mod:SetFontSize(24 * _1080p) + Mod:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Mod:SetAlignment(LUI.Alignment.Left) + Mod:SetStartupDelay(1250) + Mod:SetLineHoldTime(400) + Mod:SetAnimMoveTime(3000) + Mod:SetEndDelay(1000) + Mod:SetCrossfadeTime(500) + Mod:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH) + Mod:SetMaxVisibleLines(1) + Mod:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1125, _1080p * 1400, _1080p * -12, _1080p * 12) + Mod:SubscribeToModelThroughElement(self, "mod", function() + local dataSource = self:GetDataSource() + dataSource = dataSource.mod:GetValue(controllerIndex) + if dataSource ~= nil then + Mod:setText(dataSource, 0) + end + end) + self:addElement(Mod) + self.Mod = Mod + + local Ping = nil + + Ping = LUI.UIText.new() + Ping.id = "Ping" + Ping:SetRGBFromInt(14277081, 0) + Ping:SetFontSize(24 * _1080p) + Ping:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Ping:SetAlignment(LUI.Alignment.Center) + Ping:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1410, _1080p * 1460, _1080p * -12, _1080p * 12) + Ping:SubscribeToModelThroughElement(self, "ping", function() + local dataSource = self:GetDataSource() + dataSource = dataSource.ping:GetValue(controllerIndex) + if dataSource ~= nil then + Ping:setText(dataSource, 0) + end + end) + self:addElement(Ping) + self.Ping = Ping + + local PrivateS = nil + + PrivateS = LUI.UIText.new() + PrivateS.id = "PrivateS" + PrivateS:SetRGBFromInt(14277081, 0) + PrivateS:SetFontSize(24 * _1080p) + PrivateS:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + PrivateS:SetAlignment(LUI.Alignment.Center) + PrivateS:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1470, _1080p * 1550, _1080p * -12, _1080p * 12) + PrivateS:SubscribeToModelThroughElement(self, "priv", function() + local dataSource = self:GetDataSource() + dataSource = dataSource.priv:GetValue(controllerIndex) + if dataSource ~= nil then + PrivateS:setText(dataSource, 0) + end + end) + self:addElement(PrivateS) + self.PrivateS = PrivateS + local Cap = nil Cap = LUI.UIImage.new() @@ -180,6 +244,15 @@ function SystemLinkJoinMenuRow(menu, controller) Type:RegisterAnimationSequence("ButtonOver", {{function() return self.Type:SetRGBFromInt(0, 0) end}}) + Mod:RegisterAnimationSequence("ButtonOver", {{function() + return self.Mod:SetRGBFromInt(0, 0) + end}}) + Ping:RegisterAnimationSequence("ButtonOver", {{function() + return self.Ping:SetRGBFromInt(0, 0) + end}}) + PrivateS:RegisterAnimationSequence("ButtonOver", {{function() + return self.PrivateS:SetRGBFromInt(0, 0) + end}}) Cap:RegisterAnimationSequence("ButtonOver", {{function() return self.Cap:SetRGBFromInt(0, 0) end}}) @@ -190,6 +263,9 @@ function SystemLinkJoinMenuRow(menu, controller) Status:AnimateSequence("ButtonOver") Map:AnimateSequence("ButtonOver") Type:AnimateSequence("ButtonOver") + Mod:AnimateSequence("ButtonOver") + Ping:AnimateSequence("ButtonOver") + PrivateS:AnimateSequence("ButtonOver") Cap:AnimateSequence("ButtonOver") end @@ -213,6 +289,15 @@ function SystemLinkJoinMenuRow(menu, controller) Type:RegisterAnimationSequence("ButtonUp", {{function() return self.Type:SetRGBFromInt(14277081, 0) end}}) + Mod:RegisterAnimationSequence("ButtonUp", {{function() + return self.Mod:SetRGBFromInt(14277081, 0) + end}}) + Ping:RegisterAnimationSequence("ButtonUp", {{function() + return self.Ping:SetRGBFromInt(14277081, 0) + end}}) + PrivateS:RegisterAnimationSequence("ButtonUp", {{function() + return self.PrivateS:SetRGBFromInt(14277081, 0) + end}}) Cap:RegisterAnimationSequence("ButtonUp", {{function() return self.Cap:SetRGBFromInt(14277081, 0) end}}) @@ -223,6 +308,9 @@ function SystemLinkJoinMenuRow(menu, controller) Status:AnimateSequence("ButtonUp") Map:AnimateSequence("ButtonUp") Type:AnimateSequence("ButtonUp") + Mod:AnimateSequence("ButtonUp") + Ping:AnimateSequence("ButtonUp") + PrivateS:AnimateSequence("ButtonUp") Cap:AnimateSequence("ButtonUp") end diff --git a/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuTitleRow.lua b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuTitleRow.lua index ae77f6f..8a40b5a 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuTitleRow.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkJoinMenuTitleRow.lua @@ -1,26 +1,35 @@ local function PostLoadFunc(element, controllerIndex, controller) - assert(element.Status) - assert(element.Type) + assert(element.Host) assert(element.Players) + assert(element.Status) assert(element.Map) - assert(element.Host) + assert(element.Type) + assert(element.Mod) + assert(element.Ping) + assert(element.PrivateS) if IsLanguageOversizedFont() then - element.Status:SetTop(-11 * _1080p, 0) - element.Status:SetBottom(11 * _1080p, 0) - element.Type:SetTop(-11 * _1080p, 0) - element.Type:SetBottom(11 * _1080p, 0) + element.Host:SetTop(-11 * _1080p, 0) + element.Host:SetBottom(11 * _1080p, 0) element.Players:SetTop(-11 * _1080p, 0) element.Players:SetBottom(11 * _1080p, 0) + element.Status:SetTop(-11 * _1080p, 0) + element.Status:SetBottom(11 * _1080p, 0) element.Map:SetTop(-11 * _1080p, 0) element.Map:SetBottom(11 * _1080p, 0) - element.Host:SetTop(-11 * _1080p, 0) - element.Host:SetBottom(11 * _1080p, 0) + element.Type:SetTop(-11 * _1080p, 0) + element.Type:SetBottom(11 * _1080p, 0) + element.Mod:SetTop(-11 * _1080p, 0) + element.Mod:SetBottom(11 * _1080p, 0) + element.Ping:SetTop(-11 * _1080p, 0) + element.Ping:SetBottom(11 * _1080p, 0) + element.PrivateS:SetTop(-11 * _1080p, 0) + element.PrivateS:SetBottom(11 * _1080p, 0) end end function SystemLinkJoinMenuTitleRow(menu, controller) local self = LUI.UIElement.new() - self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 1131 * _1080p, 0, 40 * _1080p) + self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 1790 * _1080p, 0, 40 * _1080p) self.id = "SystemLinkJoinMenuTitleRow" local controllerIndex = controller and controller.controllerIndex if not controllerIndex and not Engine.InFrontend() then @@ -48,6 +57,30 @@ function SystemLinkJoinMenuTitleRow(menu, controller) self:addElement(Host) self.Host = Host + local Players = nil + + Players = LUI.UIText.new() + Players.id = "Players" + Players:setText(Engine.Localize("MENU_PLAYERS"), 0) + Players:SetFontSize(24 * _1080p) + Players:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Players:SetAlignment(LUI.Alignment.Center) + Players:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 283, _1080p * 418, _1080p * -12, _1080p * 12) + self:addElement(Players) + self.Players = Players + + local Status = nil + + Status = LUI.UIText.new() + Status.id = "Status" + Status:setText(Engine.Localize("MENU_STATUS_NAME"), 0) + Status:SetFontSize(24 * _1080p) + Status:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Status:SetAlignment(LUI.Alignment.Left) + Status:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 426, _1080p * 620, _1080p * -12, _1080p * 12) + self:addElement(Status) + self.Status = Status + local Map = nil Map = LUI.UIText.new() @@ -60,18 +93,6 @@ function SystemLinkJoinMenuTitleRow(menu, controller) self:addElement(Map) self.Map = Map - local Players = nil - - Players = LUI.UIText.new() - Players.id = "Players" - Players:setText(Engine.Localize("MENU_NUMPLAYERS"), 0) - Players:SetFontSize(24 * _1080p) - Players:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) - Players:SetAlignment(LUI.Alignment.Left) - Players:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 283, _1080p * 418, _1080p * -12, _1080p * 12) - self:addElement(Players) - self.Players = Players - local Type = nil Type = LUI.UIText.new() @@ -80,21 +101,45 @@ function SystemLinkJoinMenuTitleRow(menu, controller) Type:SetFontSize(24 * _1080p) Type:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) Type:SetAlignment(LUI.Alignment.Left) - Type:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 862, _1080p * 1119, _1080p * -12, _1080p * 12) + Type:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 862, _1080p * 1115, _1080p * -12, _1080p * 12) self:addElement(Type) self.Type = Type - local Status = nil + local Mod = nil - Status = LUI.UIText.new() - Status.id = "Status" - Status:setText(Engine.Localize("MENU_STATUS_NAME"), 0) - Status:SetFontSize(24 * _1080p) - Status:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) - Status:SetAlignment(LUI.Alignment.Left) - Status:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 426, _1080p * 620, _1080p * -12, _1080p * 12) - self:addElement(Status) - self.Status = Status + Mod = LUI.UIText.new() + Mod.id = "Mod" + Mod:setText(Engine.Localize("MENU_MOD"), 0) + Mod:SetFontSize(24 * _1080p) + Mod:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Mod:SetAlignment(LUI.Alignment.Left) + Mod:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1125, _1080p * 1400, _1080p * -12, _1080p * 12) + self:addElement(Mod) + self.Mod = Mod + + local Ping = nil + + Ping = LUI.UIText.new() + Ping.id = "Ping" + Ping:setText(Engine.Localize("MENU_PING"), 0) + Ping:SetFontSize(24 * _1080p) + Ping:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + Ping:SetAlignment(LUI.Alignment.Center) + Ping:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1410, _1080p * 1460, _1080p * -12, _1080p * 12) + self:addElement(Ping) + self.Ping = Ping + + local PrivateS = nil + + PrivateS = LUI.UIText.new() + PrivateS.id = "PrivateS" + PrivateS:setText(Engine.Localize("MENU_PRIVATE"), 0) + PrivateS:SetFontSize(24 * _1080p) + PrivateS:SetFont(FONTS.GetFont(FONTS.MainMedium.File)) + PrivateS:SetAlignment(LUI.Alignment.Center) + PrivateS:SetAnchorsAndPosition(0, 1, 0.5, 0.5, _1080p * 1470, _1080p * 1550, _1080p * -12, _1080p * 12) + self:addElement(PrivateS) + self.PrivateS = PrivateS PostLoadFunc(self, controllerIndex, controller) return self diff --git a/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenu.lua b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenu.lua new file mode 100644 index 0000000..12672c4 --- /dev/null +++ b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenu.lua @@ -0,0 +1,301 @@ +local serverBrowserPath = "frontEnd.systemLinkMenu.serverBrowser" + +local leaveMenuHandler = function(menu, controller) + -- Engine.StopGameMode() + LUI.FlowManager.RequestLeaveMenu(menu, true) +end + +local updateServerDisplayListAndCreateModels + +updateServerDisplayListAndCreateModels = function(menu, controller, index) + local waitDuration = menu:Wait(250) + waitDuration.onComplete = function() + return updateServerDisplayListAndCreateModels(menu, controller) + end + + Lobby.UpdateServerDisplayList(controller) + Lobby.CreateServersDataModels(controller) +end + +local function setupSystemLinkMenu(menu, controller, index) + assert(menu.ServerBrowser) + assert(menu.ServerBrowser.ServerList) + menu:setPriority(-1) + menu.isSignInMenu = true + local isAliensMode = Engine.IsAliensMode() + + if isAliensMode then + Engine.SetFrontEndSceneSection("zm_main", 1) + menu.MenuTitle.MenuBreadcrumbs:setText(ToUpperCase( + Engine.Localize("LUA_MENU_BREADCRUMB_2_ITEMS", "IW7-Mod", "ZOMBIES")), 0) + else + menu.MenuTitle.MenuBreadcrumbs:setText(ToUpperCase( + Engine.Localize("LUA_MENU_BREADCRUMB_2_ITEMS", "IW7-Mod", "MULTIPLAYER")), 0) + end + + menu.addButtonHelperFunction = function(helperMenu, helperController) + menu:AddButtonHelperText({ + helper_text = Engine.Localize("MENU_SB_TOOLTIP_BTN_REFRESH"), + button_ref = "button_alt1", + side = "left", + priority = 2, + clickable = true + }) + end + + menu:addEventHandler("menu_create", menu.addButtonHelperFunction) + + assert(Engine.IsUserSignedIn(controller)) + if isAliensMode then + Engine.ExecNow(CPConfig.default_systemlink, controller) + else + Engine.ExecNow(MPConfig.default_systemlink, controller) + end + + Engine.Exec(MPConfig.default_dvars) + + menu:addEventHandler("menu_create", function(menuHandler, a2) + assert(menu.bindButton) + + if CONDITIONS.IsThirdGameMode(menu) then + ACTIONS.AnimateSequence(menu, "DisplayServerBrowser") + end + + menu.bindButton:addEventHandler("button_secondary", function(buttonHandler, buttonEvent) + leaveMenuHandler(buttonHandler, buttonEvent) + end) + + menu.bindButton:addEventHandler("button_alt1", function(buttonHandler, buttonEvent) + Lobby.RefreshServerList(controller) + ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) + end) + end) + + Engine.PLMRefreshData() + if Engine.IsCoreMode() then + ClientWeapon.SetWeaponVisible(0, false) + ClientCharacter.SetCharacterVisible(0, false) + end + + Lobby.BuildServerList(controller) + Lobby.RefreshServerList(controller) + + assert(menu.ServerBrowser) + assert(menu.ServerBrowser.ServerList) + local serverCountDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. ".serverCount") + menu:SubscribeToModel(serverCountDataSource:GetModel(controller), function() + local serverCount = serverCountDataSource:GetValue(controller) + if serverCount ~= nil then + if serverCount == 0 then + local scopedData = LUI.FlowManager.GetScopedData(menu) + if scopedData.serverBrowserFocused then + scopedData.serverBrowserFocused = false + ACTIONS.LoseFocus(menu, "ServerBrowser", controller) + end + else + ACTIONS.GainFocus(menu, "ServerBrowser", controller) + end + menu.ServerBrowser:SetBlurHeight(serverCount) + end + end) + + local serverListDataSource = LUI.DataSourceFromList.new(serverCountDataSource) + serverListDataSource.MakeDataSourceAtIndex = function(dataSource, index, controller) + local color = index % 2 == 0 and COLORS.white or COLORS.black + local statusDataSource = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".status") + return { + index = index, + color = color, + host = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".host"), + map = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".map"), + players = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".players"), + type = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".type"), + mod = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".mod"), + ping = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".ping"), + priv = LUI.DataSourceInGlobalModel.new(serverBrowserPath .. "." .. index .. ".priv"), + status = statusDataSource:Filter("status", function(value, model) + if value == 1 then + return Engine.Localize("MENU_LOBBY") + else + return Engine.Localize("MENU_IN_GAME_CAPS") + end + end) + } + end + + menu.ServerBrowser.ServerList:SetGridDataSource(serverListDataSource) + + assert(menu.bindButton) + menu.bindButton:addEventHandler("button_start", function(buttonHandler, buttonEvent) + local scopedData = LUI.FlowManager.GetScopedData(menu) + scopedData.optionsMenuOpened = true + ACTIONS.OpenMenu("OptionsMenu", true, buttonEvent.controller) + ACTIONS.PlaySoundSetSound(menu, "selectAlt", false) + end) + + local waitDuration = menu:Wait(250) + waitDuration.onComplete = function() + return updateServerDisplayListAndCreateModels(menu, controller) + end + + Engine.StopMenuVideo() +end + +MenuBuilder.m_types["SystemLinkMenu"] = function(menu, controller) + local self = LUI.UIElement.new() + self.id = "SystemLinkMenu" + self._animationSets = {} + self._sequences = {} + local controllerIndex = controller and controller.controllerIndex + if not controllerIndex and not Engine.InFrontend() then + controllerIndex = self:getRootController() + end + assert(controllerIndex) + self.soundSet = "cpMainMenuDefault" + self:playSound("menu_open") + + local MenuTitle = nil + MenuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", { + controllerIndex = controllerIndex + }) + MenuTitle.id = "MenuTitle" + MenuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("SERVER BROWSER")), 0) + MenuTitle.MenuBreadcrumbs:setText(ToUpperCase(Engine.Localize("EXE_LOCAL_PLAY")), 0) + MenuTitle.Icon:SetTop(_1080p * -28.5, 0) + MenuTitle.Icon:SetBottom(_1080p * 61.5, 0) + MenuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 96, _1080p * 1056, _1080p * 54, _1080p * 134) + self:addElement(MenuTitle) + self.MenuTitle = MenuTitle + + local ButtonHelperBar = nil + + ButtonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", { + controllerIndex = controllerIndex + }) + ButtonHelperBar.id = "ButtonHelperBar" + ButtonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0) + self:addElement(ButtonHelperBar) + self.ButtonHelperBar = ButtonHelperBar + + local SocialFeed = nil + + SocialFeed = MenuBuilder.BuildRegisteredType("SocialFeed", { + controllerIndex = controllerIndex + }) + SocialFeed.id = "SocialFeed" + SocialFeed:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -115, _1080p * -85) + self:addElement(SocialFeed) + self.SocialFeed = SocialFeed + + local ServerBrowser = nil + + ServerBrowser = MenuBuilder.BuildRegisteredType("ServerBrowser", { + controllerIndex = controllerIndex + }) + ServerBrowser.id = "ServerBrowser" + ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 1790, _1080p * 0, _1080p * 0) + self:addElement(ServerBrowser) + self.ServerBrowser = ServerBrowser + + self._animationSets.DefaultAnimationSet = function() + ServerBrowser:RegisterAnimationSequence("DefaultSequence", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 1790, _1080p * 216, _1080p * 885, 0) + end}}) + self._sequences.DefaultSequence = function() + ServerBrowser:AnimateSequence("DefaultSequence") + end + + ServerBrowser:RegisterAnimationSequence("IntroCore", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 1790, _1080p * 216, _1080p * 885, 0) + end}}) + self._sequences.IntroCore = function() + ServerBrowser:AnimateSequence("IntroCore") + end + end + + self._animationSets.ThirdGameModeAnimationSet = function() + self._sequences.DefaultSequence = function() + end + + ServerBrowser:RegisterAnimationSequence("Intro", {{function() + return self.ServerBrowser:SetAlpha(0, 0) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 1790, _1080p * 216, _1080p * 885, 0) + end}}) + + self._sequences.Intro = function() + ServerBrowser:AnimateSequence("Intro") + end + + ServerBrowser:RegisterAnimationSequence("DisplayServerBrowser", {{function() + return self.ServerBrowser:SetAlpha(0, 0) + end, function() + return self.ServerBrowser:SetAlpha(1, 80) + end}, {function() + return self.ServerBrowser:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 1790, _1080p * 216, _1080p * 885, 0) + end}}) + self._sequences.DisplayServerBrowser = function() + ServerBrowser:AnimateSequence("DisplayServerBrowser") + end + + ServerBrowser:RegisterAnimationSequence("HideServerBrowser", {{function() + return self.ServerBrowser:SetAlpha(1, 0) + end, function() + return self.ServerBrowser:SetAlpha(0, 80) + end}}) + self._sequences.HideServerBrowser = function() + ServerBrowser:AnimateSequence("HideServerBrowser") + end + + end + + self._animationSets.DefaultAnimationSet() + self.addButtonHelperFunction = function(arg0, arg1) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_BACK"), + button_ref = "button_secondary", + side = "left", + priority = 1, + clickable = true + }) + arg0:AddButtonHelperText({ + helper_text = Engine.Localize("LUA_MENU_OPTIONS_CAPS"), + button_ref = "button_start", + side = "left", + priority = 4, + clickable = true + }) + end + + self:addEventHandler("menu_create", self.addButtonHelperFunction) + + local bindButton = LUI.UIBindButton.new() + bindButton.id = "selfBindButton" + self:addElement(bindButton) + self.bindButton = bindButton + + setupSystemLinkMenu(self, controllerIndex, controller) + ACTIONS.AnimateSequence(self, "DefaultSequence") + if CONDITIONS.IsThirdGameMode(self) then + ACTIONS.SetAnimationSet(self, "ThirdGameModeAnimationSet") + ACTIONS.AnimateSequence(self, "Intro") + end + if CONDITIONS.IsCoreMultiplayer(self) then + ACTIONS.SetAnimationSet(self, "DefaultAnimationSet") + ACTIONS.AnimateSequence(self, "IntroCore") + end + + return self +end + +local PopFunc = function() + clearMatchData() + WipeGlobalModelsAtPath(serverBrowserPath) +end + +LUI.FlowManager.RegisterStackPushBehaviour("SystemLinkMenu", PushFunc) +LUI.FlowManager.RegisterStackPopBehaviour("SystemLinkMenu", PopFunc) diff --git a/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenuButtons.lua similarity index 78% rename from data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua rename to data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenuButtons.lua index da91b96..0725531 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/ServerButtons.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/SystemLinkMenuButtons.lua @@ -1,6 +1,6 @@ function SystemLinkMenuButtons(menu, controller) local SystemLinkMenuButtons = LUI.UIVerticalList.new() - SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 300 * _1080p) + SystemLinkMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, 0, 450 * _1080p, 0, 300 * _1080p) SystemLinkMenuButtons.id = "SystemLinkMenuButtons" local controllerIndex = controller and controller.controllerIndex @@ -17,13 +17,9 @@ function SystemLinkMenuButtons(menu, controller) controllerIndex = controllerIndex }) CASButton.id = "CASButton" - - if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then - CASButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS") - end - + CASButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_CREATE_A_CLASS") CASButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CREATE_A_CLASS")), 0) - CASButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110) + CASButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 450, _1080p * 80, _1080p * 110) SystemLinkMenuButtons:addElement(CASButton) SystemLinkMenuButtons.CASButton = CASButton end @@ -34,20 +30,15 @@ function SystemLinkMenuButtons(menu, controller) controllerIndex = controllerIndex }) LoadoutButton.id = "LoadoutButton" - - if CONDITIONS.IsThirdGameMode(SystemLinkMenuButtons) then - LoadoutButton.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC") - end - + LoadoutButton.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC") LoadoutButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS")), 0) - LoadoutButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150) + LoadoutButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 450, _1080p * 80, _1080p * 110) SystemLinkMenuButtons:addElement(LoadoutButton) SystemLinkMenuButtons.LoadoutButton = LoadoutButton end if CONDITIONS.IsCoreMultiplayer(SystemLinkMenuButtons) then CASButton:addEventHandler("button_action", function(button, event) - local currentControllerIndex = event.controller or controllerIndex ClientWeapon.SetWeaponVisible(0, true) ClientCharacter.SetCharacterVisible(0, true) ACTIONS.OpenCreateAClass(SystemLinkMenuButtons, event) diff --git a/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua b/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua index 8ed7b35..f8e2980 100644 --- a/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua +++ b/data/cdata/ui_scripts/SystemLinkMenu/__init__.lua @@ -2,7 +2,8 @@ if not Engine.InFrontend() then return end -require("ServerButtons") -require("SysLinkBrowser") +require("ServerBrowser") +require("SystemLinkMenuButtons") +require("SystemLinkMenu") require("SystemLinkJoinMenuRow") require("SystemLinkJoinMenuTitleRow") diff --git a/data/cdata/ui_scripts/debug/__init__.lua b/data/cdata/ui_scripts/debug/__init__.lua new file mode 100644 index 0000000..c02bacf --- /dev/null +++ b/data/cdata/ui_scripts/debug/__init__.lua @@ -0,0 +1,64 @@ +LUI.UIElement.debugDraw = function ( f84_arg0, f84_arg1 ) + if not f84_arg1 then + f84_arg1 = 1 + end + f84_arg0:addElement( LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + red = 0, + blue = 0, + green = 1, + alpha = 0.2 + } ) ) + f84_arg0:addElement( LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + red = 1, + blue = 0, + green = 0, + alpha = 1, + bottom = f84_arg1 + } ) ) + f84_arg0:addElement( LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + material = RegisterMaterial( "white" ), + red = 1, + blue = 0, + green = 0, + alpha = 1, + left = -1 * f84_arg1 + } ) ) + f84_arg0:addElement( LUI.UIImage.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + material = RegisterMaterial( "white" ), + red = 1, + blue = 0, + green = 0, + alpha = 1, + top = -1 * f84_arg1 + } ) ) + f84_arg0:addElement( LUI.UIImage.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + material = RegisterMaterial( "white" ), + red = 1, + blue = 0, + green = 0, + alpha = 1, + right = f84_arg1 + } ) ) +end diff --git a/data/cdata/zone/iw7mod_code_post_gfx.ff b/data/cdata/zone/iw7mod_code_post_gfx.ff index eae7a49..4af4b0f 100644 Binary files a/data/cdata/zone/iw7mod_code_post_gfx.ff and b/data/cdata/zone/iw7mod_code_post_gfx.ff differ diff --git a/src/client/component/server_list.cpp b/src/client/component/server_list.cpp index e5f056d..464df82 100644 --- a/src/client/component/server_list.cpp +++ b/src/client/component/server_list.cpp @@ -22,7 +22,7 @@ namespace server_list { namespace { - const int server_limit = 100; + const int server_limit = 128; struct server_info { @@ -89,10 +89,11 @@ namespace server_list } } - const char* ui_feeder_item_text(int arg0, int arg1, const int index, const int column, char* name) - { - std::lock_guard _(mutex); + unsigned short node_index = 0; + const char* ui_feeder_item_text(int localClientNum, int feederID, const int index, const int column, + float* s0, float* t0, float* s1, float* t1, game::Material** material) + { const auto i = index; if (i >= servers.size()) { @@ -102,7 +103,9 @@ namespace server_list switch (column) { case 2: + { return servers[i].host_name.empty() ? "" : servers[i].host_name.data(); + } case 3: { const auto& map_name = servers[i].map_name; @@ -125,29 +128,63 @@ namespace server_list servers[i].clients); } case 5: + { return servers[i].game_type.empty() ? "" : servers[i].game_type.data(); - //case 10: - //{ - // const auto ping = servers[i].ping ? servers[i].ping : 999; - // if (ping < 75) - // { - // return utils::string::va("^2%d", ping); - // } - // else if (ping < 150) - // { - // return utils::string::va("^3%d", ping); - // } - // return utils::string::va("^1%d", ping); - //} + } + case 6: + { + return servers[i].mod_name.empty() ? "" : servers[i].mod_name.data(); + } + case 7: + { + const auto ping = servers[i].ping ? servers[i].ping : 999; + if (ping < 75) + { + return utils::string::va("^2%d", ping); + } + else if (ping < 150) + { + return utils::string::va("^3%d", ping); + } + return utils::string::va("^1%d", ping); + } + case 8: + { + return servers[i].is_private ? "Yes" : "No"; + } case 10: + { + // add custom feeder values here + game::Material* material_[2]; + + const char* val = nullptr; + unsigned short n_index = 0; + + val = ui_feeder_item_text(0, 0, i, 6, 0, 0, 0, 0, material_); + n_index = game::LUI_Model_CreateModelFromPath(node_index, "mod"); + game::LUI_Model_SetString(n_index, val); + + val = ui_feeder_item_text(0, 0, i, 7, 0, 0, 0, 0, material_); + n_index = game::LUI_Model_CreateModelFromPath(node_index, "ping"); + game::LUI_Model_SetString(n_index, val); + + val = ui_feeder_item_text(0, 0, i, 8, 0, 0, 0, 0, material_); + n_index = game::LUI_Model_CreateModelFromPath(node_index, "priv"); + game::LUI_Model_SetString(n_index, val); + return servers[i].in_game ? "0" : "1"; - //case 6: - // return servers[i].mod_name.empty() ? "" : servers[i].mod_name.data(); + } default: return ""; } } + unsigned short lui_model_create_model_from_path_stub(const unsigned short parentNodeIndex, const char* path) + { + node_index = game::LUI_Model_CreateModelFromPath(parentNodeIndex, path); + return node_index; + } + void sort_serverlist() { std::stable_sort(servers.begin(), servers.end(), [](const server_info& a, const server_info& b) @@ -377,6 +414,7 @@ namespace server_list utils::hook::call(0x14069E45E, get_server_count); utils::hook::jump(0x140CC5F00, ui_feeder_item_text); + utils::hook::call(0x14069E4D7, lui_model_create_model_from_path_stub); scheduler::loop(do_frame_work, scheduler::pipeline::main); diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 2f975ee..24f002c 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -166,6 +166,8 @@ namespace game WEAK symbol LUI_Interface_DebugPrint{ 0x14061C43F }; WEAK symbol LUI_EnterCriticalSection{ 0x140600080 }; WEAK symbol LUI_LeaveCriticalSection{ 0x140602280 }; + WEAK symbol LUI_Model_CreateModelFromPath{ 0x1404EBF30 }; + WEAK symbol LUI_Model_SetString{ 0x1404ECE90 }; WEAK symbol Live_SyncOnlineDataFlags{ 0x140DC5CE0 }; WEAK symbol Live_GetXuid{ 0x140D32A20 };