nicely format LUA files
This commit is contained in:
parent
b4326f7177
commit
2d8a3bbe5c
@ -1,6 +1,6 @@
|
||||
if (game:issingleplayer()) then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
require("settings")
|
||||
require("hud")
|
||||
require("hud")
|
||||
|
@ -4,155 +4,155 @@ local textheight = 13
|
||||
local textoffsety = barheight / 2 - textheight / 2
|
||||
|
||||
function createinfobar()
|
||||
local infobar = LUI.UIElement.new({
|
||||
left = luiglobals.GameX.IsHardcoreMode() and 160 or 228,
|
||||
top = luiglobals.GameX.IsHardcoreMode() and 5 or 9,
|
||||
height = barheight,
|
||||
width = 70,
|
||||
leftAnchor = true,
|
||||
topAnchor = true
|
||||
})
|
||||
local infobar = LUI.UIElement.new({
|
||||
left = luiglobals.GameX.IsHardcoreMode() and 160 or 228,
|
||||
top = luiglobals.GameX.IsHardcoreMode() and 5 or 9,
|
||||
height = barheight,
|
||||
width = 70,
|
||||
leftAnchor = true,
|
||||
topAnchor = true
|
||||
})
|
||||
|
||||
infobar:registerAnimationState("hud_on", {
|
||||
alpha = 1
|
||||
})
|
||||
infobar:registerAnimationState("hud_on", {
|
||||
alpha = 1
|
||||
})
|
||||
|
||||
infobar:registerAnimationState("hud_off", {
|
||||
alpha = 0
|
||||
})
|
||||
infobar:registerAnimationState("hud_off", {
|
||||
alpha = 0
|
||||
})
|
||||
|
||||
return infobar
|
||||
return infobar
|
||||
end
|
||||
|
||||
function populateinfobar(infobar)
|
||||
elementoffset = 0
|
||||
elementoffset = 0
|
||||
|
||||
if (Engine.GetDvarBool("cg_infobar_fps")) then
|
||||
infobar:addElement(infoelement({
|
||||
label = "FPS: ",
|
||||
getvalue = function()
|
||||
return game:getfps()
|
||||
end,
|
||||
width = 70,
|
||||
interval = 100
|
||||
}))
|
||||
end
|
||||
if (Engine.GetDvarBool("cg_infobar_fps")) then
|
||||
infobar:addElement(infoelement({
|
||||
label = "FPS: ",
|
||||
getvalue = function()
|
||||
return game:getfps()
|
||||
end,
|
||||
width = 70,
|
||||
interval = 100
|
||||
}))
|
||||
end
|
||||
|
||||
if (Engine.GetDvarBool("cg_infobar_ping")) then
|
||||
infobar:addElement(infoelement({
|
||||
label = "Latency: ",
|
||||
getvalue = function()
|
||||
return game:getping() .. " ms"
|
||||
end,
|
||||
width = 115,
|
||||
interval = 100
|
||||
}))
|
||||
end
|
||||
if (Engine.GetDvarBool("cg_infobar_ping")) then
|
||||
infobar:addElement(infoelement({
|
||||
label = "Latency: ",
|
||||
getvalue = function()
|
||||
return game:getping() .. " ms"
|
||||
end,
|
||||
width = 115,
|
||||
interval = 100
|
||||
}))
|
||||
end
|
||||
end
|
||||
|
||||
function infoelement(data)
|
||||
local container = LUI.UIElement.new({
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
width = data.width,
|
||||
left = elementoffset
|
||||
})
|
||||
local container = LUI.UIElement.new({
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
width = data.width,
|
||||
left = elementoffset
|
||||
})
|
||||
|
||||
elementoffset = elementoffset + data.width + 10
|
||||
elementoffset = elementoffset + data.width + 10
|
||||
|
||||
local background = LUI.UIImage.new({
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
rightAnchor = true,
|
||||
material = luiglobals.RegisterMaterial("white"),
|
||||
color = luiglobals.Colors.black,
|
||||
alpha = 0.5
|
||||
})
|
||||
local background = LUI.UIImage.new({
|
||||
bottomAnchor = true,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
rightAnchor = true,
|
||||
material = luiglobals.RegisterMaterial("white"),
|
||||
color = luiglobals.Colors.black,
|
||||
alpha = 0.5
|
||||
})
|
||||
|
||||
local labelfont = CoD.TextSettings.FontBold110
|
||||
local labelfont = CoD.TextSettings.FontBold110
|
||||
|
||||
local label = LUI.UIText.new({
|
||||
left = 5,
|
||||
top = textoffsety,
|
||||
font = labelfont.Font,
|
||||
height = textheight,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
color = {
|
||||
r = 0.8,
|
||||
g = 0.8,
|
||||
b = 0.8,
|
||||
}
|
||||
})
|
||||
local label = LUI.UIText.new({
|
||||
left = 5,
|
||||
top = textoffsety,
|
||||
font = labelfont.Font,
|
||||
height = textheight,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
color = {
|
||||
r = 0.8,
|
||||
g = 0.8,
|
||||
b = 0.8
|
||||
}
|
||||
})
|
||||
|
||||
label:setText(data.label)
|
||||
label:setText(data.label)
|
||||
|
||||
local _, _, left = luiglobals.GetTextDimensions(data.label, labelfont.Font, textheight)
|
||||
local value = LUI.UIText.new({
|
||||
left = left + 5,
|
||||
top = textoffsety,
|
||||
height = textheight,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
color = {
|
||||
r = 0.6,
|
||||
g = 0.6,
|
||||
b = 0.6,
|
||||
}
|
||||
})
|
||||
|
||||
value:addElement(LUI.UITimer.new(data.interval, "update"))
|
||||
value:setText(data.getvalue())
|
||||
value:addEventHandler("update", function()
|
||||
value:setText(data.getvalue())
|
||||
end)
|
||||
|
||||
container:addElement(background)
|
||||
container:addElement(label)
|
||||
container:addElement(value)
|
||||
|
||||
return container
|
||||
local _, _, left = luiglobals.GetTextDimensions(data.label, labelfont.Font, textheight)
|
||||
local value = LUI.UIText.new({
|
||||
left = left + 5,
|
||||
top = textoffsety,
|
||||
height = textheight,
|
||||
leftAnchor = true,
|
||||
topAnchor = true,
|
||||
color = {
|
||||
r = 0.6,
|
||||
g = 0.6,
|
||||
b = 0.6
|
||||
}
|
||||
})
|
||||
|
||||
value:addElement(LUI.UITimer.new(data.interval, "update"))
|
||||
value:setText(data.getvalue())
|
||||
value:addEventHandler("update", function()
|
||||
value:setText(data.getvalue())
|
||||
end)
|
||||
|
||||
container:addElement(background)
|
||||
container:addElement(label)
|
||||
container:addElement(value)
|
||||
|
||||
return container
|
||||
end
|
||||
|
||||
local updatehudvisibility = mphud.updateHudVisibility
|
||||
mphud.updateHudVisibility = function(a1, a2)
|
||||
updatehudvisibility(a1, a2)
|
||||
updatehudvisibility(a1, a2)
|
||||
|
||||
local root = Engine.GetLuiRoot()
|
||||
local menus = root:AnyActiveMenusInStack()
|
||||
local infobar = root.infobar
|
||||
local root = Engine.GetLuiRoot()
|
||||
local menus = root:AnyActiveMenusInStack()
|
||||
local infobar = root.infobar
|
||||
|
||||
if (not infobar) then
|
||||
return
|
||||
end
|
||||
if (not infobar) then
|
||||
return
|
||||
end
|
||||
|
||||
if (menus) then
|
||||
infobar:animateToState("hud_off")
|
||||
else
|
||||
infobar:animateToState("hud_on")
|
||||
end
|
||||
if (menus) then
|
||||
infobar:animateToState("hud_off")
|
||||
else
|
||||
infobar:animateToState("hud_on")
|
||||
end
|
||||
end
|
||||
|
||||
LUI.onmenuopen("mp_hud", function(hud)
|
||||
if (Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
if (Engine.InFrontend()) then
|
||||
return
|
||||
end
|
||||
|
||||
local infobar = createinfobar()
|
||||
local root = Engine.GetLuiRoot()
|
||||
root.infobar = infobar
|
||||
populateinfobar(infobar)
|
||||
local infobar = createinfobar()
|
||||
local root = Engine.GetLuiRoot()
|
||||
root.infobar = infobar
|
||||
populateinfobar(infobar)
|
||||
|
||||
root:registerEventHandler("update_hud_infobar_settings", function()
|
||||
infobar:removeAllChildren()
|
||||
populateinfobar(infobar)
|
||||
end)
|
||||
root:registerEventHandler("update_hud_infobar_settings", function()
|
||||
infobar:removeAllChildren()
|
||||
populateinfobar(infobar)
|
||||
end)
|
||||
|
||||
root:processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
|
||||
hud.static:addElement(infobar)
|
||||
end)
|
||||
root:processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
|
||||
hud.static:addElement(infobar)
|
||||
end)
|
||||
|
@ -7,173 +7,103 @@ game:addlocalizedstring("LUA_MENU_LATENCY", "Server Latency")
|
||||
game:addlocalizedstring("LUA_MENU_LATENCY_DESC", "Show server latency")
|
||||
|
||||
function createdivider(menu, text)
|
||||
local element = LUI.UIElement.new( {
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
top = 0,
|
||||
bottom = 33.33
|
||||
})
|
||||
local element = LUI.UIElement.new({
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
top = 0,
|
||||
bottom = 33.33
|
||||
})
|
||||
|
||||
element.scrollingToNext = true
|
||||
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
|
||||
title_bar_text = text
|
||||
}))
|
||||
element.scrollingToNext = true
|
||||
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
|
||||
title_bar_text = text
|
||||
}))
|
||||
|
||||
menu.list:addElement(element)
|
||||
menu.list:addElement(element)
|
||||
end
|
||||
|
||||
pcdisplay.CreateOptions = function( menu )
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_COLORBLIND_FILTER",
|
||||
"@LUA_MENU_COLOR_BLIND_DESC",
|
||||
LUI.Options.GetRenderColorBlindText,
|
||||
LUI.Options.RenderColorBlindToggle,
|
||||
LUI.Options.RenderColorBlindToggle
|
||||
)
|
||||
|
||||
if Engine.IsMultiplayer() and Engine.GetDvarType( "cg_paintballFx" ) == luiglobals.DvarTypeTable.DvarBool then
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_PAINTBALL", "@LUA_MENU_PAINTBALL_DESC",
|
||||
LUI.Options.GetDvarEnableTextFunc("cg_paintballFx", false),
|
||||
LUI.Options.ToggleDvarFunc("cg_paintballFx"),
|
||||
LUI.Options.ToggleDvarFunc("cg_paintballFx")
|
||||
)
|
||||
end
|
||||
pcdisplay.CreateOptions = function(menu)
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_COLORBLIND_FILTER", "@LUA_MENU_COLOR_BLIND_DESC", LUI.Options.GetRenderColorBlindText,
|
||||
LUI.Options.RenderColorBlindToggle, LUI.Options.RenderColorBlindToggle)
|
||||
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_BLOOD",
|
||||
"@LUA_MENU_BLOOD_DESC",
|
||||
LUI.Options.GetDvarEnableTextFunc("cg_blood", false),
|
||||
LUI.Options.ToggleProfiledataFunc("showblood", Engine.GetControllerForLocalClient(0)),
|
||||
LUI.Options.ToggleProfiledataFunc("showblood", Engine.GetControllerForLocalClient(0))
|
||||
)
|
||||
|
||||
if not Engine.IsMultiplayer() then
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_CROSSHAIR",
|
||||
"@LUA_MENU_CROSSHAIR_DESC",
|
||||
LUI.Options.GetDvarEnableTextFunc("cg_drawCrosshairOption", false),
|
||||
LUI.Options.ToggleDvarFunc("cg_drawCrosshairOption"),
|
||||
LUI.Options.ToggleDvarFunc("cg_drawCrosshairOption")
|
||||
)
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_drawDamageFeedbackOption",
|
||||
"@LUA_MENU_HIT_MARKER",
|
||||
"@LUA_MENU_HIT_MARKER_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
if Engine.IsMultiplayer() and Engine.GetDvarType("cg_paintballFx") == luiglobals.DvarTypeTable.DvarBool then
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_PAINTBALL", "@LUA_MENU_PAINTBALL_DESC",
|
||||
LUI.Options.GetDvarEnableTextFunc("cg_paintballFx", false), LUI.Options.ToggleDvarFunc("cg_paintballFx"),
|
||||
LUI.Options.ToggleDvarFunc("cg_paintballFx"))
|
||||
end
|
||||
|
||||
if Engine.IsMultiplayer() then
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_KILLSTREAK_COUNTER",
|
||||
"@MENU_DISPLAY_KILLSTREAK_COUNTER_DESC",
|
||||
pcdisplay.GetDisplayKillstreakCounterText,
|
||||
pcdisplay.DisplayKillstreakCounterToggle,
|
||||
pcdisplay.DisplayKillstreakCounterToggle
|
||||
)
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select, "@LUA_MENU_BLOOD",
|
||||
"@LUA_MENU_BLOOD_DESC", LUI.Options.GetDvarEnableTextFunc("cg_blood", false), LUI.Options
|
||||
.ToggleProfiledataFunc("showblood", Engine.GetControllerForLocalClient(0)), LUI.Options
|
||||
.ToggleProfiledataFunc("showblood", Engine.GetControllerForLocalClient(0)))
|
||||
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_MEDAL_SPLASHES",
|
||||
"@MENU_DISPLAY_MEDAL_SPLASHES_DESC",
|
||||
pcdisplay.GetDisplayMedalSplashesText,
|
||||
pcdisplay.DisplayMedalSplashesToggle,
|
||||
pcdisplay.DisplayMedalSplashesToggle
|
||||
)
|
||||
if not Engine.IsMultiplayer() then
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@LUA_MENU_CROSSHAIR", "@LUA_MENU_CROSSHAIR_DESC",
|
||||
LUI.Options.GetDvarEnableTextFunc("cg_drawCrosshairOption", false),
|
||||
LUI.Options.ToggleDvarFunc("cg_drawCrosshairOption"), LUI.Options.ToggleDvarFunc("cg_drawCrosshairOption"))
|
||||
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_WEAPON_EMBLEMS",
|
||||
"@MENU_DISPLAY_WEAPON_EMBLEMS_DESC",
|
||||
pcdisplay.GetDisplayWeaponEmblemsText,
|
||||
pcdisplay.DisplayWeaponEmblemsToggle,
|
||||
pcdisplay.DisplayWeaponEmblemsToggle
|
||||
)
|
||||
end
|
||||
LUI.Options.CreateOptionButton(menu, "cg_drawDamageFeedbackOption", "@LUA_MENU_HIT_MARKER",
|
||||
"@LUA_MENU_HIT_MARKER_DESC", {{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
}, {
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}})
|
||||
end
|
||||
|
||||
LUI.Options.AddButtonOptionVariant(
|
||||
menu,
|
||||
luiglobals.GenericButtonSettings.Variants.Common,
|
||||
"@MENU_BRIGHTNESS",
|
||||
"@MENU_BRIGHTNESS_DESC1",
|
||||
nil, nil, nil,
|
||||
pcdisplay.OpenBrightnessMenu,
|
||||
nil, nil, nil
|
||||
)
|
||||
if Engine.IsMultiplayer() then
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_KILLSTREAK_COUNTER", "@MENU_DISPLAY_KILLSTREAK_COUNTER_DESC",
|
||||
pcdisplay.GetDisplayKillstreakCounterText, pcdisplay.DisplayKillstreakCounterToggle,
|
||||
pcdisplay.DisplayKillstreakCounterToggle)
|
||||
|
||||
createdivider(menu, "TELEMETRY")
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_MEDAL_SPLASHES", "@MENU_DISPLAY_MEDAL_SPLASHES_DESC", pcdisplay.GetDisplayMedalSplashesText,
|
||||
pcdisplay.DisplayMedalSplashesToggle, pcdisplay.DisplayMedalSplashesToggle)
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_infobar_ping",
|
||||
"@LUA_MENU_LATENCY",
|
||||
"@LUA_MENU_LATENCY_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}, nil, nil, function(value)
|
||||
Engine.SetDvarBool("cg_infobar_ping", value)
|
||||
Engine.GetLuiRoot():processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
end
|
||||
)
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Select,
|
||||
"@MENU_DISPLAY_WEAPON_EMBLEMS", "@MENU_DISPLAY_WEAPON_EMBLEMS_DESC", pcdisplay.GetDisplayWeaponEmblemsText,
|
||||
pcdisplay.DisplayWeaponEmblemsToggle, pcdisplay.DisplayWeaponEmblemsToggle)
|
||||
end
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_infobar_fps",
|
||||
"@LUA_MENU_FPS",
|
||||
"@LUA_MENU_FPS_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
}, nil, nil, function(value)
|
||||
Engine.SetDvarBool("cg_infobar_fps", value)
|
||||
Engine.GetLuiRoot():processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
end
|
||||
)
|
||||
LUI.Options.AddButtonOptionVariant(menu, luiglobals.GenericButtonSettings.Variants.Common, "@MENU_BRIGHTNESS",
|
||||
"@MENU_BRIGHTNESS_DESC1", nil, nil, nil, pcdisplay.OpenBrightnessMenu, nil, nil, nil)
|
||||
|
||||
LUI.Options.InitScrollingList(menu.list, nil)
|
||||
createdivider(menu, "TELEMETRY")
|
||||
|
||||
LUI.Options.CreateOptionButton(menu, "cg_infobar_ping", "@LUA_MENU_LATENCY", "@LUA_MENU_LATENCY_DESC", {{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
}, {
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}}, nil, nil, function(value)
|
||||
Engine.SetDvarBool("cg_infobar_ping", value)
|
||||
Engine.GetLuiRoot():processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
end)
|
||||
|
||||
LUI.Options.CreateOptionButton(menu, "cg_infobar_fps", "@LUA_MENU_FPS", "@LUA_MENU_FPS_DESC", {{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
}, {
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}}, nil, nil, function(value)
|
||||
Engine.SetDvarBool("cg_infobar_fps", value)
|
||||
Engine.GetLuiRoot():processEvent({
|
||||
name = "update_hud_infobar_settings"
|
||||
})
|
||||
end)
|
||||
|
||||
LUI.Options.InitScrollingList(menu.list, nil)
|
||||
end
|
||||
|
@ -4,65 +4,66 @@ local MPLobbyOnline = LUI.mp_menus.MPLobbyOnline
|
||||
game:addlocalizedstring("LUA_MENU_SERVERLIST", "SERVER LIST")
|
||||
|
||||
function LeaveLobby(f5_arg0)
|
||||
LeaveXboxLive()
|
||||
if Lobby.IsInPrivateParty() == false or Lobby.IsPrivatePartyHost() then
|
||||
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive")
|
||||
Engine.ExecNow("clearcontrollermap")
|
||||
end
|
||||
LeaveXboxLive()
|
||||
if Lobby.IsInPrivateParty() == false or Lobby.IsPrivatePartyHost() then
|
||||
LUI.FlowManager.RequestLeaveMenuByName("menu_xboxlive")
|
||||
Engine.ExecNow("clearcontrollermap")
|
||||
end
|
||||
end
|
||||
|
||||
function menu_xboxlive(f16_arg0, f16_arg1)
|
||||
local menu = LUI.MPLobbyBase.new(f16_arg0, {
|
||||
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
|
||||
memberListState = Lobby.MemberListStates.Prelobby
|
||||
})
|
||||
local menu = LUI.MPLobbyBase.new(f16_arg0, {
|
||||
menu_title = "@PLATFORM_UI_HEADER_PLAY_MP_CAPS",
|
||||
memberListState = Lobby.MemberListStates.Prelobby
|
||||
})
|
||||
|
||||
menu:setClass(LUI.MPLobbyOnline)
|
||||
menu:setClass(LUI.MPLobbyOnline)
|
||||
|
||||
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function (a1, a2)
|
||||
local serverListButton = menu:AddButton("@LUA_MENU_SERVERLIST", function(a1, a2)
|
||||
LUI.FlowManager.RequestAddMenu(a1, "menu_systemlink_join", true, nil)
|
||||
end)
|
||||
serverListButton:setDisabledRefreshRate(500)
|
||||
if Engine.IsCoreMode() then
|
||||
menu:AddCACButton()
|
||||
menu:AddBarracksButton()
|
||||
menu:AddPersonalizationButton()
|
||||
-- menu:AddDepotButton()
|
||||
end
|
||||
serverListButton:setDisabledRefreshRate(500)
|
||||
if Engine.IsCoreMode() then
|
||||
menu:AddCACButton()
|
||||
menu:AddBarracksButton()
|
||||
menu:AddPersonalizationButton()
|
||||
-- menu:AddDepotButton()
|
||||
end
|
||||
|
||||
serverListButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch, MPLobbyOnline.disablePrivateMatchButton)
|
||||
serverListButton:rename("menu_xboxlive_private_match")
|
||||
serverListButton:setDisabledRefreshRate(500)
|
||||
if not Engine.IsCoreMode() then
|
||||
local leaderboardButton = menu:AddButton("@LUA_MENU_LEADERBOARD", "OpLeaderboardMain")
|
||||
leaderboardButton:rename("OperatorMenu_leaderboard")
|
||||
end
|
||||
serverListButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,
|
||||
MPLobbyOnline.disablePrivateMatchButton)
|
||||
serverListButton:rename("menu_xboxlive_private_match")
|
||||
serverListButton:setDisabledRefreshRate(500)
|
||||
if not Engine.IsCoreMode() then
|
||||
local leaderboardButton = menu:AddButton("@LUA_MENU_LEADERBOARD", "OpLeaderboardMain")
|
||||
leaderboardButton:rename("OperatorMenu_leaderboard")
|
||||
end
|
||||
|
||||
menu:AddOptionsButton()
|
||||
local natType = Lobby.GetNATType()
|
||||
if natType then
|
||||
local natTypeText = Engine.Localize("NETWORK_YOURNATTYPE", natType)
|
||||
local properties = CoD.CreateState(nil, nil, 2, -62, CoD.AnchorTypes.BottomRight)
|
||||
properties.width = 250
|
||||
properties.height = CoD.TextSettings.BodyFontVeryTiny.Height
|
||||
properties.font = CoD.TextSettings.BodyFontVeryTiny.Font
|
||||
properties.color = luiglobals.Colors.white
|
||||
properties.alpha = 0.25
|
||||
local self = LUI.UIText.new(properties)
|
||||
self:setText(natTypeText)
|
||||
menu:addElement(self)
|
||||
end
|
||||
menu:AddOptionsButton()
|
||||
local natType = Lobby.GetNATType()
|
||||
if natType then
|
||||
local natTypeText = Engine.Localize("NETWORK_YOURNATTYPE", natType)
|
||||
local properties = CoD.CreateState(nil, nil, 2, -62, CoD.AnchorTypes.BottomRight)
|
||||
properties.width = 250
|
||||
properties.height = CoD.TextSettings.BodyFontVeryTiny.Height
|
||||
properties.font = CoD.TextSettings.BodyFontVeryTiny.Font
|
||||
properties.color = luiglobals.Colors.white
|
||||
properties.alpha = 0.25
|
||||
local self = LUI.UIText.new(properties)
|
||||
self:setText(natTypeText)
|
||||
menu:addElement(self)
|
||||
end
|
||||
|
||||
menu.isSignInMenu = true
|
||||
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
|
||||
menu:registerEventHandler("player_joined", luiglobals.Cac.PlayerJoinedEvent)
|
||||
menu:registerEventHandler("exit_live_lobby", LeaveLobby)
|
||||
menu.isSignInMenu = true
|
||||
menu:registerEventHandler("gain_focus", LUI.MPLobbyOnline.OnGainFocus)
|
||||
menu:registerEventHandler("player_joined", luiglobals.Cac.PlayerJoinedEvent)
|
||||
menu:registerEventHandler("exit_live_lobby", LeaveLobby)
|
||||
|
||||
if Engine.IsCoreMode() then
|
||||
Engine.ExecNow("eliteclan_refresh", Engine.GetFirstActiveController())
|
||||
end
|
||||
if Engine.IsCoreMode() then
|
||||
Engine.ExecNow("eliteclan_refresh", Engine.GetFirstActiveController())
|
||||
end
|
||||
|
||||
return menu
|
||||
return menu
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.m_types_build["menu_xboxlive"] = menu_xboxlive
|
||||
|
@ -2,161 +2,151 @@ local Lobby = luiglobals.Lobby
|
||||
local SystemLinkJoinMenu = LUI.mp_menus.SystemLinkJoinMenu
|
||||
|
||||
if (not SystemLinkJoinMenu) then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
game:addlocalizedstring("MENU_NUMPLAYERS", "Players")
|
||||
game:addlocalizedstring("MENU_PING", "Ping")
|
||||
|
||||
local offsets = {
|
||||
10,
|
||||
500,
|
||||
950,
|
||||
700,
|
||||
1100,
|
||||
}
|
||||
local offsets = {10, 500, 950, 700, 1100}
|
||||
|
||||
local columns = {
|
||||
"@MENU_HOST_NAME",
|
||||
"@MENU_MAP",
|
||||
"@MENU_NUMPLAYERS",
|
||||
"@MENU_TYPE1",
|
||||
"@MENU_PING",
|
||||
}
|
||||
local columns = {"@MENU_HOST_NAME", "@MENU_MAP", "@MENU_NUMPLAYERS", "@MENU_TYPE1", "@MENU_PING"}
|
||||
|
||||
function textlength(text, font, height)
|
||||
local _, _, width = luiglobals.GetTextDimensions(text, font, height)
|
||||
return width
|
||||
local _, _, width = luiglobals.GetTextDimensions(text, font, height)
|
||||
return width
|
||||
end
|
||||
|
||||
function trimtext(text, font, height, maxwidth)
|
||||
while (textlength(text, font, height) > maxwidth) do
|
||||
text = text:sub(1, #text - 1)
|
||||
end
|
||||
while (textlength(text, font, height) > maxwidth) do
|
||||
text = text:sub(1, #text - 1)
|
||||
end
|
||||
|
||||
return text
|
||||
return text
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.AddHeaderButton = function(menu, f12_arg1, width)
|
||||
local state = CoD.CreateState(0, f12_arg1, nil, nil, CoD.AnchorTypes.TopLeft)
|
||||
state.width = width
|
||||
local element = LUI.UIElement.new(state)
|
||||
local button = SystemLinkJoinMenu.CreateButton("header", 24)
|
||||
local state = CoD.CreateState(0, f12_arg1, nil, nil, CoD.AnchorTypes.TopLeft)
|
||||
state.width = width
|
||||
local element = LUI.UIElement.new(state)
|
||||
local button = SystemLinkJoinMenu.CreateButton("header", 24)
|
||||
|
||||
button:addElement(LUI.Divider.new(CoD.CreateState(nil, 0, nil, nil, CoD.AnchorTypes.TopLeftRight), 40, LUI.Divider.Grey))
|
||||
button:makeNotFocusable()
|
||||
button:addElement(LUI.Divider.new(CoD.CreateState(nil, 0, nil, nil, CoD.AnchorTypes.BottomLeftRight), 40, LUI.Divider.Grey))
|
||||
|
||||
local gettext = function(i)
|
||||
return Engine.Localize(columns[i])
|
||||
end
|
||||
|
||||
for i = 1, #offsets do
|
||||
SystemLinkJoinMenu.MakeText(button.textHolder, offsets[i], gettext(i), nil)
|
||||
end
|
||||
button:addElement(LUI.Divider.new(CoD.CreateState(nil, 0, nil, nil, CoD.AnchorTypes.TopLeftRight), 40,
|
||||
LUI.Divider.Grey))
|
||||
button:makeNotFocusable()
|
||||
button:addElement(LUI.Divider.new(CoD.CreateState(nil, 0, nil, nil, CoD.AnchorTypes.BottomLeftRight), 40,
|
||||
LUI.Divider.Grey))
|
||||
|
||||
element:addElement(button)
|
||||
menu:addElement(element)
|
||||
local gettext = function(i)
|
||||
return Engine.Localize(columns[i])
|
||||
end
|
||||
|
||||
for i = 1, #offsets do
|
||||
SystemLinkJoinMenu.MakeText(button.textHolder, offsets[i], gettext(i), nil)
|
||||
end
|
||||
|
||||
element:addElement(button)
|
||||
menu:addElement(element)
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.AddServerButton = function(menu, controller, index)
|
||||
local button = SystemLinkJoinMenu.CreateButton(index or "header", 24)
|
||||
button:makeFocusable()
|
||||
button.index = index
|
||||
button:addEventHandler("button_action", SystemLinkJoinMenu.OnJoinGame)
|
||||
local button = SystemLinkJoinMenu.CreateButton(index or "header", 24)
|
||||
button:makeFocusable()
|
||||
button.index = index
|
||||
button:addEventHandler("button_action", SystemLinkJoinMenu.OnJoinGame)
|
||||
|
||||
local gettext = function(i)
|
||||
local text = Lobby.GetServerData(controller, index, i - 1)
|
||||
return trimtext(text, CoD.TextSettings.TitleFontSmall.Font, 14, 400)
|
||||
end
|
||||
|
||||
for i = 1, #offsets do
|
||||
SystemLinkJoinMenu.MakeText(button.textHolder, offsets[i], gettext(i), luiglobals.Colors.h1.medium_grey)
|
||||
end
|
||||
local gettext = function(i)
|
||||
local text = Lobby.GetServerData(controller, index, i - 1)
|
||||
return trimtext(text, CoD.TextSettings.TitleFontSmall.Font, 14, 400)
|
||||
end
|
||||
|
||||
menu.list:addElement(button)
|
||||
return button
|
||||
for i = 1, #offsets do
|
||||
SystemLinkJoinMenu.MakeText(button.textHolder, offsets[i], gettext(i), luiglobals.Colors.h1.medium_grey)
|
||||
end
|
||||
|
||||
menu.list:addElement(button)
|
||||
return button
|
||||
end
|
||||
|
||||
SystemLinkJoinMenu.MakeText = function(menu, f5_arg1, text, color)
|
||||
local state = CoD.CreateState(f5_arg1, nil, f5_arg1 + 200, nil, CoD.AnchorTypes.Left)
|
||||
state.font = CoD.TextSettings.TitleFontSmall.Font
|
||||
state.top = -6
|
||||
state.height = 14
|
||||
state.alignment = LUI.Alignment.Left
|
||||
state.glow = LUI.GlowState.None
|
||||
state.color = color
|
||||
local state = CoD.CreateState(f5_arg1, nil, f5_arg1 + 200, nil, CoD.AnchorTypes.Left)
|
||||
state.font = CoD.TextSettings.TitleFontSmall.Font
|
||||
state.top = -6
|
||||
state.height = 14
|
||||
state.alignment = LUI.Alignment.Left
|
||||
state.glow = LUI.GlowState.None
|
||||
state.color = color
|
||||
|
||||
local el = LUI.UIText.new(state)
|
||||
el:registerAnimationState("focused", {
|
||||
color = luiglobals.Colors.white
|
||||
})
|
||||
local el = LUI.UIText.new(state)
|
||||
el:registerAnimationState("focused", {
|
||||
color = luiglobals.Colors.white
|
||||
})
|
||||
|
||||
el:registerEventHandler("focused", function(element, event)
|
||||
element:animateToState("focused", 0)
|
||||
end)
|
||||
el:registerEventHandler("focused", function(element, event)
|
||||
element:animateToState("focused", 0)
|
||||
end)
|
||||
|
||||
el:registerEventHandler("unfocused", function(element, event)
|
||||
element:animateToState("default", 0)
|
||||
end)
|
||||
el:registerEventHandler("unfocused", function(element, event)
|
||||
element:animateToState("default", 0)
|
||||
end)
|
||||
|
||||
el:setText(text)
|
||||
menu:addElement(el)
|
||||
el:setText(text)
|
||||
menu:addElement(el)
|
||||
end
|
||||
|
||||
function menu_systemlink_join(f19_arg0, f19_arg1)
|
||||
local width = 1145
|
||||
local width = 1145
|
||||
|
||||
local menu = LUI.MenuTemplate.new(f19_arg0, {
|
||||
menu_title = "@PLATFORM_SYSTEM_LINK_TITLE",
|
||||
menu_width = width,
|
||||
menu_top_indent = 20,
|
||||
disableDeco = true,
|
||||
spacing = 1
|
||||
})
|
||||
local menu = LUI.MenuTemplate.new(f19_arg0, {
|
||||
menu_title = "@PLATFORM_SYSTEM_LINK_TITLE",
|
||||
menu_width = width,
|
||||
menu_top_indent = 20,
|
||||
disableDeco = true,
|
||||
spacing = 1
|
||||
})
|
||||
|
||||
SystemLinkJoinMenu.AddHeaderButton(menu, 80, width)
|
||||
SystemLinkJoinMenu.AddLowerCounter(menu, width)
|
||||
SystemLinkJoinMenu.UpdateCounterText(menu, nil)
|
||||
Lobby.BuildServerList(Engine.GetFirstActiveController())
|
||||
SystemLinkJoinMenu.AddHeaderButton(menu, 80, width)
|
||||
SystemLinkJoinMenu.AddLowerCounter(menu, width)
|
||||
SystemLinkJoinMenu.UpdateCounterText(menu, nil)
|
||||
Lobby.BuildServerList(Engine.GetFirstActiveController())
|
||||
|
||||
menu.list:registerEventHandler(LUI.UIScrollIndicator.UpdateEvent, function(element, event)
|
||||
SystemLinkJoinMenu.UpdateCounterText(menu, event)
|
||||
end)
|
||||
menu.list:registerEventHandler(LUI.UIScrollIndicator.UpdateEvent, function(element, event)
|
||||
SystemLinkJoinMenu.UpdateCounterText(menu, event)
|
||||
end)
|
||||
|
||||
SystemLinkJoinMenu.UpdateGameList(menu)
|
||||
menu:registerEventHandler("updateGameList", SystemLinkJoinMenu.UpdateGameList)
|
||||
menu:addElement(LUI.UITimer.new(250, "updateGameList"))
|
||||
SystemLinkJoinMenu.UpdateGameList(menu)
|
||||
menu:registerEventHandler("updateGameList", SystemLinkJoinMenu.UpdateGameList)
|
||||
menu:addElement(LUI.UITimer.new(250, "updateGameList"))
|
||||
|
||||
LUI.ButtonHelperText.ClearHelperTextObjects(menu.help, {
|
||||
side = "all"
|
||||
})
|
||||
LUI.ButtonHelperText.ClearHelperTextObjects(menu.help, {
|
||||
side = "all"
|
||||
})
|
||||
|
||||
menu:AddHelp({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_alt1",
|
||||
helper_text = Engine.Localize("@MENU_SB_TOOLTIP_BTN_REFRESH"),
|
||||
side = "right",
|
||||
clickable = true,
|
||||
priority = -1000
|
||||
}, function(f21_arg0, f21_arg1)
|
||||
SystemLinkJoinMenu.RefreshServers(f21_arg0, f21_arg1, menu)
|
||||
end)
|
||||
menu:AddHelp({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_alt1",
|
||||
helper_text = Engine.Localize("@MENU_SB_TOOLTIP_BTN_REFRESH"),
|
||||
side = "right",
|
||||
clickable = true,
|
||||
priority = -1000
|
||||
}, function(f21_arg0, f21_arg1)
|
||||
SystemLinkJoinMenu.RefreshServers(f21_arg0, f21_arg1, menu)
|
||||
end)
|
||||
|
||||
menu:AddHelp({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_action",
|
||||
helper_text = Engine.Localize("@MENU_JOIN_GAME1"),
|
||||
side = "left",
|
||||
clickable = false,
|
||||
priority = -1000
|
||||
}, nil, nil, true)
|
||||
menu:AddHelp({
|
||||
name = "add_button_helper_text",
|
||||
button_ref = "button_action",
|
||||
helper_text = Engine.Localize("@MENU_JOIN_GAME1"),
|
||||
side = "left",
|
||||
clickable = false,
|
||||
priority = -1000
|
||||
}, nil, nil, true)
|
||||
|
||||
menu:AddBackButton()
|
||||
menu:AddBackButton()
|
||||
|
||||
Lobby.RefreshServerList(Engine.GetFirstActiveController())
|
||||
Lobby.RefreshServerList(Engine.GetFirstActiveController())
|
||||
|
||||
return menu
|
||||
return menu
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.m_types_build["menu_systemlink_join"] = menu_systemlink_join
|
||||
|
@ -1,15 +1,17 @@
|
||||
if (game:issingleplayer() or not Engine.InFrontend()) then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_STATS", "Stats")
|
||||
game:addlocalizedstring("LUA_MENU_STATS_DESC", "Edit player stats settings.")
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_ITEMS", "Unlock all items")
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_ITEMS_DESC", "Whether items should be locked based on the player's stats or always unlocked.")
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_ITEMS_DESC",
|
||||
"Whether items should be locked based on the player's stats or always unlocked.")
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_CLASSES", "Unlock all classes")
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_CLASSES_DESC", "Whether classes should be locked based on the player's stats or always unlocked.")
|
||||
game:addlocalizedstring("LUA_MENU_UNLOCKALL_CLASSES_DESC",
|
||||
"Whether classes should be locked based on the player's stats or always unlocked.")
|
||||
|
||||
game:addlocalizedstring("LUA_MENU_PRESTIGE", "Prestige")
|
||||
game:addlocalizedstring("LUA_MENU_PRESTIGE_DESC", "Edit prestige level.")
|
||||
@ -23,202 +25,166 @@ game:addlocalizedstring("LUA_MENU_SETTINGS", "Settings")
|
||||
game:addlocalizedstring("LUA_MENU_EDIT_STATS", "Edit Stats")
|
||||
|
||||
function createdivider(menu, text)
|
||||
local element = LUI.UIElement.new( {
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
top = 0,
|
||||
bottom = 33.33
|
||||
})
|
||||
local element = LUI.UIElement.new({
|
||||
leftAnchor = true,
|
||||
rightAnchor = true,
|
||||
left = 0,
|
||||
right = 0,
|
||||
topAnchor = true,
|
||||
bottomAnchor = false,
|
||||
top = 0,
|
||||
bottom = 33.33
|
||||
})
|
||||
|
||||
element.scrollingToNext = true
|
||||
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
|
||||
title_bar_text = Engine.ToUpperCase(Engine.Localize(text))
|
||||
}))
|
||||
element.scrollingToNext = true
|
||||
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
|
||||
title_bar_text = Engine.ToUpperCase(Engine.Localize(text))
|
||||
}))
|
||||
|
||||
menu.list:addElement(element)
|
||||
menu.list:addElement(element)
|
||||
end
|
||||
|
||||
local personalizationbutton = LUI.MPLobbyBase.AddPersonalizationButton
|
||||
LUI.MPLobbyBase.AddPersonalizationButton = function(menu)
|
||||
personalizationbutton(menu)
|
||||
menu:AddButton("@LUA_MENU_STATS", function()
|
||||
LUI.FlowManager.RequestAddMenu(nil, "stats_menu")
|
||||
end)
|
||||
personalizationbutton(menu)
|
||||
menu:AddButton("@LUA_MENU_STATS", function()
|
||||
LUI.FlowManager.RequestAddMenu(nil, "stats_menu")
|
||||
end)
|
||||
end
|
||||
|
||||
LUI.MenuBuilder.registerType("stats_menu", function(a1)
|
||||
local menu = LUI.MenuTemplate.new(a1, {
|
||||
menu_title = Engine.ToUpperCase(Engine.Localize("@LUA_MENU_STATS")),
|
||||
menu_width = luiglobals.GenericMenuDims.OptionMenuWidth,
|
||||
})
|
||||
local menu = LUI.MenuTemplate.new(a1, {
|
||||
menu_title = Engine.ToUpperCase(Engine.Localize("@LUA_MENU_STATS")),
|
||||
menu_width = luiglobals.GenericMenuDims.OptionMenuWidth
|
||||
})
|
||||
|
||||
createdivider(menu, "@LUA_MENU_SETTINGS")
|
||||
createdivider(menu, "@LUA_MENU_SETTINGS")
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_unlockall_items",
|
||||
"@LUA_MENU_UNLOCKALL_ITEMS",
|
||||
"@LUA_MENU_UNLOCKALL_ITEMS_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
},
|
||||
nil,
|
||||
nil
|
||||
)
|
||||
LUI.Options.CreateOptionButton(menu, "cg_unlockall_items", "@LUA_MENU_UNLOCKALL_ITEMS",
|
||||
"@LUA_MENU_UNLOCKALL_ITEMS_DESC", {{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
}, {
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}}, nil, nil)
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"cg_unlockall_classes",
|
||||
"@LUA_MENU_UNLOCKALL_CLASSES",
|
||||
"@LUA_MENU_UNLOCKALL_CLASSES_DESC",
|
||||
{
|
||||
{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
},
|
||||
{
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}
|
||||
},
|
||||
nil,
|
||||
nil
|
||||
)
|
||||
LUI.Options.CreateOptionButton(menu, "cg_unlockall_classes", "@LUA_MENU_UNLOCKALL_CLASSES",
|
||||
"@LUA_MENU_UNLOCKALL_CLASSES_DESC", {{
|
||||
text = "@LUA_MENU_ENABLED",
|
||||
value = true
|
||||
}, {
|
||||
text = "@LUA_MENU_DISABLED",
|
||||
value = false
|
||||
}}, nil, nil)
|
||||
|
||||
createdivider(menu, "@LUA_MENU_EDIT_STATS")
|
||||
createdivider(menu, "@LUA_MENU_EDIT_STATS")
|
||||
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0
|
||||
local rank = luiglobals.Lobby.GetRankForXP(experience, prestige)
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0
|
||||
local rank = luiglobals.Lobby.GetRankForXP(experience, prestige)
|
||||
|
||||
local saved = true
|
||||
local prestigevalue = prestige
|
||||
local rankvalue = rank
|
||||
local rankbutton = nil
|
||||
local saved = true
|
||||
local prestigevalue = prestige
|
||||
local rankvalue = rank
|
||||
local rankbutton = nil
|
||||
|
||||
prestigeeditbutton(menu, function(value)
|
||||
prestigevalue = value
|
||||
saved = false
|
||||
end)
|
||||
prestigeeditbutton(menu, function(value)
|
||||
prestigevalue = value
|
||||
saved = false
|
||||
end)
|
||||
|
||||
rankbutton = rankeditbutton(menu, function(value)
|
||||
rankvalue = value
|
||||
saved = false
|
||||
end)
|
||||
rankbutton = rankeditbutton(menu, function(value)
|
||||
rankvalue = value
|
||||
saved = false
|
||||
end)
|
||||
|
||||
local savebutton = menu:AddButton("@LUA_MENU_SAVE", function()
|
||||
Engine.SetPlayerData(0, CoD.StatsGroup.Ranked, "prestige", tonumber(prestigevalue))
|
||||
local savebutton = menu:AddButton("@LUA_MENU_SAVE", function()
|
||||
Engine.SetPlayerData(0, CoD.StatsGroup.Ranked, "prestige", tonumber(prestigevalue))
|
||||
|
||||
local rank = tonumber(rankvalue)
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = rank == 0 and 0 or luiglobals.Rank.GetRankMaxXP(tonumber(rankvalue) - 1, prestige)
|
||||
local rank = tonumber(rankvalue)
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = rank == 0 and 0 or luiglobals.Rank.GetRankMaxXP(tonumber(rankvalue) - 1, prestige)
|
||||
|
||||
Engine.SetPlayerData(0, CoD.StatsGroup.Ranked, "experience", experience)
|
||||
Engine.SetPlayerData(0, CoD.StatsGroup.Ranked, "experience", experience)
|
||||
|
||||
saved = true
|
||||
end, nil, nil, nil, {
|
||||
desc_text = Engine.Localize("LUA_MENU_SAVE_DESC")
|
||||
})
|
||||
saved = true
|
||||
end, nil, nil, nil, {
|
||||
desc_text = Engine.Localize("LUA_MENU_SAVE_DESC")
|
||||
})
|
||||
|
||||
LUI.Options.InitScrollingList(menu.list, nil)
|
||||
LUI.Options.AddOptionTextInfo(menu)
|
||||
LUI.Options.InitScrollingList(menu.list, nil)
|
||||
LUI.Options.AddOptionTextInfo(menu)
|
||||
|
||||
menu:AddBackButton(function()
|
||||
if (saved) then
|
||||
LUI.FlowManager.RequestLeaveMenu(menu)
|
||||
return
|
||||
end
|
||||
menu:AddBackButton(function()
|
||||
if (saved) then
|
||||
LUI.FlowManager.RequestLeaveMenu(menu)
|
||||
return
|
||||
end
|
||||
|
||||
LUI.yesnopopup({
|
||||
title = Engine.Localize("@MENU_NOTICE"),
|
||||
text = Engine.Localize("@LUA_MENU_UNSAVED_CHANGES"),
|
||||
callback = function(result)
|
||||
if (result) then
|
||||
LUI.FlowManager.RequestLeaveMenu(menu)
|
||||
end
|
||||
end
|
||||
})
|
||||
end)
|
||||
LUI.yesnopopup({
|
||||
title = Engine.Localize("@MENU_NOTICE"),
|
||||
text = Engine.Localize("@LUA_MENU_UNSAVED_CHANGES"),
|
||||
callback = function(result)
|
||||
if (result) then
|
||||
LUI.FlowManager.RequestLeaveMenu(menu)
|
||||
end
|
||||
end
|
||||
})
|
||||
end)
|
||||
|
||||
return menu
|
||||
return menu
|
||||
end)
|
||||
|
||||
function prestigeeditbutton(menu, callback)
|
||||
local options = {}
|
||||
local max = luiglobals.Lobby.GetMaxPrestigeLevel()
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local options = {}
|
||||
local max = luiglobals.Lobby.GetMaxPrestigeLevel()
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
|
||||
for i = 0, max do
|
||||
game:addlocalizedstring("LUA_MENU_" .. i, i .. "")
|
||||
for i = 0, max do
|
||||
game:addlocalizedstring("LUA_MENU_" .. i, i .. "")
|
||||
|
||||
table.insert(options, {
|
||||
text = "@" .. i,
|
||||
value = i .. ""
|
||||
})
|
||||
end
|
||||
table.insert(options, {
|
||||
text = "@" .. i,
|
||||
value = i .. ""
|
||||
})
|
||||
end
|
||||
|
||||
Engine.SetDvarFromString("ui_prestige_level", prestige .. "")
|
||||
Engine.SetDvarFromString("ui_prestige_level", prestige .. "")
|
||||
|
||||
LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"ui_prestige_level",
|
||||
"@LUA_MENU_PRESTIGE",
|
||||
"@LUA_MENU_PRESTIGE_DESC",
|
||||
options,
|
||||
nil,
|
||||
nil,
|
||||
callback
|
||||
)
|
||||
LUI.Options.CreateOptionButton(menu, "ui_prestige_level", "@LUA_MENU_PRESTIGE", "@LUA_MENU_PRESTIGE_DESC", options,
|
||||
nil, nil, callback)
|
||||
end
|
||||
|
||||
function rankeditbutton(menu, callback)
|
||||
local options = {}
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0
|
||||
local options = {}
|
||||
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
|
||||
local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0
|
||||
|
||||
local rank = luiglobals.Lobby.GetRankForXP(experience, prestige)
|
||||
local max = luiglobals.Rank.GetMaxRank(prestige)
|
||||
local maxprestige = luiglobals.Lobby.GetMaxPrestigeLevel()
|
||||
local rank = luiglobals.Lobby.GetRankForXP(experience, prestige)
|
||||
local max = luiglobals.Rank.GetMaxRank(prestige)
|
||||
local maxprestige = luiglobals.Lobby.GetMaxPrestigeLevel()
|
||||
|
||||
for i = 0, max do
|
||||
game:addlocalizedstring("LUA_MENU_" .. i, i .. "")
|
||||
for i = 0, max do
|
||||
game:addlocalizedstring("LUA_MENU_" .. i, i .. "")
|
||||
|
||||
table.insert(options, {
|
||||
text = "@" .. (i + 1),
|
||||
value = i .. ""
|
||||
})
|
||||
end
|
||||
table.insert(options, {
|
||||
text = "@" .. (i + 1),
|
||||
value = i .. ""
|
||||
})
|
||||
end
|
||||
|
||||
Engine.SetDvarFromString("ui_rank_level_", rank .. "")
|
||||
Engine.SetDvarFromString("ui_rank_level_", rank .. "")
|
||||
|
||||
return LUI.Options.CreateOptionButton(
|
||||
menu,
|
||||
"ui_rank_level_",
|
||||
"@LUA_MENU_RANK",
|
||||
"@LUA_MENU_RANK_DESC",
|
||||
options,
|
||||
nil,
|
||||
nil,
|
||||
callback
|
||||
)
|
||||
return LUI.Options.CreateOptionButton(menu, "ui_rank_level_", "@LUA_MENU_RANK", "@LUA_MENU_RANK_DESC", options, nil,
|
||||
nil, callback)
|
||||
end
|
||||
|
||||
local isclasslocked = luiglobals.Cac.IsCustomClassLocked
|
||||
luiglobals.Cac.IsCustomClassLocked = function(...)
|
||||
if (Engine.GetDvarBool("cg_unlockall_classes")) then
|
||||
return false
|
||||
end
|
||||
if (Engine.GetDvarBool("cg_unlockall_classes")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return isclasslocked(table.unpack({...}))
|
||||
return isclasslocked(table.unpack({...}))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user