combat training (#299)
* combat training * Disable bot & gamesetting customization menus - feature not yet available. - cleanup unused code
This commit is contained in:
110
data/cdata/ui_scripts/MainMenu/CPMPMainMenuButtons.lua
Normal file
110
data/cdata/ui_scripts/MainMenu/CPMPMainMenuButtons.lua
Normal file
@ -0,0 +1,110 @@
|
||||
if not Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
local MenuOverride = function(oldmenu, postLoad)
|
||||
local newmenu = function(menu, controller)
|
||||
local RootController = controller and controller.controllerIndex
|
||||
if not RootController and not Engine.InFrontend() then
|
||||
RootController = self:getRootController()
|
||||
end
|
||||
assert(RootController)
|
||||
|
||||
local self = oldmenu(menu, controller)
|
||||
postLoad(self)
|
||||
return self
|
||||
end
|
||||
return newmenu
|
||||
end
|
||||
|
||||
local GetAnchorsAndPosition = function(element)
|
||||
local l_left, l_top, l_right, l_bottom = element:getLocalRect()
|
||||
local a_left, a_top, a_right, a_bottom = element:GetAnchorData()
|
||||
return { a_left, a_right, a_top, a_bottom, l_left, l_right, l_bottom, l_top }
|
||||
end
|
||||
|
||||
local customServerButton = function(self, override, preLoad)
|
||||
if not CONDITIONS.IsServerBrowserAllowed(self) then
|
||||
return
|
||||
end
|
||||
|
||||
self.ServerBrowserButton = override
|
||||
assert(self.ServerBrowserButton)
|
||||
|
||||
self.ServerBrowserButton:registerEventHandler("button_action", function(f5_arg0, f5_arg1)
|
||||
preLoad()
|
||||
LUI.FlowManager.RequestAddMenu("SystemLinkMenu", false, f5_arg1.controller, false, {}, true)
|
||||
end)
|
||||
|
||||
if self.ServerBrowserButton then
|
||||
self.ServerBrowserButton.id = "ServerBrowser"
|
||||
self.ServerBrowserButton.buttonDescription = Engine.Localize("Browse custom servers")
|
||||
self.ServerBrowserButton.Text:setText(ToUpperCase(Engine.Localize("Server Browser")), 0)
|
||||
end
|
||||
end
|
||||
|
||||
local customModsButton = function(self, info)
|
||||
if not CONDITIONS.IsServerBrowserAllowed(self) then
|
||||
return
|
||||
end
|
||||
|
||||
if not (type(info.position) == "table" and #info.position == 8) then
|
||||
return
|
||||
end
|
||||
|
||||
local ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", { controllerIndex = controllerIndex })
|
||||
ModsButton.id = "ModsButton"
|
||||
ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC")
|
||||
ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0)
|
||||
if CONDITIONS.InFrontendPublicMP and CONDITIONS.IsStoreAllowed() then
|
||||
self:removeElement(self.StoreButton)
|
||||
end
|
||||
ModsButton:SetAnchorsAndPosition(table.unpack(info.position))
|
||||
|
||||
ModsButton:registerEventHandler("button_action", function(f5_arg0, f5_arg1)
|
||||
if info.preLoad then
|
||||
info.preLoad()
|
||||
end
|
||||
LUI.FlowManager.RequestAddMenu("ModSelectMenu", false, f5_arg1.controller, false, {}, true)
|
||||
end)
|
||||
|
||||
ModsButton:SetAlignment(LUI.Alignment.Left)
|
||||
self:addElement(ModsButton)
|
||||
self.ModsButton = ModsButton
|
||||
end
|
||||
|
||||
local postLoadMP = function(self)
|
||||
local preLoadMP = function()
|
||||
local ActiveController = Engine.GetFirstActiveController()
|
||||
if Engine.GetDvarBool("xblive_competitionmatch") then
|
||||
Engine.SetDvarBool("xblive_competitionmatch", false)
|
||||
Engine.Exec("set remove_mlg_rules 1")
|
||||
end
|
||||
Engine.ExecNow(MPConfig.default_xboxlive, ActiveController)
|
||||
end
|
||||
|
||||
local modButtonInfo = {}
|
||||
modButtonInfo.preLoad = function() end
|
||||
modButtonInfo.position = { 0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * (120 + 30) }
|
||||
customModsButton(self, modButtonInfo)
|
||||
customServerButton(self, self.MLGGameBattlesButton, preLoadMP)
|
||||
end
|
||||
|
||||
local postLoadCP = function(self)
|
||||
local preLoadCP = function()
|
||||
local ActiveController = Engine.GetFirstActiveController()
|
||||
Engine.ExecNow(MPConfig.default_xboxlive, ActiveController)
|
||||
end
|
||||
|
||||
local modButtonInfo = {}
|
||||
modButtonInfo.preLoad = function() end
|
||||
modButtonInfo.position = { 0, 1, 0, 1, 0, _1080p * 500, _1080p * 300, _1080p * (300 + 30) }
|
||||
customModsButton(self, modButtonInfo)
|
||||
customServerButton(self, self:getChildById("PublicMatch"), preLoadCP)
|
||||
end
|
||||
|
||||
local MPMainMenuButtons = MenuOverride(package.loaded["frontEnd.mp.MPMainMenuButtons"].MPMainMenuButtons, postLoadMP)
|
||||
local CPMainMenuButtons = MenuOverride(package.loaded["frontEnd.cp.CPMainMenuButtons"].CPMainMenuButtons, postLoadCP)
|
||||
|
||||
MenuBuilder.registerType("MPMainMenuButtons", MPMainMenuButtons)
|
||||
MenuBuilder.registerType("CPMainMenuButtons", CPMainMenuButtons)
|
@ -1,11 +1,11 @@
|
||||
local CPMainMenu_original = MenuBuilder.m_types["CPMainMenu"]
|
||||
function CPMainMenuStub(menu, controller)
|
||||
ret = CPMainMenu_original(menu, controller)
|
||||
ret = CPMainMenu_original(menu, controller)
|
||||
|
||||
-- play music immediately
|
||||
Engine.PlayMusic(CoD.Music.MainCPMusic)
|
||||
-- play music immediately
|
||||
Engine.PlayMusic(CoD.Music.MainCPMusic)
|
||||
|
||||
return ret
|
||||
return ret
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["CPMainMenu"] = CPMainMenuStub
|
||||
|
@ -1,201 +0,0 @@
|
||||
local f0_local0 = function(arg0, arg1)
|
||||
Engine.Exec("xblive_privatematch 0")
|
||||
utils.cp.AliensUtils.AliensRunConfig(arg1.controller)
|
||||
LUI.FlowManager.RequestAddMenu("SystemLinkMenu", false, arg1.controller, false, {}, true)
|
||||
end
|
||||
|
||||
local f0_local1 = function(arg0, arg1)
|
||||
f0_local0(arg0, arg1)
|
||||
end
|
||||
|
||||
local f0_local2 = function(arg0, arg1)
|
||||
Engine.Exec(MPConfig.default_xboxlive, arg1.controller)
|
||||
Engine.SetDvarBool("xblive_privatematch", true)
|
||||
SetIsAliensSolo(true)
|
||||
Engine.SetDvarInt("party_maxplayers", 1)
|
||||
Engine.Exec("xstartprivatematch")
|
||||
LUI.FlowManager.RequestAddMenu("CPPrivateMatchMenu", false, arg1.controller, false, {
|
||||
showPlayNowButton = true,
|
||||
isPublicMatch = false
|
||||
})
|
||||
end
|
||||
|
||||
local f0_local3 = function(arg0, arg1)
|
||||
Engine.Exec(MPConfig.default_xboxlive, arg1.controller)
|
||||
Engine.SetDvarBool("xblive_privatematch", true)
|
||||
SetIsAliensSolo(false)
|
||||
Engine.Exec("xstartprivatematch")
|
||||
LUI.FlowManager.RequestAddMenu("CPPrivateMatchMenu", false, arg1.controller, false, {
|
||||
showPlayNowButton = true,
|
||||
isPublicMatch = false
|
||||
})
|
||||
end
|
||||
|
||||
local f0_local4 = function(arg0, arg1, arg2)
|
||||
assert(arg0.PublicMatch)
|
||||
assert(arg0.SoloMatch)
|
||||
assert(arg0.CustomMatch)
|
||||
local f5_local0 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.areWeGameHost")
|
||||
local f5_local1 = DataSources.frontEnd.lobby.memberCount
|
||||
local f5_local2 = function()
|
||||
return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost()
|
||||
end
|
||||
|
||||
local f5_local3 = function()
|
||||
local f7_local0 = f5_local2()
|
||||
arg0.PublicMatch:SetButtonDisabled(f7_local0)
|
||||
arg0.CustomMatch:SetButtonDisabled(f7_local0)
|
||||
end
|
||||
|
||||
arg0:SubscribeToModel(f5_local0:GetModel(arg1), f5_local3)
|
||||
arg0:SubscribeToModel(f5_local1:GetModel(arg1), f5_local3)
|
||||
arg0:SubscribeToModel(DataSources.frontEnd.lobby.isSolo:GetModel(arg1), function()
|
||||
local f8_local0 = DataSources.frontEnd.lobby.isSolo:GetValue(arg1)
|
||||
if f8_local0 ~= nil then
|
||||
arg0.SoloMatch:SetButtonDisabled(not f8_local0)
|
||||
end
|
||||
end)
|
||||
arg0.PublicMatch:addEventHandler("button_action", f0_local1)
|
||||
arg0.SoloMatch:addEventHandler("button_action", f0_local2)
|
||||
arg0.Loadout:addEventHandler("button_action", function(f9_arg0, f9_arg1)
|
||||
LUI.FlowManager.RequestAddMenu("CPLoadoutMenu", true, f9_arg1.controller)
|
||||
end)
|
||||
arg0.Barracks:addEventHandler("button_action", function(f10_arg0, f10_arg1)
|
||||
LUI.FlowManager.RequestAddMenu("Headquarters", true, f10_arg1.controller)
|
||||
end)
|
||||
arg0.Armory:addEventHandler("button_action", function(f11_arg0, f11_arg1)
|
||||
if not Engine.IsUserAGuest(f11_arg1.controller) then
|
||||
ACTIONS.OpenMenu("Armory", true, f11_arg1.controller)
|
||||
end
|
||||
end)
|
||||
arg0.CustomMatch:addEventHandler("button_action", f0_local3)
|
||||
arg0.ContractsButton:addEventHandler("button_action", function(f12_arg0, f12_arg1)
|
||||
ACTIONS.OpenMenu("ContractMenu", true, f12_arg1.controller or arg1)
|
||||
end)
|
||||
|
||||
arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1)
|
||||
LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false)
|
||||
end)
|
||||
end
|
||||
|
||||
function CPMainMenuButtons(menu, controller)
|
||||
local VNavigator = LUI.UIVerticalNavigator.new()
|
||||
VNavigator:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 400 * _1080p)
|
||||
VNavigator.id = "CPMainMenuButtons"
|
||||
local controllerIndex = controller and controller.controllerIndex
|
||||
if not controllerIndex and not Engine.InFrontend() then
|
||||
controllerIndex = VNavigator:getRootController()
|
||||
end
|
||||
assert(controllerIndex)
|
||||
|
||||
local ButtonDescription = nil
|
||||
|
||||
ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ButtonDescription.id = "ButtonDescription"
|
||||
ButtonDescription:SetRGBFromTable(SWATCHES.genericButton.textDisabled, 0)
|
||||
ButtonDescription.Description:SetRight(_1080p * 415, 0)
|
||||
ButtonDescription:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 336, _1080p * 394)
|
||||
VNavigator:addElement(ButtonDescription)
|
||||
VNavigator.ButtonDescription = ButtonDescription
|
||||
|
||||
local PublicMatch = nil
|
||||
|
||||
PublicMatch = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
PublicMatch.id = "PublicMatch"
|
||||
PublicMatch.buttonDescription = "Browse for Custom Servers"
|
||||
PublicMatch.Text:setText(ToUpperCase("Server Browser"), 0)
|
||||
PublicMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, 0, _1080p * 30)
|
||||
VNavigator:addElement(PublicMatch)
|
||||
VNavigator.PublicMatch = PublicMatch
|
||||
|
||||
local SoloMatch = nil
|
||||
|
||||
SoloMatch = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
SoloMatch.id = "SoloMatch"
|
||||
SoloMatch.buttonDescription = Engine.Localize("LUA_MENU_ZM_SOLO_MATCH_DESC")
|
||||
SoloMatch.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_SOLO_MATCH_CAPS")), 0)
|
||||
SoloMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 40, _1080p * 70)
|
||||
VNavigator:addElement(SoloMatch)
|
||||
VNavigator.SoloMatch = SoloMatch
|
||||
|
||||
local CustomMatch = nil
|
||||
|
||||
CustomMatch = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
CustomMatch.id = "CustomMatch"
|
||||
CustomMatch.buttonDescription = Engine.Localize("LUA_MENU_ZM_CUSTOM_MATCH_DESC")
|
||||
CustomMatch.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_CUSTOM_GAME_CAPS")), 0)
|
||||
CustomMatch:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 80, _1080p * 110)
|
||||
VNavigator:addElement(CustomMatch)
|
||||
VNavigator.CustomMatch = CustomMatch
|
||||
|
||||
local Loadout = nil
|
||||
|
||||
Loadout = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
Loadout.id = "Loadout"
|
||||
Loadout.buttonDescription = Engine.Localize("LUA_MENU_ZM_LOADOUT_DESC")
|
||||
Loadout.Text:setText(Engine.Localize("LUA_MENU_ZM_LOADOUT_CAPS"), 0)
|
||||
Loadout:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 120, _1080p * 150)
|
||||
VNavigator:addElement(Loadout)
|
||||
VNavigator.Loadout = Loadout
|
||||
|
||||
local Barracks = nil
|
||||
|
||||
Barracks = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
Barracks.id = "Barracks"
|
||||
Barracks.buttonDescription = Engine.Localize("LUA_MENU_ZM_BARRACKS_DESC")
|
||||
Barracks.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_BARRACKS_CAPS")), 0)
|
||||
Barracks:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 160, _1080p * 190)
|
||||
VNavigator:addElement(Barracks)
|
||||
VNavigator.Barracks = Barracks
|
||||
|
||||
local Armory = nil
|
||||
|
||||
Armory = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
Armory.id = "Armory"
|
||||
Armory.buttonDescription = Engine.Localize("LUA_MENU_ZM_SURVIVAL_DEPOT_DESC")
|
||||
Armory.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_ZM_SURVIVAL_DEPOT")), 0)
|
||||
Armory:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 200, _1080p * 230)
|
||||
VNavigator:addElement(Armory)
|
||||
VNavigator.Armory = Armory
|
||||
|
||||
local ModsButton = nil
|
||||
|
||||
ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ModsButton.id = "ModsButton"
|
||||
ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC")
|
||||
ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0)
|
||||
ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 240, _1080p * 270)
|
||||
VNavigator:addElement(ModsButton)
|
||||
VNavigator.ModsButton = ModsButton
|
||||
|
||||
local ContractsButton = nil
|
||||
|
||||
ContractsButton = MenuBuilder.BuildRegisteredType("ContractsButtonCP", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ContractsButton.id = "ContractsButton"
|
||||
ContractsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 340, _1080p * 280, _1080p * 340)
|
||||
VNavigator:addElement(ContractsButton)
|
||||
VNavigator.ContractsButton = ContractsButton
|
||||
|
||||
f0_local4(VNavigator, controllerIndex, controller)
|
||||
return VNavigator
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["CPMainMenuButtons"] = CPMainMenuButtons
|
@ -1,189 +0,0 @@
|
||||
local f0_local0 = function ( f1_arg0 )
|
||||
if Engine.HasCompletedAnyLevel( f1_arg0 ) then
|
||||
return true
|
||||
end
|
||||
local f1_local0 = {}
|
||||
for f1_local1 = 0, Engine.TableGetRowCount( CSV.levels.file ) - 1, 1 do
|
||||
local f1_local4 = CSV.ReadRow( CSV.levels, f1_local1 )
|
||||
local f1_local5 = f1_local4.name
|
||||
if not Engine.GetDvarBool( "lui_checkIfLevelInFileSystem" ) or Engine.IsLevelInFileSystem and Engine.IsLevelInFileSystem( f1_local5 ) then
|
||||
f1_local0[#f1_local0 + 1] = {
|
||||
buttonLabel = f1_local4.string,
|
||||
levelName = f1_local5,
|
||||
objectiveText = f1_local4.desc,
|
||||
levelNumber = f1_local4.ref,
|
||||
completedLevelIndex = f1_local4.completedRef,
|
||||
image = f1_local4.image
|
||||
}
|
||||
end
|
||||
end
|
||||
local f1_local1 = LUI.DataSourceFromPlayerData.new( CoD.ProgressionBlob.Gold, CoD.PlayMode.SP )
|
||||
local f1_local2 = f1_local1.spData
|
||||
for f1_local3 = 1, #f1_local0, 1 do
|
||||
local f1_local7 = f1_local0[f1_local3].levelName
|
||||
if f1_local7 ~= "europa" then
|
||||
local f1_local8 = ""
|
||||
if f1_local2.missionStateData[f1_local7] ~= nil then
|
||||
f1_local8 = f1_local2.missionStateData[f1_local7]:GetValue( f1_arg0 )
|
||||
end
|
||||
if f1_local8 ~= nil and (f1_local8 == "complete" or f1_local8 == "incomplete") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local f0_local1 = function(arg0)
|
||||
arg0.ResumeButton:SetButtonDisabled(not Engine.CanResumeGame(arg0._controllerIndex))
|
||||
if not CONDITIONS.IsTrialLicense(arg0) then
|
||||
local f2_local0 = arg0.MissionSelectButton
|
||||
local f2_local1 = f2_local0
|
||||
f2_local0 = f2_local0.SetButtonDisabled
|
||||
local f2_local2 = Engine.IsTrialLicense()
|
||||
if not f2_local2 then
|
||||
if not Engine.IsDevelopmentBuild() and not Engine.GetDvarBool("mis_cheat") then
|
||||
f2_local2 = not f0_local0(arg0._controllerIndex)
|
||||
else
|
||||
f2_local2 = false
|
||||
end
|
||||
end
|
||||
f2_local0(f2_local1, f2_local2)
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local3 = function(arg0, arg1)
|
||||
LUI.FlowManager.RequestPopupMenu(nil, "FakeLoadingScreenOverlay", true, 0, false, {
|
||||
onLoadCompleteFunc = function()
|
||||
Engine.Exec("set ui_play_credits 1; map shipcrib_epilogue")
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
local f0_local4 = function(arg0, arg1, arg2)
|
||||
assert(arg0.ResumeButton)
|
||||
assert(arg0.NewButton)
|
||||
assert(arg0.CreditsButton)
|
||||
if not CONDITIONS.IsTrialLicense(arg0) then
|
||||
assert(arg0.MissionSelectButton)
|
||||
end
|
||||
arg0._controllerIndex = arg1
|
||||
arg0.ResumeButton:addEventHandler("button_action", function(f9_arg0, f9_arg1)
|
||||
Engine.SetDvarString("start", "")
|
||||
LUI.FlowManager.RequestPopupMenu(f9_arg0, "ResumeGamePopup", false, f9_arg1.controller, false)
|
||||
end)
|
||||
arg0.NewButton:addEventHandler("button_action", function(f10_arg0, f10_arg1)
|
||||
Engine.SetDvarString("start", "")
|
||||
if Engine.CanResumeGame(arg1) then
|
||||
LUI.FlowManager.RequestPopupMenu(arg0, "overwrite_warning_menu", true, f10_arg1.controller)
|
||||
else
|
||||
LUI.FlowManager.RequestPopupMenu(arg0, "popmenu_autosave_warning", true, f10_arg1.controller)
|
||||
end
|
||||
end)
|
||||
if not CONDITIONS.IsTrialLicense(arg0) then
|
||||
arg0.MissionSelectButton:addEventHandler("button_action", function(f11_arg0, f11_arg1)
|
||||
Engine.SetDvarString("start", "")
|
||||
LUI.FlowManager.RequestAddMenu("LevelSelectMenu", true, f11_arg1.controller, false)
|
||||
end)
|
||||
end
|
||||
arg0.CreditsButton:addEventHandler("button_action", f0_local3)
|
||||
f0_local1(arg0)
|
||||
arg0:addEventHandler("update_save_game_available_complete", f0_local1)
|
||||
if Engine.GetDvarFloat("r_filmGrainAtten") == 0.25 then
|
||||
Engine.SetDvarFloat("r_filmGrainAtten", 1)
|
||||
Engine.ExecNow("profile_setFilmGrain " .. tostring(1), arg1)
|
||||
end
|
||||
|
||||
arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1)
|
||||
LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false)
|
||||
end)
|
||||
end
|
||||
|
||||
function CampaignMenuButtons(menu, controller)
|
||||
local self = LUI.UIVerticalList.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 440 * _1080p)
|
||||
self.id = "CampaignMenuButtons"
|
||||
local controllerIndex = controller and controller.controllerIndex
|
||||
if not controllerIndex and not Engine.InFrontend() then
|
||||
controllerIndex = self:getRootController()
|
||||
end
|
||||
assert(controllerIndex)
|
||||
self:SetSpacing(10 * _1080p)
|
||||
|
||||
local ResumeButton = nil
|
||||
|
||||
ResumeButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ResumeButton.id = "ResumeButton"
|
||||
ResumeButton.buttonDescription = Engine.Localize("LUA_MENU_RESUME_GAME_DESC")
|
||||
ResumeButton.Text:setText(Engine.Localize("MENU_RESUMEGAME_CAPS"), 0)
|
||||
ResumeButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30)
|
||||
self:addElement(ResumeButton)
|
||||
self.ResumeButton = ResumeButton
|
||||
|
||||
local NewButton = nil
|
||||
|
||||
NewButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
NewButton.id = "NewButton"
|
||||
NewButton.buttonDescription = Engine.Localize("LUA_MENU_NEW_GAME_DESC")
|
||||
NewButton.Text:setText(Engine.Localize("MENU_NEWGAME_CAPS"), 0)
|
||||
NewButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70)
|
||||
self:addElement(NewButton)
|
||||
self.NewButton = NewButton
|
||||
|
||||
local MissionSelectButton = nil
|
||||
if not CONDITIONS.IsTrialLicense(self) then
|
||||
MissionSelectButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
MissionSelectButton.id = "MissionSelectButton"
|
||||
if not CONDITIONS.IsTrialLicense(self) then
|
||||
MissionSelectButton.buttonDescription = Engine.Localize("LUA_MENU_MISSION_SELECT_DESC")
|
||||
end
|
||||
MissionSelectButton.Text:setText(Engine.Localize("MENU_MISSION_SELECT_CAPS"), 0)
|
||||
MissionSelectButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110)
|
||||
self:addElement(MissionSelectButton)
|
||||
self.MissionSelectButton = MissionSelectButton
|
||||
end
|
||||
local CreditsButton = nil
|
||||
|
||||
CreditsButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
CreditsButton.id = "CreditsButton"
|
||||
CreditsButton.buttonDescription = Engine.Localize("LUA_MENU_CREDITS_DESC")
|
||||
CreditsButton.Text:setText(ToUpperCase(Engine.Localize("MENU_SP_CREDITS_CAPS")), 0)
|
||||
CreditsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150)
|
||||
self:addElement(CreditsButton)
|
||||
self.CreditsButton = CreditsButton
|
||||
|
||||
local ModsButton = nil
|
||||
|
||||
ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ModsButton.id = "ModsButton"
|
||||
ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC")
|
||||
ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0)
|
||||
ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190)
|
||||
self:addElement(ModsButton)
|
||||
self.ModsButton = ModsButton
|
||||
|
||||
local ButtonDescription = nil
|
||||
|
||||
ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ButtonDescription.id = "ButtonDescription"
|
||||
ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 200, _1080p * 300)
|
||||
self:addElement(ButtonDescription)
|
||||
self.ButtonDescription = ButtonDescription
|
||||
|
||||
f0_local4(self, controllerIndex, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["CampaignMenuButtons"] = CampaignMenuButtons
|
@ -1,450 +0,0 @@
|
||||
LUI.FlowManager.RegisterFenceGroup("MPMainMenu", {
|
||||
"mp",
|
||||
"mpInstall",
|
||||
"onlineServices",
|
||||
"onlineData",
|
||||
"patch",
|
||||
"exchange",
|
||||
"playlists",
|
||||
"dailyReward"
|
||||
})
|
||||
|
||||
LUI.FlowManager.RequestSetStack("MPMainMenu", {
|
||||
{ name = "MainLockoutMenu" },
|
||||
{ name = "MainMenu" }
|
||||
})
|
||||
|
||||
local HandleSplitscreenRefresh = function ()
|
||||
if Engine.SplitscreenPlayerCount() > 0 then
|
||||
local activeController = Engine.GetFirstActiveController()
|
||||
if activeController and Engine.IsUserSignedIn(activeController) then
|
||||
Engine.PLMRefreshData()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local HandleBackButton = function(f2_arg0, f2_arg1)
|
||||
local f2_local0 = Engine.HasActiveLocalClient( f2_arg1.controller )
|
||||
if f2_local0 then
|
||||
f2_local0 = not Engine.IsActiveLocalClientPrimary( f2_arg1.controller )
|
||||
end
|
||||
if f2_local0 then
|
||||
local f2_local1 = LUI.FlowManager.GetScopedData( f2_arg0 )
|
||||
if f2_local1 and f2_local1.focusedPage and f2_local1.focusedPage > 2 then
|
||||
f2_arg0:dispatchEventToRoot( {
|
||||
name = "lobby_slide_left",
|
||||
immediate = true
|
||||
} )
|
||||
end
|
||||
elseif Lobby.IsNotAloneInPrivateParty() then
|
||||
if Engine.IsXB3() then
|
||||
LUI.FlowManager.RequestPopupMenu( f2_arg0, "RateLimitedLeaveCommonMPMainMenuPopup", true, f2_arg1.controller, false, {
|
||||
menu = f2_arg0,
|
||||
rateLimitIntervalMS = 5000,
|
||||
rateLimitAttempts = 3
|
||||
} )
|
||||
else
|
||||
LUI.FlowManager.RequestPopupMenu( f2_arg0, "LeaveCommonMPMainMenuPopup", true, f2_arg1.controller, false, {
|
||||
menu = f2_arg0
|
||||
} )
|
||||
end
|
||||
else
|
||||
Lobby.LeaveCommonMPMainMenu( f2_arg0, f2_arg1.controller )
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local InitializeMainMenu = function(arg0, arg1)
|
||||
local activeController = Engine.GetFirstActiveController()
|
||||
if Engine.GetDvarBool("xblive_competitionmatch") then
|
||||
Engine.SetDvarBool("xblive_competitionmatch", false)
|
||||
Engine.Exec("set remove_mlg_rules 1")
|
||||
end
|
||||
Engine.ExecNow(MPConfig.default_xboxlive, activeController)
|
||||
end
|
||||
|
||||
local UpdatePlayerData = function(arg0)
|
||||
local postShipFlag = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.Ranked, "postShipFlags", 3)
|
||||
if postShipFlag == nil or postShipFlag == false then
|
||||
local archetypePreferences = {
|
||||
{ "head", 1, "head_160", "head_287" },
|
||||
{ "head", 3, "head_167", "head_294" },
|
||||
{ "body", 1, "body_90", "body_217" },
|
||||
{ "body", 3, "body_97", "body_224" }
|
||||
}
|
||||
|
||||
for _, pref in ipairs(archetypePreferences) do
|
||||
local currentValue = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "archetypePreferences", pref[2], pref[1])
|
||||
if currentValue ~= nil and currentValue == pref[3] then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "archetypePreferences", pref[2], pref[1], pref[4])
|
||||
end
|
||||
end
|
||||
|
||||
local headData = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "head")
|
||||
local bodyData = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "body")
|
||||
|
||||
if headData ~= nil and (headData == 160 or headData == 167) then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "head", headData == 160 and 287 or 294)
|
||||
end
|
||||
if bodyData ~= nil and (bodyData == 90 or bodyData == 97) then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "body", bodyData == 90 and 217 or 224)
|
||||
end
|
||||
|
||||
-- Same operation for private loadouts
|
||||
for _, pref in ipairs(archetypePreferences) do
|
||||
local currentValue = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "archetypePreferences", pref[2], pref[1])
|
||||
if currentValue ~= nil and currentValue == pref[3] then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "archetypePreferences", pref[2], pref[1], pref[4])
|
||||
end
|
||||
end
|
||||
|
||||
local privateHeadData = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "head")
|
||||
local privateBodyData = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "body")
|
||||
|
||||
if privateHeadData ~= nil and (privateHeadData == 160 or privateHeadData == 167) then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "head", privateHeadData == 160 and 287 or 294)
|
||||
end
|
||||
if privateBodyData ~= nil and (privateBodyData == 90 or privateBodyData == 97) then
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.PrivateLoadouts, "squadMembers", "body", privateBodyData == 90 and 217 or 224)
|
||||
end
|
||||
|
||||
local characterHead = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "head")
|
||||
local characterBody = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "body")
|
||||
local characterSuper = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "archetypeSuper")
|
||||
local characterArchetype = Engine.GetPlayerDataEx(arg0, CoD.StatsGroup.RankedLoadouts, "squadMembers", "archetype")
|
||||
|
||||
if characterHead ~= nil and characterBody ~= nil then
|
||||
FrontEndScene.SetCharacterModelsByIndex(FrontEndScene.ClientCharacters.Self, characterBody, characterHead)
|
||||
end
|
||||
|
||||
if characterSuper ~= nil and characterArchetype ~= nil then
|
||||
FrontEndScene.SetWeaponForSuper(FrontEndScene.ClientCharacters.Self, characterSuper, characterArchetype)
|
||||
FrontEndScene.PlayIdleForSuper(FrontEndScene.ClientCharacters.Self, characterSuper, characterArchetype)
|
||||
end
|
||||
|
||||
Engine.SetPlayerDataEx(arg0, CoD.StatsGroup.Ranked, "postShipFlags", 3, true)
|
||||
Engine.ExecNow("uploadstats", arg0)
|
||||
end
|
||||
end
|
||||
|
||||
local LoadMainMenu = function(controller)
|
||||
UpdatePlayerData(controller)
|
||||
end
|
||||
|
||||
-- Function to set up the main menu for multiplayer
|
||||
local SetupMainMenu = function(menu, controller)
|
||||
-- Disable UI version display and online requirement
|
||||
Engine.SetDvarString("ui_version_show", "0")
|
||||
Engine.SetDvarBool("ui_onlineRequired", false)
|
||||
|
||||
-- Set up front end scene
|
||||
FrontEndScene.CurrentMissionTeam = MissionDirector.InvalidTeamID
|
||||
FrontEndScene.SetScene("mp_main")
|
||||
|
||||
-- Get controller index
|
||||
local controllerIndex = controller and controller.controller or Engine.GetFirstActiveController()
|
||||
|
||||
-- Check title update requirement
|
||||
CheckTURequirement(menu, controllerIndex)
|
||||
|
||||
-- Set up player character based on loadout data
|
||||
local loadoutData = DataSources.alwaysLoaded.playerData.MP.rankedloadouts.squadMembers
|
||||
local rigAnim = Cac.GetRigFrontEndProfileAnim(loadoutData.archetype:GetValue(controllerIndex))
|
||||
FrontEndScene.SetCharacterModelsByIndex(
|
||||
FrontEndScene.ClientCharacters.Profile,
|
||||
loadoutData.body:GetValue(controllerIndex),
|
||||
loadoutData.head:GetValue(controllerIndex)
|
||||
)
|
||||
ClientCharacter.SetCharacterWeapons(FrontEndScene.ClientCharacters.Profile, nil)
|
||||
ClientCharacter.PlayCharacterAnim(FrontEndScene.ClientCharacters.Profile, rigAnim)
|
||||
ClientCharacter.SetCharacterVisible(FrontEndScene.ClientCharacters.Profile, true)
|
||||
|
||||
-- Set up weapon visibility
|
||||
ClientWeapon.SetWeaponIsViewModel(0, true)
|
||||
ClientWeapon.SetWeaponVisible(0, false)
|
||||
|
||||
-- Initialize main menu
|
||||
InitializeMainMenu(menu, controller)
|
||||
|
||||
-- Sync unlocks if enabled
|
||||
if Engine.GetDvarBool("enable_unlock_sync") then
|
||||
local unlockTypes = {}
|
||||
for _, unlockType in pairs(AAR.UnlockTypes) do
|
||||
table.insert(unlockTypes, unlockType)
|
||||
end
|
||||
Rewards.SyncUnlocks(controllerIndex, unlockTypes, #unlockTypes)
|
||||
end
|
||||
|
||||
-- Start private party if not already in one
|
||||
if not Lobby.IsInPrivateParty() then
|
||||
Engine.ExecNow("xstartprivateparty", controllerIndex)
|
||||
end
|
||||
|
||||
-- Handle events related to party and CRM (Customer Relationship Management)
|
||||
menu:registerEventHandler("not_below_blocking_fence", function()
|
||||
Engine.SetDvarBool("cg_mlg_gamebattles_match", false)
|
||||
if not MLG.IsGameBattleMatch() then
|
||||
Lobby.WakePrivateParty(controllerIndex)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Set up party UI and CRM
|
||||
Lobby.SetPartyUIRoot(PartyUIRoot.MAIN_MENU)
|
||||
menu.nextLocation = CRM.locations.MP_MOTD
|
||||
CRM.OpenNextCRMWindow(menu)
|
||||
menu:addEventHandler("gain_focus", CRM.OpenNextCRMWindow)
|
||||
menu:addEventHandler("restore_focus", CRM.OpenNextCRMWindow)
|
||||
end
|
||||
|
||||
-- Post-load function to handle game battles and other settings
|
||||
local PostLoadFunc = function(menu, controllerIndex, controller)
|
||||
if GAMEBATTLES.ScheduleRefreshRequest then
|
||||
GAMEBATTLES.ScheduleRefreshRequest = false
|
||||
OpenGameBattlesLobby(controllerIndex)
|
||||
else
|
||||
local currentMatch = GAMEBATTLES.GetCurrentMatch(controllerIndex)
|
||||
if currentMatch then
|
||||
if GAMEBATTLES.MatchForfeitWinningTeamIndex ~= 0 then
|
||||
GAMEBATTLES.ShowMatchForfeitPopup(controllerIndex, currentMatch, GAMEBATTLES.MatchForfeitWinningTeamIndex)
|
||||
GAMEBATTLES.MatchForfeitWinningTeamIndex = 0
|
||||
else
|
||||
local victoryInfo, progressInfo = GAMEBATTLES.GetMatchProgressInfo(currentMatch)
|
||||
if progressInfo then
|
||||
local alliesWins, axisWins, matchVictory = GAMEBATTLES.GetMatchVictoryInfo(currentMatch)
|
||||
if not matchVictory then
|
||||
LUI.FlowManager.RequestPopupMenu(menu, "MLGGamebattlesMatchResultsPopup", false, controllerIndex, false, {
|
||||
controllerIndex = controllerIndex,
|
||||
gbMatch = currentMatch,
|
||||
alliesWins = alliesWins,
|
||||
axisWins = axisWins
|
||||
})
|
||||
end
|
||||
else
|
||||
local dsAcquisitionState = MLG.GetGameBattleDSAcquisitionState(controllerIndex)
|
||||
if dsAcquisitionState == GAMEBATTLES.MLG_DS_ACQUISITION_STATE.COULD_NOT_ACQUIRE or dsAcquisitionState == GAMEBATTLES.MLG_DS_ACQUISITION_STATE.ACQUISITION_ERROR then
|
||||
MLG.ResetGameBattleDSAcquisitionState()
|
||||
LUI.FlowManager.RequestPopupMenu(menu, "MLGGamebattlesMatchCancelledPopup", false, controllerIndex, false, {
|
||||
matchID = currentMatch.matchId
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
MLG.ResetGameBattleMatchId(controllerIndex)
|
||||
end
|
||||
end
|
||||
|
||||
-- Additional setup and event handling
|
||||
assert(menu.bindButton)
|
||||
menu.isSignInMenu = true
|
||||
menu.bindButton:addEventHandler("button_secondary", HandleBackButton)
|
||||
menu:addEventHandler("menu_create", SetupMainMenu)
|
||||
|
||||
-- Adjust UI elements based on various conditions
|
||||
local adjustButtonDescription = function()
|
||||
local _, top, _, bottom = menu.ButtonDescription:getLocalRect()
|
||||
local buttonSpacing = menu.MPMainMenuButtons.buttonSpacing
|
||||
menu.ButtonDescription:SetTop(top - buttonSpacing)
|
||||
menu.ButtonDescription:SetBottom(bottom - buttonSpacing)
|
||||
end
|
||||
|
||||
if not CONDITIONS.IsGameBattlesAllowed() then
|
||||
adjustButtonDescription()
|
||||
end
|
||||
|
||||
if not CODTV.IsCODTVEnabled() then
|
||||
adjustButtonDescription()
|
||||
end
|
||||
|
||||
if not CONDITIONS.IsStoreAllowed(menu) then
|
||||
adjustButtonDescription()
|
||||
end
|
||||
|
||||
if Engine.GetDvarFloat("r_filmGrainAtten") == 1 then
|
||||
Engine.SetDvarFloat("r_filmGrainAtten", 0.25)
|
||||
Engine.ExecNow("profile_setFilmGrain " .. tostring(0.25), controllerIndex)
|
||||
end
|
||||
|
||||
-- Handle NAT type warning
|
||||
local natType = Lobby.GetNATType()
|
||||
if natType then
|
||||
if natType == "NETWORK_STRICT" and not Engine.GetDvarBool("strict_nat_warning_viewed") then
|
||||
LUI.FlowManager.RequestPopupMenu(menu, "strict_nat_warning", true, controllerIndex, false, data)
|
||||
Engine.SetDvarBool("strict_nat_warning_viewed", true)
|
||||
end
|
||||
menu:processEvent({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "nat",
|
||||
helper_text = Engine.Localize("NETWORK_YOURNATTYPE", natType),
|
||||
side = "right",
|
||||
clickable = false
|
||||
})
|
||||
end
|
||||
|
||||
Engine.SetDvarInt("lui_mc_numGamesFinishedInLobby", 0)
|
||||
MissionDirector.PlayTeamMusic()
|
||||
Engine.StopMenuVideo()
|
||||
|
||||
-- Handle trial license popup
|
||||
local scopedData = LUI.FlowManager.GetScopedData(menu)
|
||||
if CONDITIONS.IsTrialLicense() and not scopedData.trialPopupShown then
|
||||
scopedData.trialPopupShown = true
|
||||
LUI.FlowManager.RequestPopupMenu(menu, "TrialFullWindow", true, controllerIndex, false)
|
||||
end
|
||||
|
||||
menu:addElement(Lobby.GetMPMapMaterialStreamer())
|
||||
LoadMainMenu(controllerIndex)
|
||||
end
|
||||
|
||||
function MPMainMenu(menu, controller)
|
||||
local self = LUI.UIHorizontalNavigator.new()
|
||||
self.id = "MPMainMenu"
|
||||
|
||||
-- Determine controller index
|
||||
local controllerIndex = controller and controller.controllerIndex
|
||||
if not controllerIndex and not Engine.InFrontend() then
|
||||
controllerIndex = self:getRootController()
|
||||
end
|
||||
assert(controllerIndex)
|
||||
|
||||
-- Initialize the main menu
|
||||
InitializeMainMenu(self, controllerIndex, controller)
|
||||
self:playSound("menu_open")
|
||||
|
||||
-- Helper bar
|
||||
local HelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
HelperBar.id = "HelperBar"
|
||||
HelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0)
|
||||
self:addElement(HelperBar)
|
||||
self.HelperBar = HelperBar
|
||||
|
||||
-- Button description
|
||||
local ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ButtonDescription.id = "ButtonDescription"
|
||||
ButtonDescription.Description:SetRight(_1080p * 415, 0)
|
||||
ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 645, _1080p * 594, _1080p * 694)
|
||||
self:addElement(ButtonDescription)
|
||||
self.ButtonDescription = ButtonDescription
|
||||
|
||||
-- Social feed
|
||||
local SocialFeed = MenuBuilder.BuildRegisteredType("SocialFeed", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
SocialFeed.id = "SocialFeed"
|
||||
SocialFeed:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 1920, _1080p * 965, _1080p * 995)
|
||||
self:addElement(SocialFeed)
|
||||
self.SocialFeed = SocialFeed
|
||||
|
||||
-- Main menu buttons
|
||||
local MPMainMenuButtons = MenuBuilder.BuildRegisteredType("MPMainMenuButtons", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
MPMainMenuButtons.id = "MPMainMenuButtons"
|
||||
MPMainMenuButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 360, _1080p * 564)
|
||||
self:addElement(MPMainMenuButtons)
|
||||
self.MPMainMenuButtons = MPMainMenuButtons
|
||||
|
||||
-- Friends widget
|
||||
local FriendsElement = MenuBuilder.BuildRegisteredType("online_friends_widget", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
FriendsElement.id = "FriendsElement"
|
||||
FriendsElement:SetFont(FONTS.GetFont(FONTS.Dev.File))
|
||||
FriendsElement:SetAlignment(LUI.Alignment.Left)
|
||||
FriendsElement:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 1420, _1080p * 1920, _1080p * 1026, _1080p * 1071)
|
||||
self:addElement(FriendsElement)
|
||||
self.FriendsElement = FriendsElement
|
||||
|
||||
-- Lobby members list
|
||||
local LobbyMembers = MenuBuilder.BuildRegisteredType("LobbyMembers", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
LobbyMembers.id = "LobbyMembers"
|
||||
LobbyMembers:SetAnchorsAndPosition(1, 0, 0, 1, _1080p * -700, 0, _1080p * 273, _1080p * 917)
|
||||
self:addElement(LobbyMembers)
|
||||
self.LobbyMembers = LobbyMembers
|
||||
|
||||
-- COD logo
|
||||
local CODLogo = LUI.UIImage.new()
|
||||
CODLogo.id = "CODLogo"
|
||||
CODLogo:setImage(RegisterMaterial("cod_logo"), 0)
|
||||
CODLogo:SetAnchorsAndPosition(0, 0, 0, 0, _1080p * 108, _1080p * -1272, _1080p * 120, _1080p * -825)
|
||||
self:addElement(CODLogo)
|
||||
self.CODLogo = CODLogo
|
||||
|
||||
-- Menu title
|
||||
local MenuTitle = LUI.UIStyledText.new()
|
||||
MenuTitle.id = "MenuTitle"
|
||||
MenuTitle:setText(ToUpperCase(Engine.Localize("MENU_MULTIPLAYER")), 0)
|
||||
MenuTitle:SetFontSize(50 * _1080p)
|
||||
MenuTitle:SetFont(FONTS.GetFont(FONTS.MainMedium.File))
|
||||
MenuTitle:SetAlignment(LUI.Alignment.Left)
|
||||
MenuTitle:SetStartupDelay(1250)
|
||||
MenuTitle:SetLineHoldTime(400)
|
||||
MenuTitle:SetAnimMoveTime(300)
|
||||
MenuTitle:SetEndDelay(1000)
|
||||
MenuTitle:SetCrossfadeTime(500)
|
||||
MenuTitle:SetAutoScrollStyle(LUI.UIStyledText.AutoScrollStyle.ScrollH)
|
||||
MenuTitle:SetMaxVisibleLines(1)
|
||||
MenuTitle:SetDecodeLetterLength(25)
|
||||
MenuTitle:SetDecodeMaxRandChars(3)
|
||||
MenuTitle:SetDecodeUpdatesPerLetter(4)
|
||||
MenuTitle:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 660, _1080p * 296.5, _1080p * 346.5)
|
||||
self:addElement(MenuTitle)
|
||||
self.MenuTitle = MenuTitle
|
||||
|
||||
-- Double XP notifications
|
||||
local DoubleXPNotifications = MenuBuilder.BuildRegisteredType("DoubleXPNotifications", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
DoubleXPNotifications.id = "DoubleXPNotifications"
|
||||
DoubleXPNotifications:SetScale(-0.5, 0)
|
||||
DoubleXPNotifications:SetAnchorsAndPosition(0.5, 0.5, 0, 1, _1080p * -370, _1080p * -114, _1080p * 104, _1080p * 232)
|
||||
self:addElement(DoubleXPNotifications)
|
||||
self.DoubleXPNotifications = DoubleXPNotifications
|
||||
|
||||
-- Button helper function
|
||||
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("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)
|
||||
|
||||
-- Bind button handler
|
||||
local bindButton = LUI.UIBindButton.new()
|
||||
bindButton.id = "selfBindButton"
|
||||
self:addElement(bindButton)
|
||||
self.bindButton = bindButton
|
||||
|
||||
self.bindButton:addEventHandler("button_start", function(arg0, arg1)
|
||||
ACTIONS.OpenMenu("OptionsMenu", true, arg1.controller or controllerIndex)
|
||||
end)
|
||||
|
||||
PostLoadFunc(self, controllerIndex, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["MPMainMenu"] = MPMainMenu
|
||||
LUI.FlowManager.RegisterStackPushBehaviour( "MPMainMenu", PushFunc )
|
@ -1,208 +0,0 @@
|
||||
local buttonSpacing = 40
|
||||
local f0_local1 = 10
|
||||
local f0_local2 = function(f1_arg0, f1_arg1, f1_arg2)
|
||||
if 0 < f1_arg2 then
|
||||
local f1_local0, f1_local1, f1_local2, f1_local3 = f1_arg0:getLocalRect()
|
||||
local f1_local4 = f1_local3 - f1_local1
|
||||
f1_arg0:SetTop(f1_local1 - (f1_local4 + f1_arg1) * f1_arg2)
|
||||
f1_arg0:SetBottom(f1_local3 - (f1_local4 + f1_arg1) * f1_arg2)
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local3 = function(f2_arg0, f2_arg1, f2_arg2)
|
||||
assert(f2_arg0.ConquestButton)
|
||||
if CONDITIONS.IsStoreAllowed(f2_arg0) then
|
||||
assert(f2_arg0.StoreButton)
|
||||
end
|
||||
local f2_local0 = not CONDITIONS.IsTrialLicense(f2_arg0)
|
||||
if f2_local0 then
|
||||
assert(f2_arg0.CustomGameButton)
|
||||
end
|
||||
f2_arg0.buttonSpacing = _1080p * buttonSpacing
|
||||
local f2_local1 = function()
|
||||
return Lobby.IsInPrivateParty() and not Lobby.IsPrivatePartyHost()
|
||||
end
|
||||
|
||||
local f2_local2 = function()
|
||||
local f4_local0 = f2_local1()
|
||||
f2_arg0.ConquestButton:SetButtonDisabled(f4_local0)
|
||||
if f2_arg0.MLGGameBattlesButton ~= nil then
|
||||
f2_arg0.MLGGameBattlesButton:SetButtonDisabled(f4_local0)
|
||||
end
|
||||
if f2_local0 then
|
||||
f2_arg0.CustomGameButton:SetButtonDisabled(f4_local0)
|
||||
end
|
||||
end
|
||||
|
||||
local f2_local3 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.areWeGameHost")
|
||||
local f2_local4 = DataSources.frontEnd.lobby.memberCount
|
||||
f2_arg0:SubscribeToModel(f2_local3:GetModel(f2_arg1), f2_local2)
|
||||
f2_arg0:SubscribeToModel(f2_local4:GetModel(f2_arg1), f2_local2)
|
||||
f2_arg0.ConquestButton:addEventHandler("button_action", function(f5_arg0, f5_arg1)
|
||||
Engine.SetDvarBool("cg_mlg_gamebattles_match", false)
|
||||
local f5_local0 = function()
|
||||
LUI.FlowManager.RequestAddMenu("Missions", false, f5_arg1.controller, false, {}, true)
|
||||
end
|
||||
|
||||
if not Onboarding:BeginFlow(Onboarding.RigTutorial, f2_arg1) then
|
||||
f5_local0()
|
||||
else
|
||||
LUI.FlowManager.RequestPopupMenu(nil, "MPFullScreenVideoOverlay", true, f2_arg1, nil, {
|
||||
videoRef = "mp_wolverines_mission_commander",
|
||||
allowSkip = true,
|
||||
doIntroFadeOut = false,
|
||||
doIntroFadeIn = false,
|
||||
doOutroFadeIn = true,
|
||||
doOutroFadeOut = true,
|
||||
fadeColor = COLORS.black
|
||||
}, nil, true, true)
|
||||
local f5_local1 = f2_arg0:Wait(500)
|
||||
f5_local1.onComplete = f5_local0
|
||||
end
|
||||
end)
|
||||
if CONDITIONS.IsGameBattlesAllowed(f2_arg0) then
|
||||
f2_arg0.MLGGameBattlesButton:addEventHandler("button_action", function(f7_arg0, f7_arg1)
|
||||
if Engine.GetDvarBool("splitscreen") then
|
||||
LUI.FlowManager.RequestPopupMenu(f2_arg0, "MLGGamebattlesSplitscreenPopup", true, f7_arg1.controller,
|
||||
false, {
|
||||
controllerIndex = f2_arg1
|
||||
})
|
||||
elseif Lobby.IsNotAloneInPrivateParty() then
|
||||
LUI.FlowManager.RequestPopupMenu(f2_arg0, "DisbandPartyEnterGameBattlesLobbyPopup", true,
|
||||
f7_arg1.controller, false, {
|
||||
controllerIndex = f2_arg1
|
||||
})
|
||||
else
|
||||
OpenGameBattlesLobby(f7_arg1.controller)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if f2_local0 then
|
||||
f2_arg0.CustomGameButton:addEventHandler("button_action", function(f8_arg0, f8_arg1)
|
||||
OpenPrivateMatchLobby(f8_arg1)
|
||||
end)
|
||||
end
|
||||
|
||||
f2_arg0.ModsButton:addEventHandler("button_action", function(arg0, arg1)
|
||||
LUI.FlowManager.RequestAddMenu("ModSelectMenu", true, arg1.controller, false)
|
||||
end)
|
||||
|
||||
if CONDITIONS.IsStoreAllowed(f2_arg0) then
|
||||
f2_arg0.StoreButton:addEventHandler("button_action", function(f9_arg0, f9_arg1)
|
||||
local f9_local0 = STORE.GoToStore
|
||||
local f9_local1 = f9_arg1.controller
|
||||
local f9_local2 = f9_arg0:GetCurrentMenu()
|
||||
f9_local0(f9_local1, f9_local2.id, f9_arg0.id)
|
||||
end)
|
||||
end
|
||||
local f2_local5 = _1080p * f0_local1
|
||||
local f2_local6 = 0
|
||||
if f2_arg0.MLGGameBattlesButton == nil then
|
||||
f2_local6 = 1
|
||||
end
|
||||
if f2_arg0.CustomGameButton then
|
||||
f0_local2(f2_arg0.CustomGameButton, f2_local5, f2_local6)
|
||||
else
|
||||
f2_local6 = f2_local6 + 1
|
||||
end
|
||||
if f2_arg0.ModsButton then
|
||||
f0_local2(f2_arg0.ModsButton, f2_local5, f2_local6)
|
||||
else
|
||||
f2_local6 = f2_local6 + 1
|
||||
end
|
||||
if CONDITIONS.IsStoreAllowed(f2_arg0) then
|
||||
f0_local2(f2_arg0.StoreButton, f2_local5, f2_local6)
|
||||
else
|
||||
f2_local6 = f2_local6 + 1
|
||||
end
|
||||
if f2_arg0.StoreButton then
|
||||
f2_arg0.StoreButton:SetButtonDescription(STORE.GetStoreDescription())
|
||||
if CONDITIONS.IsTrialLicense() then
|
||||
f2_arg0.StoreButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_BUY_NOW")))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MPMainMenuButtons(menu, controller)
|
||||
local self = LUI.UIVerticalNavigator.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 190 * _1080p)
|
||||
self.id = "MPMainMenuButtons"
|
||||
local controllerIndex = controller and controller.controllerIndex
|
||||
if not controllerIndex and not Engine.InFrontend() then
|
||||
controllerIndex = self:getRootController()
|
||||
end
|
||||
assert(controllerIndex)
|
||||
local ConquestButton = nil
|
||||
|
||||
ConquestButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ConquestButton.id = "ConquestButton"
|
||||
ConquestButton.buttonDescription = Engine.Localize("LUA_MENU_PUBLIC_MATCH_DESC")
|
||||
ConquestButton.Text:setText(Engine.Localize("LUA_MENU_PUBLIC_MATCH_CAPS"), 0)
|
||||
ConquestButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, 0, _1080p * 30)
|
||||
self:addElement(ConquestButton)
|
||||
self.ConquestButton = ConquestButton
|
||||
|
||||
local MLGGameBattlesButton = nil
|
||||
if CONDITIONS.IsGameBattlesAllowed(self) then
|
||||
MLGGameBattlesButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
MLGGameBattlesButton.id = "MLGGameBattlesButton"
|
||||
if CONDITIONS.IsGameBattlesAllowed(self) then
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
if CONDITIONS.IsGameBattlesAllowed(self) then
|
||||
MLGGameBattlesButton.buttonDescription = Engine.Localize("LUA_MENU_MLG_GAMEBATTLES_DESC")
|
||||
end
|
||||
MLGGameBattlesButton.Text:setText(Engine.Localize("LUA_MENU_MLG_GAMEBATTLES_CAPS"), 0)
|
||||
MLGGameBattlesButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70)
|
||||
self:addElement(MLGGameBattlesButton)
|
||||
self.MLGGameBattlesButton = MLGGameBattlesButton
|
||||
end
|
||||
|
||||
local CustomGameButton = nil
|
||||
|
||||
CustomGameButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
CustomGameButton.id = "CustomGameButton"
|
||||
CustomGameButton.buttonDescription = Engine.Localize("LUA_MENU_CUSTOM_GAME_DESC")
|
||||
CustomGameButton.Text:setText(Engine.Localize("LUA_MENU_CUSTOM_GAME_CAPS"), 0)
|
||||
CustomGameButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 80, _1080p * 110)
|
||||
self:addElement(CustomGameButton)
|
||||
self.CustomGameButton = CustomGameButton
|
||||
|
||||
local ModsButton = nil
|
||||
|
||||
ModsButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ModsButton.id = "ModsButton"
|
||||
ModsButton.buttonDescription = Engine.Localize("LUA_MENU_MODS_DESC")
|
||||
ModsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MODS_CAPS")), 0)
|
||||
ModsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 120, _1080p * 150)
|
||||
self:addElement(ModsButton)
|
||||
self.ModsButton = ModsButton
|
||||
|
||||
local StoreButton = nil
|
||||
if CONDITIONS.IsStoreAllowed(self) then
|
||||
StoreButton = MenuBuilder.BuildRegisteredType("MenuButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
StoreButton.id = "StoreButton"
|
||||
StoreButton.buttonDescription = Engine.Localize("LUA_MENU_STORE_DESC")
|
||||
StoreButton.Text:setText(Engine.Localize("LUA_MENU_STORE_CAPS"), 0)
|
||||
StoreButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 160, _1080p * 190)
|
||||
self:addElement(StoreButton)
|
||||
self.StoreButton = StoreButton
|
||||
end
|
||||
|
||||
f0_local3(self, controllerIndex, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["MPMainMenuButtons"] = MPMainMenuButtons
|
51
data/cdata/ui_scripts/MainMenu/MissionButtons.lua
Normal file
51
data/cdata/ui_scripts/MainMenu/MissionButtons.lua
Normal file
@ -0,0 +1,51 @@
|
||||
function MissionsButtons(menu, controller)
|
||||
local self = LUI.UIVerticalNavigator.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 380 * _1080p)
|
||||
self.id = "MissionsButtons"
|
||||
local f1_local1 = controller and controller.controllerIndex
|
||||
if not f1_local1 and not Engine.InFrontend() then
|
||||
f1_local1 = self:getRootController()
|
||||
end
|
||||
assert(f1_local1)
|
||||
local MissionsVerticalLayout = MenuBuilder.BuildRegisteredType("MissionsVerticalLayout", {
|
||||
controllerIndex = f1_local1,
|
||||
})
|
||||
MissionsVerticalLayout.id = "MissionsVerticalLayout"
|
||||
MissionsVerticalLayout:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, 0, _1080p * 340)
|
||||
self:addElement(MissionsVerticalLayout)
|
||||
self.MissionsVerticalLayout = MissionsVerticalLayout
|
||||
|
||||
local FindMatchButton = MissionsVerticalLayout:getChildById("MissionSelect")
|
||||
FindMatchButton.Text:setText(ToUpperCase(Engine.Localize("Combat Training")), 0)
|
||||
FindMatchButton.buttonDescription = Engine.Localize("Rank up against bots.")
|
||||
|
||||
local ServerBrowserButton = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = f6_local1,
|
||||
})
|
||||
ServerBrowserButton.id = "ServerBrowserButton"
|
||||
ServerBrowserButton.Text:setText(ToUpperCase(Engine.Localize("Server Browser")), 0)
|
||||
ServerBrowserButton.buttonDescription = Engine.Localize("Browse a list of dedicated servers.")
|
||||
ServerBrowserButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70)
|
||||
LUI.UIElement.addElementBefore(ServerBrowserButton, MissionsVerticalLayout:getChildById("MissionSelect"))
|
||||
MissionsVerticalLayout.ServerBrowserButton = ServerBrowserButton
|
||||
ServerBrowserButton:addEventHandler("button_action", function(f14_arg0, f14_arg1)
|
||||
LUI.FlowManager.RequestAddMenu("SystemLinkMenu", true, f14_arg1.controller, false, {})
|
||||
end)
|
||||
|
||||
local CRMMain = MenuBuilder.BuildRegisteredType("CRMMain", {
|
||||
controllerIndex = f1_local1,
|
||||
})
|
||||
CRMMain.id = "CRMMain"
|
||||
CRMMain:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 6, _1080p * 317, _1080p * 530, _1080p * 854)
|
||||
self:addElement(CRMMain)
|
||||
self.CRMMain = CRMMain
|
||||
|
||||
ACTIONS.AnimateSequenceByElement(self, {
|
||||
elementName = "CRMMain",
|
||||
sequenceName = "Opening",
|
||||
elementPath = "CRMMain",
|
||||
})
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["MissionsButtons"] = MissionsButtons
|
@ -1,160 +0,0 @@
|
||||
local f0_local0 = function(arg0, arg1, arg2)
|
||||
assert(arg0.CreateAClassButton)
|
||||
assert(arg0.MissionSelect)
|
||||
local f1_local0 = LUI.DataSourceInGlobalModel.new("frontEnd.lobby.findMatchButtonWaitStatus")
|
||||
arg0:SubscribeToModel(f1_local0:GetModel(arg1), function()
|
||||
local f2_local0 = f1_local0:GetValue(arg1)
|
||||
local f2_local1 = "Browse for Custom Servers"
|
||||
if f2_local0 == "" then
|
||||
arg0.MissionSelect:SetButtonDisabled(false)
|
||||
else
|
||||
arg0.MissionSelect:SetButtonDisabled(true)
|
||||
f2_local1 = f2_local0
|
||||
end
|
||||
arg0.MissionSelect.buttonDescription = f2_local1
|
||||
arg0.ButtonDescription:processEvent({
|
||||
name = "update_button_description",
|
||||
text = f2_local1
|
||||
})
|
||||
end)
|
||||
if not Onboarding.RigTutorial:WasCompleted(arg1) then
|
||||
arg0.CreateAClassButton.listDefaultFocus = 0
|
||||
end
|
||||
if not CONDITIONS.IsQuarterMasterAllowed(arg0) then
|
||||
arg0.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150)
|
||||
arg0.ButtonDescription:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190)
|
||||
end
|
||||
end
|
||||
|
||||
function MissionsVerticalLayout(menu, controller)
|
||||
local self = LUI.UIVerticalList.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 500 * _1080p, 0, 330 * _1080p)
|
||||
self.id = "MissionsVerticalLayout"
|
||||
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:SetSpacing(10 * _1080p)
|
||||
local MissionSelect = nil
|
||||
|
||||
MissionSelect = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
MissionSelect.id = "MissionSelect"
|
||||
MissionSelect.buttonDescription = "Browse for Custom Servers"
|
||||
MissionSelect.Text:setText(ToUpperCase("Server Browser"), 0)
|
||||
MissionSelect:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, 0, _1080p * 30)
|
||||
self:addElement(MissionSelect)
|
||||
self.MissionSelect = MissionSelect
|
||||
|
||||
local MissionTeams = nil
|
||||
|
||||
MissionTeams = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
MissionTeams.id = "MissionTeams"
|
||||
MissionTeams.buttonDescription = Engine.Localize("LUA_MENU_DESC_MISSION_TEAMS")
|
||||
MissionTeams.Text:setText(ToUpperCase(Engine.Localize("MENU_MISSION_TEAMS")), 0)
|
||||
MissionTeams:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 40, _1080p * 70)
|
||||
self:addElement(MissionTeams)
|
||||
self.MissionTeams = MissionTeams
|
||||
|
||||
local CreateAClassButton = nil
|
||||
|
||||
CreateAClassButton = MenuBuilder.BuildRegisteredType("CreateAClassButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
CreateAClassButton.id = "CreateAClassButton"
|
||||
CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 80, _1080p * 110)
|
||||
self:addElement(CreateAClassButton)
|
||||
self.CreateAClassButton = CreateAClassButton
|
||||
|
||||
local f3_local6 = nil
|
||||
if CONDITIONS.IsQuarterMasterAllowed(self) then
|
||||
f3_local6 = MenuBuilder.BuildRegisteredType("QuartermasterButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
f3_local6.id = "Armory"
|
||||
f3_local6:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 120, _1080p * 150)
|
||||
self:addElement(f3_local6)
|
||||
self.Armory = f3_local6
|
||||
end
|
||||
local Barracks = nil
|
||||
|
||||
Barracks = MenuBuilder.BuildRegisteredType("BarracksButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
Barracks.id = "Barracks"
|
||||
Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, _1080p * -4, _1080p * 160, _1080p * 190)
|
||||
self:addElement(Barracks)
|
||||
self.Barracks = Barracks
|
||||
|
||||
local f3_local8 = nil
|
||||
if CONDITIONS.AreContractsEnabled(self) then
|
||||
f3_local8 = MenuBuilder.BuildRegisteredType("ContractsButton", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
f3_local8.id = "Contracts"
|
||||
f3_local8:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 200, _1080p * 260)
|
||||
self:addElement(f3_local8)
|
||||
self.Contracts = f3_local8
|
||||
end
|
||||
local ButtonDescription = nil
|
||||
|
||||
ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = controllerIndex
|
||||
})
|
||||
ButtonDescription.id = "ButtonDescription"
|
||||
ButtonDescription.Description:SetRight(_1080p * 415, 0)
|
||||
ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 270, _1080p * 370)
|
||||
self:addElement(ButtonDescription)
|
||||
self.ButtonDescription = ButtonDescription
|
||||
|
||||
self._animationSets.DefaultAnimationSet = function()
|
||||
self._sequences.DefaultSequence = function()
|
||||
|
||||
end
|
||||
|
||||
CreateAClassButton:RegisterAnimationSequence("ContractsKillswitched", {{function()
|
||||
return self.CreateAClassButton:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 80, _1080p * 110, 0)
|
||||
end}})
|
||||
if CONDITIONS.IsQuarterMasterAllowed(self) then
|
||||
f3_local6:RegisterAnimationSequence("ContractsKillswitched", {{function()
|
||||
return self.Armory:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 120, _1080p * 150, 0)
|
||||
end}})
|
||||
end
|
||||
Barracks:RegisterAnimationSequence("ContractsKillswitched", {{function()
|
||||
return self.Barracks:SetAnchorsAndPosition(0, 0, 0, 1, 0, 0, _1080p * 160, _1080p * 190, 0)
|
||||
end}})
|
||||
ButtonDescription:RegisterAnimationSequence("ContractsKillswitched", {{function()
|
||||
return self.ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 504, _1080p * 201, _1080p * 301,
|
||||
0)
|
||||
end}})
|
||||
self._sequences.ContractsKillswitched = function()
|
||||
CreateAClassButton:AnimateSequence("ContractsKillswitched")
|
||||
if CONDITIONS.IsQuarterMasterAllowed(self) then
|
||||
f3_local6:AnimateSequence("ContractsKillswitched")
|
||||
end
|
||||
Barracks:AnimateSequence("ContractsKillswitched")
|
||||
ButtonDescription:AnimateSequence("ContractsKillswitched")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self._animationSets.DefaultAnimationSet()
|
||||
MissionSelect:addEventHandler("button_action", function(f11_arg0, f11_arg1)
|
||||
local f11_local0 = f11_arg1.controller or controllerIndex
|
||||
ACTIONS.OpenMenu("SystemLinkMenu", true, f11_local0)
|
||||
end)
|
||||
MissionTeams:addEventHandler("button_action", function(f12_arg0, f12_arg1)
|
||||
ACTIONS.OpenMenu("MissionTeamSelect", true, f12_arg1.controller or controllerIndex)
|
||||
end)
|
||||
f0_local0(self, controllerIndex, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["MissionsVerticalLayout"] = MissionsVerticalLayout
|
@ -1,10 +1,7 @@
|
||||
if not Engine.InFrontend() then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
require("CampaignMenuButtons")
|
||||
require("CPMainMenuButtons")
|
||||
require("CPMainMenu")
|
||||
require("MissionsVerticalLayout")
|
||||
require("MPMainMenuButtons")
|
||||
require("MPMainMenu")
|
||||
require("CPMPMainMenuButtons")
|
||||
require("MissionButtons")
|
||||
|
Reference in New Issue
Block a user