Merge branch 'develop' of https://github.com/auroramod/iw7-mod
This commit is contained in:
commit
90e007e0be
81
data/cdata/custom_scripts/mp/bots.gsc
Normal file
81
data/cdata/custom_scripts/mp/bots.gsc
Normal file
@ -0,0 +1,81 @@
|
||||
#include scripts\mp\bots\bots;
|
||||
#include scripts\mp\bots\bots_util;
|
||||
|
||||
main()
|
||||
{
|
||||
initdvars();
|
||||
replacefunc(scripts\mp\bots\bots::init, ::init_stub);
|
||||
replacefunc(scripts\mp\bots\bots_util::bot_get_client_limit, ::bot_get_client_limit);
|
||||
}
|
||||
|
||||
initdvars()
|
||||
{
|
||||
}
|
||||
|
||||
gethostplayer()
|
||||
{
|
||||
var_0 = getentarray( "player", "classname" );
|
||||
|
||||
for ( var_1 = 0; var_1 < var_0.size; var_1++ )
|
||||
{
|
||||
if ( var_0[var_1] ishost() )
|
||||
return var_0[var_1];
|
||||
}
|
||||
}
|
||||
|
||||
get_host()
|
||||
{
|
||||
host = gethostplayer();
|
||||
|
||||
while (!isdefined(host))
|
||||
{
|
||||
wait(0.25);
|
||||
host = gethostplayer();
|
||||
}
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
wait_for_host()
|
||||
{
|
||||
host = get_host();
|
||||
|
||||
while ( isdefined( host ) && !host.hasspawned && !isdefined( host.selectedclass ) )
|
||||
{
|
||||
wait(0.25);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
init_stub()
|
||||
{
|
||||
thread monitor_smoke_grenades();
|
||||
thread bot_triggers();
|
||||
initbotlevelvariables();
|
||||
|
||||
refresh_existing_bots();
|
||||
wait_for_host();
|
||||
|
||||
var_0 = botautoconnectenabled();
|
||||
setmatchdata( "hasBots", 1 );
|
||||
level thread bot_connect_monitor();
|
||||
}
|
||||
|
||||
bot_get_client_limit()
|
||||
{
|
||||
var_0 = getdvarint( "party_maxplayers", 0 );
|
||||
|
||||
maxclients = level.maxclients;
|
||||
|
||||
if ( var_0 != level.maxclients && var_0 >= 1 )
|
||||
{
|
||||
if ( var_0 > 18 )
|
||||
maxclients = 18;
|
||||
else
|
||||
maxclients = var_0;
|
||||
}
|
||||
|
||||
setdvar( "sv_maxclients", maxclients );
|
||||
return maxclients;
|
||||
}
|
5
data/cdata/start.cfg
Normal file
5
data/cdata/start.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
party_minplayers 1
|
||||
xblive_privatematch 1
|
||||
xpartygo
|
||||
xblive_privatematch 0
|
||||
wait 10
|
29
data/cdata/ui_scripts/Conditions/InFrontend.lua
Normal file
29
data/cdata/ui_scripts/Conditions/InFrontend.lua
Normal file
@ -0,0 +1,29 @@
|
||||
if not Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
-- GENERAL
|
||||
Engine.SetDvarBool("daily_login_bonus_enabled", false)
|
||||
|
||||
function CONDITIONS.IsStoreAllowed(self)
|
||||
return true
|
||||
end
|
||||
|
||||
function CODTV.IsCODTVEnabled()
|
||||
return false
|
||||
end
|
||||
|
||||
-- MP
|
||||
if CONDITIONS.InFrontendPublicMP then
|
||||
function CONDITIONS.IsServerBrowserAllowed(self)
|
||||
return true
|
||||
end
|
||||
|
||||
function CONDITIONS.IsGameBattlesAllowed(self)
|
||||
return CONDITIONS.IsServerBrowserAllowed(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- MP PRIVATE
|
||||
if CONDITIONS.InFrontend and Engine.IsCoreMode() and (IsPrivateMatch() or IsSystemLink()) then
|
||||
end
|
30
data/cdata/ui_scripts/Conditions/InGame.lua
Normal file
30
data/cdata/ui_scripts/Conditions/InGame.lua
Normal file
@ -0,0 +1,30 @@
|
||||
if Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
-- Multiplayer
|
||||
if CONDITIONS.IsMultiplayer then
|
||||
function CONDITIONS.IsTeamChoiceAllowed(self)
|
||||
return IsCurrentGameTypeteamBased()
|
||||
end
|
||||
|
||||
function CONDITIONS.IsCODCastingAllowed(self)
|
||||
return true
|
||||
end
|
||||
|
||||
function CONDITIONS.IsTeamOrCodcasterChoiceAllowed(self)
|
||||
return CONDITIONS.IsTeamChoiceAllowed(self) or CONDITIONS.IsCODCastingAllowed(self)
|
||||
end
|
||||
|
||||
function Lobby.IsTeamAssignmentEnabled()
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- ZOMBIES
|
||||
if CONDITIONS.IsThirdGameMode then
|
||||
end
|
||||
|
||||
-- Singleplayer
|
||||
if CONDITIONS.IsSingleplayer then
|
||||
end
|
11
data/cdata/ui_scripts/Conditions/__init__.lua
Normal file
11
data/cdata/ui_scripts/Conditions/__init__.lua
Normal file
@ -0,0 +1,11 @@
|
||||
if CONDITIONS.InFrontend then
|
||||
require("InFrontend")
|
||||
end
|
||||
|
||||
if CONDITIONS.InGame then
|
||||
require("InGame")
|
||||
end
|
||||
|
||||
function CheckTURequirement(f10_arg0, f10_arg1)
|
||||
return false
|
||||
end
|
237
data/cdata/ui_scripts/EndGame/__init__.lua
Normal file
237
data/cdata/ui_scripts/EndGame/__init__.lua
Normal file
@ -0,0 +1,237 @@
|
||||
if Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
local RequestLeaveMenu = function(f1_arg0, f1_arg1)
|
||||
LUI.FlowManager.RequestLeaveMenu(f1_arg0)
|
||||
end
|
||||
|
||||
local PopupMessage = function(f2_arg0, f2_arg1)
|
||||
f2_arg0:setText(f2_arg1.message_text)
|
||||
f2_arg0:dispatchEventToRoot({
|
||||
name = "resize_popup",
|
||||
})
|
||||
end
|
||||
|
||||
local Backout = function(f3_arg0)
|
||||
Engine.ExecFirstClient("xpartybackout")
|
||||
Engine.ExecFirstClient("disconnect")
|
||||
end
|
||||
|
||||
local DisbandAfterRound = function(f4_arg0)
|
||||
Engine.ExecFirstClient("xpartydisbandafterround")
|
||||
Engine.ExecFirstClient("disconnect")
|
||||
end
|
||||
|
||||
local OnlineGame = function(f5_arg0)
|
||||
return Engine.GetDvarBool("onlinegame")
|
||||
end
|
||||
|
||||
local Quit1 = function(f6_arg0)
|
||||
if OnlineGame(f6_arg0) then
|
||||
Engine.ExecFirstClient("xstopprivateparty")
|
||||
Engine.ExecFirstClient("disconnect")
|
||||
Engine.ExecFirstClient("xblive_privatematch 0")
|
||||
Engine.ExecFirstClient("onlinegame 1")
|
||||
Engine.ExecFirstClient("xstartprivateparty")
|
||||
else
|
||||
Engine.ExecFirstClient("disconnect")
|
||||
end
|
||||
end
|
||||
|
||||
local Quit2 = function(f7_arg0)
|
||||
Engine.ExecFirstClient("xstopprivateparty")
|
||||
Engine.ExecFirstClient("xpartydisbandafterround")
|
||||
if Engine.GetDvarBool("sv_running") then
|
||||
Engine.NotifyServer("end_game", 1)
|
||||
Engine.ExecFirstClient("xblive_privatematch 0")
|
||||
Engine.ExecFirstClient("onlinegame 1")
|
||||
Engine.ExecFirstClient("xstartprivateparty")
|
||||
else
|
||||
Quit1(f7_arg0)
|
||||
end
|
||||
end
|
||||
|
||||
local Quit3 = function(f7_arg0, f7_arg1)
|
||||
if Engine.GetDvarBool("sv_running") then
|
||||
if Engine.IsAliensMode() then
|
||||
Engine.Unpause()
|
||||
if Engine.IsAliensMode() and not IsSystemLink() then
|
||||
for f7_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
|
||||
if Engine.HasActiveLocalClient(f7_local0) then
|
||||
Loot.ConsumeAll(f7_local0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Engine.NotifyServer("end_game", 1)
|
||||
Engine.ExecNow("set endgame_called 1")
|
||||
else
|
||||
if Engine.IsAliensMode() and not IsSystemLink() then
|
||||
for f7_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
|
||||
if Engine.HasActiveLocalClient(f7_local0) then
|
||||
Loot.ConsumeAll(f7_local0)
|
||||
end
|
||||
end
|
||||
end
|
||||
Quit1(f7_arg0)
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus()
|
||||
end
|
||||
|
||||
local LeaveWithParty = function(f8_arg0, f8_arg1)
|
||||
LUI.FlowManager.RequestLeaveMenu(f8_arg0)
|
||||
Engine.Exec("onPlayerQuit")
|
||||
if Engine.GetDvarBool("sv_running") then
|
||||
DisbandAfterRound(f8_arg0)
|
||||
else
|
||||
Backout(f8_arg0)
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus()
|
||||
end
|
||||
|
||||
local LeaveSolo = function(f9_arg0, f9_arg1)
|
||||
LUI.FlowManager.RequestLeaveMenu(f9_arg0)
|
||||
Engine.Exec("onPlayerQuit")
|
||||
if Engine.GetDvarBool("sv_running") then
|
||||
Engine.NotifyServer("end_game", 2)
|
||||
Quit2(f9_arg0)
|
||||
else
|
||||
Quit1(f9_arg0)
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus()
|
||||
end
|
||||
|
||||
local IsPartyHost = function(f10_arg0)
|
||||
local f10_local0 = Lobby.IsInPrivateParty()
|
||||
if f10_local0 then
|
||||
f10_local0 = Lobby.IsPrivatePartyHost()
|
||||
if f10_local0 then
|
||||
f10_local0 = not Lobby.IsAloneInPrivateParty()
|
||||
end
|
||||
end
|
||||
return f10_local0
|
||||
end
|
||||
|
||||
local ManualQuit = function(f11_arg0, f11_arg1)
|
||||
Engine.ExecNow("uploadStats")
|
||||
if Engine.IsAliensMode() and not IsSystemLink() then
|
||||
for f11_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do
|
||||
if Engine.HasActiveLocalClient(f11_local0) then
|
||||
Loot.ConsumeAll(f11_local0)
|
||||
end
|
||||
end
|
||||
end
|
||||
if IsPartyHost(f11_arg0) then
|
||||
LUI.FlowManager.RequestLeaveMenu(f11_arg0, true)
|
||||
LUI.FlowManager.RequestPopupMenu(f11_arg0, "PullPartyPopup", false)
|
||||
else
|
||||
Engine.Exec("onPlayerQuit")
|
||||
if Engine.GetDvarBool("sv_running") then
|
||||
Quit2(f11_arg0)
|
||||
else
|
||||
Quit1(f11_arg0)
|
||||
end
|
||||
LUI.FlowManager.RequestCloseAllMenus()
|
||||
end
|
||||
end
|
||||
|
||||
local EndGamePopup = function()
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "end_game_id"
|
||||
self:registerAnimationState("default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -50,
|
||||
left = 0,
|
||||
bottom = 0,
|
||||
right = 0,
|
||||
alpha = 1,
|
||||
})
|
||||
self:animateToState("default", 0)
|
||||
local f12_local1 = Engine.Localize("@LUA_MENU_END_GAME_DESC")
|
||||
local f12_local2 = Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE")
|
||||
if Engine.IsAliensMode() and Game.GetOmnvar("zm_ui_is_solo") then
|
||||
f12_local1 = Engine.Localize("@CP_ZMB_LEAVE_GAME_DESC")
|
||||
f12_local2 = Engine.Localize("@MENU_NOTICE")
|
||||
end
|
||||
MenuBuilder.BuildAddChild(self, {
|
||||
type = "generic_yesno_popup",
|
||||
id = "privateGame_options_list_id",
|
||||
properties = {
|
||||
message_text_alignment = LUI.Alignment.Center,
|
||||
message_text = f12_local1,
|
||||
popup_title = f12_local2,
|
||||
padding_top = 12,
|
||||
yes_action = Quit3,
|
||||
},
|
||||
})
|
||||
local f12_local3 = LUI.UIBindButton.new()
|
||||
f12_local3.id = "endBackToGameStartButton"
|
||||
f12_local3:registerEventHandler("button_start", RequestLeaveMenu)
|
||||
self:addElement(f12_local3)
|
||||
return self
|
||||
end
|
||||
|
||||
local LeaveGamePopup = function()
|
||||
local self = LUI.UIElement.new()
|
||||
self.id = "leave_game_id"
|
||||
self:registerAnimationState("default", {
|
||||
topAnchor = true,
|
||||
leftAnchor = true,
|
||||
bottomAnchor = true,
|
||||
rightAnchor = true,
|
||||
top = -50,
|
||||
left = 0,
|
||||
bottom = 0,
|
||||
right = 0,
|
||||
alpha = 1,
|
||||
})
|
||||
self:animateToState("default", 0)
|
||||
MenuBuilder.BuildAddChild(self, {
|
||||
type = "generic_yesno_popup",
|
||||
id = "publicGame_options_list_id",
|
||||
properties = {
|
||||
message_text_alignment = LUI.Alignment.Center,
|
||||
message_text = Engine.IsAliensMode() and Engine.Localize("@CP_ZMB_LEAVE_GAME_DESC")
|
||||
or Engine.Localize("@LUA_MENU_LEAVE_GAME_DESC"),
|
||||
popup_title = Engine.IsAliensMode() and Engine.Localize("@MENU_NOTICE")
|
||||
or Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE"),
|
||||
padding_top = 12,
|
||||
yes_action = ManualQuit,
|
||||
},
|
||||
})
|
||||
local f13_local1 = LUI.UIBindButton.new()
|
||||
f13_local1.id = "leaveBackToGameStartButton"
|
||||
f13_local1:registerEventHandler("button_start", RequestLeaveMenu)
|
||||
self:addElement(f13_local1)
|
||||
return self
|
||||
end
|
||||
|
||||
local PullPartyPopup = function(f14_arg0, f14_arg1)
|
||||
local f14_local0 = MenuBuilder.BuildRegisteredType("PopupMessageAndButtons", {
|
||||
title = Engine.Localize("LUA_MENU_LEAVE_GAME_TITLE"),
|
||||
message = Engine.Localize("LUA_MENU_PULL_PARTY_DESC"),
|
||||
defaultFocusIndex = 2,
|
||||
cancelClosesPopup = true,
|
||||
buttonsClosePopup = true,
|
||||
buttons = {
|
||||
{
|
||||
label = Engine.Localize("LUA_MENU_YES"),
|
||||
action = LeaveWithParty,
|
||||
},
|
||||
{
|
||||
label = Engine.Localize("LUA_MENU_NO"),
|
||||
action = LeaveSolo,
|
||||
},
|
||||
},
|
||||
})
|
||||
f14_local0.id = "PullPartyPopup"
|
||||
return f14_local0
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["popup_end_game"] = EndGamePopup
|
||||
MenuBuilder.m_types["popup_leave_game"] = LeaveGamePopup
|
||||
MenuBuilder.m_types["PullPartyPopup"] = PullPartyPopup
|
370
data/cdata/ui_scripts/Lobby/GameSetupButtonsBots.lua
Normal file
370
data/cdata/ui_scripts/Lobby/GameSetupButtonsBots.lua
Normal file
@ -0,0 +1,370 @@
|
||||
local Bot = {}
|
||||
Bot.BotTeams = {
|
||||
Friendly = 0,
|
||||
Enemy = 1,
|
||||
FFA = 2,
|
||||
}
|
||||
Bot.BotLimit = 17
|
||||
Bot.BotDifficulties = {
|
||||
Recruit = 0,
|
||||
Regular = 1,
|
||||
Hardened = 2,
|
||||
Veteran = 3,
|
||||
Mixed = 4,
|
||||
}
|
||||
|
||||
Bot.GetMaxBotLimit = function()
|
||||
return 17
|
||||
end
|
||||
|
||||
Bot.GetBotsTeamLimit = function(team)
|
||||
local botcount = 0
|
||||
if team == Bot.BotTeams.Friendly then
|
||||
botcount = Engine.GetDvarInt("bot_allies")
|
||||
elseif team == Bot.BotTeams.Enemy then
|
||||
botcount = Engine.GetDvarInt("bot_enemies")
|
||||
else
|
||||
botcount = Engine.GetDvarInt("bot_free")
|
||||
end
|
||||
if tonumber(botcount) <= 0 then
|
||||
botcount = 0
|
||||
end
|
||||
return tonumber(botcount)
|
||||
end
|
||||
|
||||
Bot.SetBotsDifficulty = function(team, difficulty)
|
||||
if team == Bot.BotTeams.Friendly then
|
||||
Engine.Exec("set bot_difficulty_allies " .. tostring(difficulty))
|
||||
elseif team == Bot.BotTeams.Enemy then
|
||||
Engine.Exec("set bot_difficulty_enemies " .. tostring(difficulty))
|
||||
else
|
||||
Engine.Exec("set bot_difficulty_free " .. tostring(difficulty))
|
||||
end
|
||||
end
|
||||
|
||||
Bot.GetBotsDifficulty = function(team)
|
||||
local difficulty = 4
|
||||
if team == Bot.BotTeams.Friendly then
|
||||
difficulty = Engine.GetDvarInt("bot_difficulty_allies")
|
||||
elseif team == Bot.BotTeams.Enemy then
|
||||
difficulty = Engine.GetDvarInt("bot_difficulty_enemies")
|
||||
else
|
||||
difficulty = Engine.GetDvarInt("bot_difficulty_free")
|
||||
end
|
||||
if not difficulty then
|
||||
difficulty = 4
|
||||
end
|
||||
return tonumber(difficulty)
|
||||
end
|
||||
|
||||
Bot.SetBotsTeamLimit = function(team, size)
|
||||
Lobby.SetBotsTeamLimit(team, size)
|
||||
if team == Bot.BotTeams.Friendly then
|
||||
Engine.Exec("set bot_allies " .. tostring(size))
|
||||
elseif team == Bot.BotTeams.Enemy then
|
||||
Engine.Exec("set bot_enemies " .. tostring(size))
|
||||
else
|
||||
Engine.Exec("set bot_free " .. tostring(size))
|
||||
end
|
||||
end
|
||||
|
||||
local update_button = function(f1_arg0, f1_arg1, f1_arg2)
|
||||
f1_arg0.currentValue = f1_arg1
|
||||
f1_arg0:UpdateContent()
|
||||
if f1_arg0.autoFunctionCall then
|
||||
f1_arg0.action(f1_arg0.currentValue, f1_arg2)
|
||||
end
|
||||
end
|
||||
|
||||
local f0_local0 = function(f1_arg0, f1_arg1, f1_arg2)
|
||||
local f1_local0 = {
|
||||
[Bot.BotTeams.FFA] = f1_arg0.FFABots,
|
||||
[Bot.BotTeams.Enemy] = f1_arg0.EnemyBots,
|
||||
[Bot.BotTeams.Friendly] = f1_arg0.FriendlyBots,
|
||||
}
|
||||
local f1_local1 = function(team, teambased)
|
||||
local f2_local0 = {}
|
||||
local MaxBotLimit = Bot.GetMaxBotLimit()
|
||||
for f2_local2 = 0, MaxBotLimit, 1 do
|
||||
table.insert(f2_local0, tostring(f2_local2))
|
||||
end
|
||||
local f2_local2 = 1 + Bot.GetBotsTeamLimit(team)
|
||||
if #f2_local0 < f2_local2 then
|
||||
Bot.SetBotsTeamLimit(team, #f2_local0 - 1)
|
||||
f2_local2 = #f2_local0
|
||||
end
|
||||
if not teambased then
|
||||
local MaxBotLimit = Bot.GetMaxBotLimit()
|
||||
if MaxBotLimit < f2_local2 then
|
||||
f2_local2 = MaxBotLimit + 1
|
||||
end
|
||||
end
|
||||
return {
|
||||
labels = f2_local0,
|
||||
action = function(f3_arg0)
|
||||
Bot.SetBotsTeamLimit(team, f3_arg0 - 1)
|
||||
if teambased and (Bot.GetBotsTeamLimit(0) + Bot.GetBotsTeamLimit(1)) >= Bot.GetMaxBotLimit() then
|
||||
local adjustteam = 0
|
||||
local otherside = 1
|
||||
if team == Bot.BotTeams.Friendly then
|
||||
adjustteam = Bot.BotTeams.Enemy
|
||||
otherside = 0
|
||||
end
|
||||
if team == Bot.BotTeams.Enemy then
|
||||
adjustteam = Bot.BotTeams.Friendly
|
||||
otherside = 1
|
||||
end
|
||||
local adjustval = Bot.GetMaxBotLimit() - Bot.GetBotsTeamLimit(otherside)
|
||||
if adjustval <= 0 then
|
||||
adjustval = 1
|
||||
end
|
||||
f1_local0[adjustteam].currentValue = adjustval
|
||||
|
||||
f1_local0[adjustteam]:UpdateContent()
|
||||
Bot.SetBotsTeamLimit(adjustteam, adjustval - 1)
|
||||
end
|
||||
end,
|
||||
defaultValue = f2_local2,
|
||||
wrapAround = false,
|
||||
}
|
||||
end
|
||||
|
||||
local f1_local2 = function(f4_arg0)
|
||||
local f4_local0 = {}
|
||||
table.insert(f4_local0, Engine.Localize("LUA_MENU_BOTS_RECRUIT"))
|
||||
table.insert(f4_local0, Engine.Localize("LUA_MENU_BOTS_REGULAR"))
|
||||
table.insert(f4_local0, Engine.Localize("LUA_MENU_BOTS_HARDENED"))
|
||||
table.insert(f4_local0, Engine.Localize("LUA_MENU_BOTS_VETERAN"))
|
||||
table.insert(f4_local0, Engine.Localize("LUA_MENU_BOTS_MIXED"))
|
||||
return {
|
||||
labels = f4_local0,
|
||||
action = function(f5_arg0)
|
||||
Bot.SetBotsDifficulty(f4_arg0, f5_arg0 - 1)
|
||||
end,
|
||||
defaultValue = 1 + Bot.GetBotsDifficulty(f4_arg0),
|
||||
wrapAround = true,
|
||||
}
|
||||
end
|
||||
|
||||
if
|
||||
f1_arg0.FriendlyBots
|
||||
and f1_arg0.FriendlyBotsDifficulty
|
||||
and f1_arg0.EnemyBots
|
||||
and f1_arg0.EnemyBotsDifficulty
|
||||
then
|
||||
LUI.AddUIArrowTextButtonLogic(
|
||||
f1_arg0.FriendlyBots,
|
||||
f1_arg1,
|
||||
f1_local1(Bot.BotTeams.Friendly, Bot.BotTeams.Enemy)
|
||||
)
|
||||
LUI.AddUIArrowTextButtonLogic(f1_arg0.EnemyBots, f1_arg1, f1_local1(Bot.BotTeams.Enemy, Bot.BotTeams.Friendly))
|
||||
LUI.AddUIArrowTextButtonLogic(f1_arg0.FriendlyBotsDifficulty, f1_arg1, f1_local2(Bot.BotTeams.Friendly))
|
||||
LUI.AddUIArrowTextButtonLogic(f1_arg0.EnemyBotsDifficulty, f1_arg1, f1_local2(Bot.BotTeams.Enemy))
|
||||
end
|
||||
if f1_arg0.FFABots and f1_arg0.FFABotsDifficulty then
|
||||
LUI.AddUIArrowTextButtonLogic(f1_arg0.FFABots, f1_arg1, f1_local1(Bot.BotTeams.FFA))
|
||||
LUI.AddUIArrowTextButtonLogic(f1_arg0.FFABotsDifficulty, f1_arg1, f1_local2(Bot.BotTeams.FFA))
|
||||
end
|
||||
local f1_local3 = LUI.DataSourceInGlobalModel.new("frontEnd.Bot.areWeGameHost")
|
||||
f1_arg0:SubscribeToModel(f1_local3:GetModel(f1_arg1), function(f6_arg0)
|
||||
local f6_local0 = DataModel.GetModelValue(f6_arg0)
|
||||
local f6_local1 = IsSystemLink()
|
||||
if f1_arg0.FriendlyBots and f1_arg0.FriendlyBotsDifficulty then
|
||||
local f6_local2 = f1_arg0.FriendlyBots
|
||||
local f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
local f6_local4
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
f6_local2 = f1_arg0.FriendlyBotsDifficulty
|
||||
f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
end
|
||||
if f1_arg0.EnemyBots and f1_arg0.EnemyBotsDifficulty then
|
||||
local f6_local2 = f1_arg0.EnemyBots
|
||||
local f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
local f6_local4
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
f6_local2 = f1_arg0.EnemyBotsDifficulty
|
||||
f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
end
|
||||
if f1_arg0.FFABots and f1_arg0.FFABotsDifficulty then
|
||||
local f6_local2 = f1_arg0.FFABots
|
||||
local f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
local f6_local4
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
f6_local2 = f1_arg0.FFABotsDifficulty
|
||||
f6_local3 = f6_local2
|
||||
f6_local2 = f6_local2.SetButtonDisabled
|
||||
if not f6_local0 then
|
||||
f6_local4 = not f6_local1
|
||||
else
|
||||
f6_local4 = false
|
||||
end
|
||||
f6_local2(f6_local3, false)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local GameSetupButtonsBotsCombatTraining = function(menu, controller)
|
||||
local self = LUI.UIVerticalList.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 600 * _1080p, 0, 280 * _1080p)
|
||||
self.id = "GameSetupButtonsBotsCombatTraining"
|
||||
local f7_local1 = controller and controller.controllerIndex
|
||||
if not f7_local1 and not Engine.InFrontend() then
|
||||
f7_local1 = self:getRootController()
|
||||
end
|
||||
assert(f7_local1)
|
||||
self:SetSpacing(10 * _1080p)
|
||||
local f7_local3 = nil
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local3 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local3.id = "FriendlyBots"
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local3.buttonDescription = Engine.Localize("LUA_MENU_FRIENDLY_BOTS_DESC")
|
||||
end
|
||||
f7_local3.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_FRIENDLY_BOTS_CAPS")), 0)
|
||||
f7_local3.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local3:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, 0, _1080p * 30)
|
||||
self:addElement(f7_local3)
|
||||
self.FriendlyBots = f7_local3
|
||||
end
|
||||
local f7_local4 = nil
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local4 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local4.id = "FriendlyBotsDifficulty"
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local4.buttonDescription = Engine.Localize("LUA_MENU_FRIENDLY_BOTDIFFICULTY_DESC")
|
||||
end
|
||||
f7_local4.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_BOTDIFFICULTY_CAPS")), 0)
|
||||
f7_local4.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local4:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 40, _1080p * 70)
|
||||
self:addElement(f7_local4)
|
||||
self.FriendlyBotsDifficulty = f7_local4
|
||||
end
|
||||
local f7_local5 = nil
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local5 = LUI.UIImage.new()
|
||||
f7_local5.id = "SpacerImage"
|
||||
f7_local5:SetAlpha(0, 0)
|
||||
f7_local5:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 80, _1080p * 90)
|
||||
self:addElement(f7_local5)
|
||||
self.SpacerImage = f7_local5
|
||||
end
|
||||
local f7_local6 = nil
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local6 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local6.id = "EnemyBots"
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local6.buttonDescription = Engine.Localize("LUA_MENU_ENEMY_BOTS_DESC")
|
||||
end
|
||||
f7_local6.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_ENEMY_BOTS_CAPS")), 0)
|
||||
f7_local6.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local6:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 100, _1080p * 130)
|
||||
self:addElement(f7_local6)
|
||||
self.EnemyBots = f7_local6
|
||||
end
|
||||
local f7_local7 = nil
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local7 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local7.id = "EnemyBotsDifficulty"
|
||||
if CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local7.buttonDescription = Engine.Localize("LUA_MENU_ENEMY_BOTDIFFICULTY_DESC")
|
||||
end
|
||||
f7_local7.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_BOTDIFFICULTY_CAPS")), 0)
|
||||
f7_local7.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local7:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 140, _1080p * 170)
|
||||
self:addElement(f7_local7)
|
||||
self.EnemyBotsDifficulty = f7_local7
|
||||
end
|
||||
local f7_local8 = nil
|
||||
if not CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local8 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local8.id = "FFABots"
|
||||
if not CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local8.buttonDescription = Engine.Localize("LUA_MENU_BOTS_DESC")
|
||||
end
|
||||
f7_local8.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_BOTS_CAPS")), 0)
|
||||
f7_local8.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local8:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 180, _1080p * 210)
|
||||
self:addElement(f7_local8)
|
||||
self.FFABots = f7_local8
|
||||
end
|
||||
local f7_local9 = nil
|
||||
if not CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local9 = MenuBuilder.BuildRegisteredType("GenericArrowButton", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
f7_local9.id = "FFABotsDifficulty"
|
||||
if not CONDITIONS.IsTeamBasedGameType(self) then
|
||||
f7_local9.buttonDescription = Engine.Localize("LUA_MENU_BOTDIFFICULTY_DESC")
|
||||
end
|
||||
f7_local9.Title:setText(ToUpperCase(Engine.Localize("LUA_MENU_BOTDIFFICULTY_CAPS")), 0)
|
||||
f7_local9.Text:setText(ToUpperCase(""), 0)
|
||||
f7_local9:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 220, _1080p * 250)
|
||||
self:addElement(f7_local9)
|
||||
self.FFABotsDifficulty = f7_local9
|
||||
end
|
||||
local ButtonDescriptionText = nil
|
||||
|
||||
ButtonDescriptionText = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = f7_local1,
|
||||
})
|
||||
ButtonDescriptionText.id = "ButtonDescriptionText"
|
||||
ButtonDescriptionText:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 420, _1080p * 260, _1080p * 292)
|
||||
self:addElement(ButtonDescriptionText)
|
||||
self.ButtonDescriptionText = ButtonDescriptionText
|
||||
|
||||
f0_local0(self, f7_local1, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
local GameSetupButtonsBotsCustomGames = package.loaded["frontEnd.mp.GameSetupButtonsBots"].GameSetupButtonsBots
|
||||
GameSetupButtonsBotsOverride = function(menu, controller)
|
||||
if CONDITIONS.InFrontendPublicMP then
|
||||
return GameSetupButtonsBotsCombatTraining(menu, controller)
|
||||
else
|
||||
return GameSetupButtonsBotsCustomGames(menu, controller)
|
||||
end
|
||||
end
|
||||
|
||||
MenuBuilder.registerType("GameSetupButtonsBots", GameSetupButtonsBotsOverride)
|
187
data/cdata/ui_scripts/Lobby/GameSetupOptions.lua
Normal file
187
data/cdata/ui_scripts/Lobby/GameSetupOptions.lua
Normal file
@ -0,0 +1,187 @@
|
||||
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 postLoadGameSetupButtonsSubMenu = function(self, f2_arg1, f2_arg2)
|
||||
assert(self.MapsButton)
|
||||
assert(self.MapsButton.DynamicText)
|
||||
assert(self.OptionsButton)
|
||||
assert(self.OptionsButton.DynamicText)
|
||||
assert(self.BotSetup)
|
||||
|
||||
self.MapsButton.DynamicText:setText(ToUpperCase(Lobby.GetMapName()))
|
||||
self.OptionsButton:SetButtonDisabled(1) -- TODO: game settings are not applied and get rest on menu change.
|
||||
self.BotSetup:SetButtonDisabled(1) -- TODO: support custom bot management (gsc + engine changes required)
|
||||
end
|
||||
|
||||
local GameSetupButtonsSubMenu = function(menu, controller)
|
||||
local self = LUI.UIVerticalList.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 600 * _1080p, 0, 190 * _1080p)
|
||||
self.id = "GameSetupButtonsSubMenu"
|
||||
local rootController = controller and controller.controllerIndex
|
||||
if not rootController and not Engine.InFrontend() then
|
||||
rootController = self:getRootController()
|
||||
end
|
||||
assert(rootController)
|
||||
local f3_local2 = self
|
||||
self:SetSpacing(10 * _1080p)
|
||||
|
||||
local MapsButton = MenuBuilder.BuildRegisteredType("GenericDualLabelButton", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
MapsButton.id = "MapsButton"
|
||||
MapsButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_MAP")
|
||||
MapsButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_MAP_CAPS")), 0)
|
||||
MapsButton.DynamicText:setText("", 0)
|
||||
MapsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, 0, _1080p * 30)
|
||||
self:addElement(MapsButton)
|
||||
self.MapsButton = MapsButton
|
||||
|
||||
local OptionsButton = MenuBuilder.BuildRegisteredType("GenericDualLabelButton", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
OptionsButton.id = "OptionsButton"
|
||||
OptionsButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_OPTIONS")
|
||||
OptionsButton.Text:setText(ToUpperCase(Engine.Localize("MENU_CHANGE_GAME_RULES_CAPS")), 0)
|
||||
OptionsButton.DynamicText:setText("", 0)
|
||||
OptionsButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 80, _1080p * 110)
|
||||
self:addElement(OptionsButton)
|
||||
self.OptionsButton = OptionsButton
|
||||
|
||||
local BotSetup = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
BotSetup.id = "BotSetup"
|
||||
BotSetup.buttonDescription = Engine.Localize("LUA_MENU_DESC_BOTS")
|
||||
BotSetup.Text:setText(Engine.Localize("LUA_MENU_BOT_SETUP_CAPS"), 0)
|
||||
BotSetup:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 120, _1080p * 150)
|
||||
self:addElement(BotSetup)
|
||||
self.BotSetup = BotSetup
|
||||
|
||||
local ButtonDescription = MenuBuilder.BuildRegisteredType("ButtonDescriptionText", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
ButtonDescription.id = "ButtonDescription"
|
||||
ButtonDescription:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, _1080p * 160, _1080p * 200)
|
||||
self:addElement(ButtonDescription)
|
||||
self.ButtonDescription = ButtonDescription
|
||||
|
||||
MapsButton:addEventHandler("button_action", function(f4_arg0, f4_arg1)
|
||||
ACTIONS.OpenMenu("Maps", true, f4_arg1.controller or rootController)
|
||||
end)
|
||||
OptionsButton:addEventHandler("button_action", function(f6_arg0, f6_arg1)
|
||||
ACTIONS.OpenMenu("GameSetupOptionsMenu", true, f6_arg1.controller or rootController)
|
||||
end)
|
||||
BotSetup:addEventHandler("button_action", function(f7_arg0, f7_arg1)
|
||||
ACTIONS.OpenMenu("GameSetupBots", true, f7_arg1.controller or rootController)
|
||||
end)
|
||||
postLoadGameSetupButtonsSubMenu(self, rootController, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["GameSetupButtonsSubMenu"] = GameSetupButtonsSubMenu
|
||||
|
||||
local f0_local0 = function(f1_arg0, f1_arg1)
|
||||
f1_arg0.MenuTitle.MenuBreadcrumbs:setText(LocalizeString("COMBAT TRAINING"), 0)
|
||||
end
|
||||
|
||||
local CombatTrainingGameSetup = function(menu, controller)
|
||||
local self = LUI.UIVerticalNavigator.new()
|
||||
self.id = "CombatTrainingGameSetup"
|
||||
local rootController = controller and controller.controllerIndex
|
||||
if not rootController and not Engine.InFrontend() then
|
||||
rootController = self:getRootController()
|
||||
end
|
||||
assert(rootController)
|
||||
self:playSound("menu_open")
|
||||
local f2_local2 = self
|
||||
local ButtonHelperBar = nil
|
||||
|
||||
ButtonHelperBar = MenuBuilder.BuildRegisteredType("ButtonHelperBar", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
ButtonHelperBar.id = "ButtonHelperBar"
|
||||
ButtonHelperBar:SetAnchorsAndPosition(0, 0, 1, 0, 0, 0, _1080p * -85, 0)
|
||||
self:addElement(ButtonHelperBar)
|
||||
self.ButtonHelperBar = ButtonHelperBar
|
||||
|
||||
local MenuTitle = MenuBuilder.BuildRegisteredType("MenuTitle", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
MenuTitle.id = "MenuTitle"
|
||||
MenuTitle.MenuTitle:setText(ToUpperCase(Engine.Localize("LUA_MENU_GAME_SETUP_CAPS")), 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 GameSetupButtons = MenuBuilder.BuildRegisteredType("GameSetupButtonsSubMenu", {
|
||||
controllerIndex = rootController,
|
||||
})
|
||||
GameSetupButtons.id = "GameSetupButtonsSubMenu"
|
||||
GameSetupButtons:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 130, _1080p * 630, _1080p * 216, _1080p * 406)
|
||||
self:addElement(GameSetupButtons)
|
||||
self.GameSetupButtons = GameSetupButtons
|
||||
|
||||
self.addButtonHelperFunction = function(self, f3_arg1)
|
||||
self:AddButtonHelperText({
|
||||
helper_text = Engine.Localize("MENU_BACK"),
|
||||
button_ref = "button_secondary",
|
||||
side = "left",
|
||||
priority = 10,
|
||||
clickable = true,
|
||||
})
|
||||
self:AddButtonHelperText({
|
||||
helper_text = Engine.Localize("LUA_MENU_SELECT"),
|
||||
button_ref = "button_primary",
|
||||
side = "left",
|
||||
priority = -10,
|
||||
clickable = true,
|
||||
})
|
||||
end
|
||||
|
||||
self:addEventHandler("menu_create", self.addButtonHelperFunction)
|
||||
|
||||
local bindButton = LUI.UIBindButton.new()
|
||||
bindButton.id = "selfBindButton"
|
||||
self:addElement(bindButton)
|
||||
self.bindButton = bindButton
|
||||
|
||||
self.bindButton:addEventHandler("button_secondary", function(f4_arg0, f4_arg1)
|
||||
local f4_local0 = f4_arg1.controller or rootController
|
||||
ACTIONS.LeaveMenu(self)
|
||||
end)
|
||||
f0_local0(self, rootController, controller)
|
||||
return self
|
||||
end
|
||||
|
||||
-- don't do local play things in public lobby
|
||||
local SetupPrivateMatchLobbyScene_original = Lobby.SetupPrivateMatchLobbyScene
|
||||
local SetupPrivateMatchLobbyScene_stub = function(a1)
|
||||
if CONDITIONS.InFrontendPublicMP then
|
||||
LUI.FlowManager.RegisterStackPopBehaviour("Maps", function() end)
|
||||
LUI.FlowManager.RegisterStackPopBehaviour("GameSetupOptionsMenu", function() end)
|
||||
else
|
||||
SetupPrivateMatchLobbyScene_original(a1)
|
||||
end
|
||||
end
|
||||
Lobby.SetupPrivateMatchLobbyScene = SetupPrivateMatchLobbyScene_stub
|
||||
|
||||
MenuBuilder.registerType("CombatTrainingGameSetup", CombatTrainingGameSetup)
|
100
data/cdata/ui_scripts/Lobby/LobbyMissionButtons.lua
Normal file
100
data/cdata/ui_scripts/Lobby/LobbyMissionButtons.lua
Normal file
@ -0,0 +1,100 @@
|
||||
function CONDITIONS.IsMatchSimToolEnabled(self)
|
||||
return false
|
||||
end
|
||||
|
||||
local set_matchmaking_dvars = function()
|
||||
Engine.Exec("xstopprivateparty")
|
||||
Engine.Exec("online_matchmaking_dedi_required 0")
|
||||
Engine.Exec("online_matchmaking_disband_on_update_failure 1")
|
||||
Engine.Exec("online_matchmaking_no_dedi_search 1")
|
||||
Engine.Exec("online_matchmaking_use_pruning 0")
|
||||
Engine.Exec("online_matchmaking_start_when_dw_is_ready 1")
|
||||
Engine.Exec("online_matchmaking_turn_on_broken_beta 0")
|
||||
Engine.Exec("online_matchmaking_allow_lobby_merging 0")
|
||||
Engine.Exec("online_matchmaking_updatehostdocs_check 0")
|
||||
Engine.Exec("online_matchmaking_do_not_use_dlc_mming 1")
|
||||
Engine.Exec("online_acquire_ds_during_intermission 0")
|
||||
Engine.Exec("pt_maxSearchTier 0")
|
||||
Engine.Exec("pt_searchConnectAttempts 0")
|
||||
Engine.Exec("mming_minplayers_to_lobby 1")
|
||||
Engine.Exec("scr_default_maxagents 24")
|
||||
Engine.Exec("pt_migrateBeforeAdvertise 0")
|
||||
Engine.Exec("party_minplayers 3")
|
||||
end
|
||||
|
||||
local MatchSimulator = {}
|
||||
MatchSimulator.ShowGameOverScreen = function()
|
||||
Engine.Exec("party_minplayers 1")
|
||||
LUI.UIRoot.BlockButtonInput(Engine.GetLuiRoot(), false, "TransitionToGame")
|
||||
Engine.Exec("exec start") -- TODO: figure out how to start public match correctly. This is terrible.
|
||||
end
|
||||
|
||||
local LobbyMissionButtons = function(menu, controller)
|
||||
local self = LUI.UIVerticalNavigator.new()
|
||||
self:SetAnchorsAndPosition(0, 1, 0, 1, 0, 600 * _1080p, 0, 643 * _1080p)
|
||||
self.id = "LobbyMissionButtons"
|
||||
local f2_local1 = controller and controller.controllerIndex
|
||||
if not f2_local1 and not Engine.InFrontend() then
|
||||
f2_local1 = self:getRootController()
|
||||
end
|
||||
assert(f2_local1)
|
||||
|
||||
local LobbyMissionVerticalLayout = MenuBuilder.BuildRegisteredType("LobbyMissionVerticalLayout", {
|
||||
controllerIndex = f2_local1,
|
||||
})
|
||||
LobbyMissionVerticalLayout.id = "LobbyMissionVerticalLayout"
|
||||
LobbyMissionVerticalLayout:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 600, 0, _1080p * 564)
|
||||
self:addElement(LobbyMissionVerticalLayout)
|
||||
self.LobbyMissionVerticalLayout = LobbyMissionVerticalLayout
|
||||
|
||||
local StartButton = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = f6_local1,
|
||||
})
|
||||
StartButton.id = "StartButton"
|
||||
StartButton.Text:setText(ToUpperCase(Engine.Localize("MENU_START_MATCH")), 0)
|
||||
StartButton.buttonDescription = Engine.Localize("MENU_START_MATCH")
|
||||
StartButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70)
|
||||
LUI.UIElement.addElementBefore(StartButton, LobbyMissionVerticalLayout:getChildById("CAC"))
|
||||
LobbyMissionVerticalLayout.StartButton = StartButton
|
||||
StartButton:addEventHandler("button_action", function(f14_arg0, f14_arg1)
|
||||
LUI.UIRoot.BlockButtonInput(Engine.GetLuiRoot(), false, "TransitionToGame")
|
||||
Engine.Exec("party_minplayers 1")
|
||||
Engine.Exec("exec start")
|
||||
end)
|
||||
|
||||
local GameSetupButton = MenuBuilder.BuildRegisteredType("GenericButton", {
|
||||
controllerIndex = f6_local1,
|
||||
})
|
||||
GameSetupButton.id = "GameSetupButton"
|
||||
GameSetupButton.Text:setText(ToUpperCase(Engine.Localize("LUA_MENU_GAME_SETUP_CAPS")), 0)
|
||||
GameSetupButton.buttonDescription = Engine.Localize("LUA_MENU_DESC_GAME_SETUP")
|
||||
GameSetupButton:SetAnchorsAndPosition(0, 1, 0, 1, 0, _1080p * 500, _1080p * 40, _1080p * 70)
|
||||
LUI.UIElement.addElementBefore(GameSetupButton, LobbyMissionVerticalLayout:getChildById("CAC"))
|
||||
LobbyMissionVerticalLayout.GameSetupButton = GameSetupButton
|
||||
GameSetupButton:addEventHandler("button_action", function(f14_arg0, f14_arg1)
|
||||
LUI.FlowManager.RequestAddMenu("CombatTrainingGameSetup", true, f14_arg1.controller, false, {
|
||||
isSoloMode = false,
|
||||
})
|
||||
end)
|
||||
|
||||
set_matchmaking_dvars()
|
||||
|
||||
local CRMMain = MenuBuilder.BuildRegisteredType("CRMMain", {
|
||||
controllerIndex = f2_local1,
|
||||
})
|
||||
CRMMain.id = "CRMMain"
|
||||
CRMMain:SetAnchorsAndPosition(0, 1, 0, 1, _1080p * 6, _1080p * 317, _1080p * 529, _1080p * 723)
|
||||
self:addElement(CRMMain)
|
||||
self.CRMMain = CRMMain
|
||||
|
||||
if CONDITIONS.AreContractsEnabled(self) then
|
||||
ACTIONS.AnimateSequenceByElement(self, {
|
||||
elementName = "CRMMain",
|
||||
sequenceName = "Minimize",
|
||||
elementPath = "CRMMain",
|
||||
})
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
MenuBuilder.m_types["LobbyMissionButtons"] = LobbyMissionButtons
|
58
data/cdata/ui_scripts/Lobby/__init__.lua
Normal file
58
data/cdata/ui_scripts/Lobby/__init__.lua
Normal file
@ -0,0 +1,58 @@
|
||||
if Engine.GetDvarInt("bot_init") ~= 1 then
|
||||
Engine.Exec("set bot_init 1")
|
||||
Engine.Exec("set bot_allies 1")
|
||||
Engine.Exec("set bot_enemies 1")
|
||||
Engine.Exec("set bot_free 1")
|
||||
Engine.Exec("set bot_difficulty_allies 1")
|
||||
Engine.Exec("set bot_difficulty_enemies 1")
|
||||
Engine.Exec("set bot_difficulty_free 1")
|
||||
end
|
||||
|
||||
function GetMaxBotLimit()
|
||||
return 17
|
||||
end
|
||||
|
||||
if not Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
Lobby.ShouldDisplayMap = function(f37_arg0, f37_arg1)
|
||||
if not (Engine.IsAliensMode() == Lobby.GetMapSupportsAliensByIdx(f37_arg0)) then
|
||||
return false
|
||||
else
|
||||
local ID = Lobby.GetMapPackForMapIndex(f37_arg0)
|
||||
if ID == Lobby.DLC1_MAP_PACK_INDEX and Engine.GetDvarBool("killswitch_dlc1_maps") then
|
||||
return false
|
||||
elseif ID == Lobby.DLC2_MAP_PACK_INDEX and not Engine.GetDvarBool("dlc2_maps_enabled") then
|
||||
return false
|
||||
elseif ID == Lobby.DLC3_MAP_PACK_INDEX and not Engine.GetDvarBool("dlc3_maps_enabled") then
|
||||
return false
|
||||
elseif ID == Lobby.DLC4_MAP_PACK_INDEX and not Engine.GetDvarBool("dlc4_maps_enabled") then
|
||||
return false
|
||||
else
|
||||
local map = Lobby.GetMapLoadNameByIndex(f37_arg0)
|
||||
if Engine.GetDvarBool("lui_checkIfLevelInFileSystem") and not Engine.IsLevelInFileSystem(map) then
|
||||
return false
|
||||
elseif not Engine.IsMapPackOwned(ID) then
|
||||
return false
|
||||
elseif
|
||||
map == "mp_dome_dusk"
|
||||
or map == "mp_permafrost2"
|
||||
or map == "mp_carnage2"
|
||||
or map == "mp_renaissance2"
|
||||
then
|
||||
return true
|
||||
elseif map == "mp_skyway" then
|
||||
return true
|
||||
elseif map == "mp_turista2" and not Engine.GetDvarBool("mp_turista2_enabled") then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("LobbyMissionButtons")
|
||||
require("GameSetupOptions")
|
||||
require("GameSetupButtonsBots")
|
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,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
|
@ -2,9 +2,6 @@ if not Engine.InFrontend() then
|
||||
return
|
||||
end
|
||||
|
||||
require("CampaignMenuButtons")
|
||||
require("CPMainMenuButtons")
|
||||
require("CPMainMenu")
|
||||
require("MissionsVerticalLayout")
|
||||
require("MPMainMenuButtons")
|
||||
require("MPMainMenu")
|
||||
require("CPMPMainMenuButtons")
|
||||
require("MissionButtons")
|
||||
|
@ -427,6 +427,11 @@ namespace gsc
|
||||
{
|
||||
for (const auto& file : scripting::script_function_table_sort)
|
||||
{
|
||||
if (file.first.find("/asm/") != std::string::npos)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto first_function = file.second.begin();
|
||||
for (auto i = file.second.begin(); i != file.second.end() && std::next(i) != file.second.end(); ++i)
|
||||
{
|
||||
|
@ -315,6 +315,9 @@ namespace patches
|
||||
// precache is always allowed
|
||||
utils::hook::set(0x1406D5280, 0xC301B0); // NetConstStrings_IsPrecacheAllowed
|
||||
|
||||
// allow localized string to create config strings post init
|
||||
utils::hook::nop(0x1405EE287, 2);
|
||||
|
||||
utils::hook::nop(0x140E6A2FB, 2); // don't wait for occlusion query to succeed (forever loop)
|
||||
utils::hook::nop(0x140E6A30C, 2); // ^
|
||||
}
|
||||
|
@ -664,6 +664,9 @@ namespace game
|
||||
WEAPON_RAISING = 1,
|
||||
WEAPON_RAISING_ALTSWITCH = 2,
|
||||
WEAPON_RAISING_ALTSWITCH_ADS = 3,
|
||||
|
||||
WEAPON_FIRING = 0x10,
|
||||
WEAPON_RECHAMBERING = 0x11,
|
||||
};
|
||||
|
||||
enum WeaponAnimNumber : std::int32_t
|
||||
@ -789,6 +792,11 @@ namespace game
|
||||
unsigned int m_flags[bitSize >> (sizeof(unsigned int) + 1)];
|
||||
};
|
||||
|
||||
struct PlayerWeaponCommonState
|
||||
{
|
||||
unsigned __int16 weaponIdx;
|
||||
};
|
||||
|
||||
struct playerState_s
|
||||
{
|
||||
int commandTime;
|
||||
@ -811,14 +819,24 @@ namespace game
|
||||
assert_offsetof(playerState_s, weapState, 1620);
|
||||
assert_offsetof(playerState_s, weapFlags, 2188);
|
||||
|
||||
struct usercmd_s
|
||||
{
|
||||
unsigned __int64 buttons;
|
||||
char __pad0[112];
|
||||
}; assert_sizeof(usercmd_s, 120);
|
||||
|
||||
struct pmove_t
|
||||
{
|
||||
void* unk;
|
||||
playerState_s* ps;
|
||||
char __pad0[560];
|
||||
usercmd_s cmd;
|
||||
usercmd_s oldcmd;
|
||||
char __pad0[312];
|
||||
void* weaponMap;
|
||||
unsigned char handler;
|
||||
};
|
||||
assert_offsetof(pmove_t, handler, 576);
|
||||
assert_offsetof(pmove_t, weaponMap, 568);
|
||||
|
||||
struct pml_t
|
||||
{
|
||||
@ -827,6 +845,15 @@ namespace game
|
||||
float up[3];
|
||||
float frametime;
|
||||
int msec;
|
||||
int walking;
|
||||
int groundPlane;
|
||||
int almostGroundPlane;
|
||||
int groundTrace;
|
||||
float impactSpeed;
|
||||
float previous_origin[3];
|
||||
float previous_velocity[3];
|
||||
float wishdir[3];
|
||||
unsigned int holdrand;
|
||||
};
|
||||
assert_offsetof(pml_t, msec, 40);
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user