2023-04-10 09:15:12 -04:00
|
|
|
if Engine.GetCurrentMap() ~= "core_frontend" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
function IsServerBrowserEnabled()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
DataSources.LobbyServer = {
|
2023-04-10 09:57:46 -04:00
|
|
|
prepare = function(controller, list, filter)
|
2023-04-10 09:15:12 -04:00
|
|
|
list.numElementsInList = list.vCount
|
|
|
|
list.controller = controller
|
2023-04-10 09:57:46 -04:00
|
|
|
list.serverBrowserRootModel = Engine.CreateModel(Engine.GetGlobalModel(), "serverBrowser")
|
|
|
|
local serverListCountModel = Engine.GetModel(list.serverBrowserRootModel, "serverListCount")
|
2023-04-10 09:15:12 -04:00
|
|
|
if serverListCountModel then
|
2023-04-10 09:57:46 -04:00
|
|
|
list.serverCount = Engine.GetModelValue(serverListCountModel)
|
2023-04-10 09:15:12 -04:00
|
|
|
else
|
|
|
|
list.serverCount = 0
|
|
|
|
end
|
|
|
|
list.servers = {}
|
2023-04-10 09:57:46 -04:00
|
|
|
local serversModel = Engine.CreateModel(list.serverBrowserRootModel, "servers")
|
2023-04-10 09:15:12 -04:00
|
|
|
for i = 1, list.numElementsInList, 1 do
|
|
|
|
list.servers[i] = {}
|
2023-04-10 09:57:46 -04:00
|
|
|
list.servers[i].root = Engine.CreateModel(serversModel, "server_" .. i)
|
|
|
|
list.servers[i].model = Engine.CreateModel(list.servers[i].root, "model")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
list.updateModels = function(controller, list, offset)
|
|
|
|
local serverInfo = Engine.SteamServerBrowser_GetServerInfo(offset)
|
2023-04-10 09:15:12 -04:00
|
|
|
if serverInfo then
|
2023-04-10 09:57:46 -04:00
|
|
|
local SetModelValue = function(model, key, value)
|
|
|
|
local model = Engine.CreateModel(model, key)
|
2023-04-10 09:15:12 -04:00
|
|
|
if model then
|
2023-04-10 09:57:46 -04:00
|
|
|
Engine.SetModelValue(model, value)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local elementIndex = offset % list.numElementsInList + 1
|
|
|
|
local serverModel = list.servers[elementIndex].model
|
2023-04-10 09:57:46 -04:00
|
|
|
SetModelValue(serverModel, "serverIndex", serverInfo.serverIndex)
|
|
|
|
SetModelValue(serverModel, "connectAddr", serverInfo.connectAddr)
|
|
|
|
SetModelValue(serverModel, "ping", serverInfo.ping)
|
|
|
|
SetModelValue(serverModel, "modName", serverInfo.modName)
|
|
|
|
SetModelValue(serverModel, "mapName", serverInfo.map)
|
|
|
|
SetModelValue(serverModel, "desc", serverInfo.desc)
|
2023-04-10 09:15:12 -04:00
|
|
|
-- Changed the client count to be the actual player count
|
|
|
|
local clientCount = serverInfo.playerCount - serverInfo.botCount
|
2023-04-10 09:57:46 -04:00
|
|
|
SetModelValue(serverModel, "clientCount", clientCount)
|
|
|
|
SetModelValue(serverModel, "maxClients", serverInfo.maxPlayers)
|
|
|
|
SetModelValue(serverModel, "passwordProtected", serverInfo.password)
|
|
|
|
SetModelValue(serverModel, "secure", serverInfo.secure)
|
|
|
|
SetModelValue(serverModel, "name", serverInfo.name)
|
|
|
|
SetModelValue(serverModel, "gameType", serverInfo.gametype)
|
|
|
|
SetModelValue(serverModel, "dedicated", serverInfo.dedicated)
|
|
|
|
SetModelValue(serverModel, "ranked", serverInfo.ranked)
|
|
|
|
SetModelValue(serverModel, "hardcore", serverInfo.hardcore)
|
2023-04-10 10:46:55 -04:00
|
|
|
SetModelValue(serverModel, "zombies", serverInfo.zombies)
|
2023-04-10 09:15:12 -04:00
|
|
|
-- Added the bot count
|
2023-04-10 09:57:46 -04:00
|
|
|
SetModelValue(serverModel, "botCount", serverInfo.botCount)
|
2023-04-10 09:15:12 -04:00
|
|
|
return serverModel
|
|
|
|
else
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
if list.serverListUpdateSubscription then
|
2023-04-10 09:57:46 -04:00
|
|
|
list:removeSubscription(list.serverListUpdateSubscription)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
local serverListUpdateModel = Engine.CreateModel(list.serverBrowserRootModel, "serverListCount")
|
|
|
|
list.serverListUpdateSubscription = list:subscribeToModel(serverListUpdateModel, function(model)
|
|
|
|
list:updateDataSource(false, false)
|
|
|
|
end, false)
|
2023-04-10 09:15:12 -04:00
|
|
|
if list.serverListSortTypeSubscription then
|
2023-04-10 09:57:46 -04:00
|
|
|
list:removeSubscription(list.serverListSortTypeSubscription)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
local serverListSortTypeModel = Engine.CreateModel(list.serverBrowserRootModel, "serverListSortType")
|
|
|
|
list.serverListSortTypeSubscription = list:subscribeToModel(serverListSortTypeModel, function(model)
|
|
|
|
list:updateDataSource(false, false)
|
|
|
|
end, false)
|
2023-04-10 09:15:12 -04:00
|
|
|
end,
|
2023-04-10 09:57:46 -04:00
|
|
|
getCount = function(list)
|
2023-04-10 09:15:12 -04:00
|
|
|
return list.serverCount
|
|
|
|
end,
|
2023-04-10 09:57:46 -04:00
|
|
|
getItem = function(controller, list, index)
|
2023-04-10 09:15:12 -04:00
|
|
|
local offset = index - 1
|
2023-04-10 09:57:46 -04:00
|
|
|
return list.updateModels(controller, list, offset)
|
2023-04-10 09:15:12 -04:00
|
|
|
end,
|
2023-04-10 09:57:46 -04:00
|
|
|
cleanup = function(list)
|
2023-04-10 09:15:12 -04:00
|
|
|
if list.serverBrowserRootModel then
|
2023-04-10 09:57:46 -04:00
|
|
|
Engine.UnsubscribeAndFreeModel(list.serverBrowserRootModel)
|
2023-04-10 09:15:12 -04:00
|
|
|
list.serverBrowserRootModel = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2023-04-10 09:57:46 -04:00
|
|
|
CoD.ServerBrowserRowInternal.new = function(menu, controller)
|
|
|
|
local self = LUI.UIHorizontalList.new({
|
2023-04-10 09:15:12 -04:00
|
|
|
left = 0,
|
|
|
|
top = 0,
|
|
|
|
right = 0,
|
|
|
|
bottom = 0,
|
|
|
|
leftAnchor = true,
|
|
|
|
topAnchor = true,
|
|
|
|
rightAnchor = true,
|
|
|
|
bottomAnchor = true,
|
|
|
|
spacing = 2
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
self:setAlignment(LUI.Alignment.Left)
|
2023-04-10 09:15:12 -04:00
|
|
|
if PreLoadFunc then
|
2023-04-10 09:57:46 -04:00
|
|
|
PreLoadFunc(self, controller)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
self:setUseStencil(false)
|
|
|
|
self:setClass(CoD.ServerBrowserRowInternal)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.id = "ServerBrowserRowInternal"
|
|
|
|
self.soundSet = "default"
|
2023-04-10 09:57:46 -04:00
|
|
|
self:setLeftRight(true, false, 0, 700)
|
|
|
|
self:setTopBottom(true, false, 0, 22)
|
2023-04-10 09:15:12 -04:00
|
|
|
self:makeFocusable()
|
|
|
|
self.onlyChildrenFocusable = true
|
|
|
|
self.anyChildUsesUpdateState = true
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local passwordFlag = CoD.ServerBrowserFlag.new(menu, controller)
|
|
|
|
passwordFlag:setLeftRight(true, false, 0, 28)
|
|
|
|
passwordFlag:setTopBottom(true, true, 0, 0)
|
|
|
|
passwordFlag.icon:setImage(RegisterImage("uie_t7_icon_serverbrowser_protected"))
|
|
|
|
passwordFlag:linkToElementModel(self, nil, false, function(model)
|
|
|
|
passwordFlag:setModel(model, controller)
|
|
|
|
end)
|
|
|
|
passwordFlag:mergeStateConditions({
|
2023-04-10 09:15:12 -04:00
|
|
|
{
|
|
|
|
stateName = "FlagOn",
|
2023-04-10 09:57:46 -04:00
|
|
|
condition = function(menu, element, event)
|
|
|
|
return IsSelfModelValueTrue(element, controller, "passwordProtected")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
|
|
|
}
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
passwordFlag:linkToElementModel(passwordFlag, "passwordProtected", true, function(model)
|
|
|
|
menu:updateElementState(passwordFlag, {
|
2023-04-10 09:15:12 -04:00
|
|
|
name = "model_validation",
|
|
|
|
menu = menu,
|
2023-04-10 09:57:46 -04:00
|
|
|
modelValue = Engine.GetModelValue(model),
|
2023-04-10 09:15:12 -04:00
|
|
|
modelName = "passwordProtected"
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
end)
|
|
|
|
self:addElement(passwordFlag)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.passwordFlag = passwordFlag
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local dedicatedFlag = CoD.ServerBrowserFlag.new(menu, controller)
|
|
|
|
dedicatedFlag:setLeftRight(true, false, 30, 58)
|
|
|
|
dedicatedFlag:setTopBottom(true, true, 0, 0)
|
|
|
|
dedicatedFlag.icon:setImage(RegisterImage("uie_t7_icon_serverbrowser_dedicated"))
|
|
|
|
dedicatedFlag:linkToElementModel(self, nil, false, function(model)
|
|
|
|
dedicatedFlag:setModel(model, controller)
|
|
|
|
end)
|
|
|
|
dedicatedFlag:mergeStateConditions({
|
2023-04-10 09:15:12 -04:00
|
|
|
{
|
|
|
|
stateName = "FlagOn",
|
2023-04-10 09:57:46 -04:00
|
|
|
condition = function(menu, element, event)
|
|
|
|
return IsSelfModelValueTrue(element, controller, "dedicated")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
|
|
|
}
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
dedicatedFlag:linkToElementModel(dedicatedFlag, "dedicated", true, function(model)
|
|
|
|
menu:updateElementState(dedicatedFlag, {
|
2023-04-10 09:15:12 -04:00
|
|
|
name = "model_validation",
|
|
|
|
menu = menu,
|
2023-04-10 09:57:46 -04:00
|
|
|
modelValue = Engine.GetModelValue(model),
|
2023-04-10 09:15:12 -04:00
|
|
|
modelName = "dedicated"
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
end)
|
|
|
|
self:addElement(dedicatedFlag)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.dedicatedFlag = dedicatedFlag
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local rankedFlag = CoD.ServerBrowserFlag.new(menu, controller)
|
|
|
|
rankedFlag:setLeftRight(true, false, 60, 88)
|
|
|
|
rankedFlag:setTopBottom(true, true, 0, 0)
|
|
|
|
rankedFlag.icon:setImage(RegisterImage("uie_t7_icon_serverbrowser_ranked"))
|
|
|
|
rankedFlag:linkToElementModel(self, nil, false, function(model)
|
|
|
|
rankedFlag:setModel(model, controller)
|
|
|
|
end)
|
|
|
|
rankedFlag:mergeStateConditions({
|
2023-04-10 09:15:12 -04:00
|
|
|
{
|
|
|
|
stateName = "FlagOn",
|
2023-04-10 09:57:46 -04:00
|
|
|
condition = function(menu, element, event)
|
|
|
|
return IsSelfModelValueTrue(element, controller, "ranked")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
|
|
|
}
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
rankedFlag:linkToElementModel(rankedFlag, "ranked", true, function(model)
|
|
|
|
menu:updateElementState(rankedFlag, {
|
2023-04-10 09:15:12 -04:00
|
|
|
name = "model_validation",
|
|
|
|
menu = menu,
|
2023-04-10 09:57:46 -04:00
|
|
|
modelValue = Engine.GetModelValue(model),
|
2023-04-10 09:15:12 -04:00
|
|
|
modelName = "ranked"
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
end)
|
|
|
|
self:addElement(rankedFlag)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.rankedFlag = rankedFlag
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local name = CoD.horizontalScrollingTextBox_18pt.new(menu, controller)
|
|
|
|
name:setLeftRight(true, false, 90, 330)
|
|
|
|
name:setTopBottom(true, false, 2, 20)
|
|
|
|
name.textBox:setTTF("fonts/default.ttf")
|
|
|
|
name.textBox:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
name:linkToElementModel(self, "name", true, function(model)
|
|
|
|
local _name = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if _name then
|
2023-04-10 09:57:46 -04:00
|
|
|
name.textBox:setText(Engine.Localize(_name))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(name)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.name = name
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local spacer = LUI.UIFrame.new(menu, controller, 0, 0, false)
|
|
|
|
spacer:setLeftRight(true, false, 332, 339)
|
|
|
|
spacer:setTopBottom(true, false, 0, 22)
|
|
|
|
spacer:setAlpha(0)
|
|
|
|
self:addElement(spacer)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.spacer = spacer
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local map = CoD.horizontalScrollingTextBox_18pt.new(menu, controller)
|
|
|
|
map:setLeftRight(true, false, 341, 446)
|
|
|
|
map:setTopBottom(true, false, 2, 20)
|
|
|
|
map.textBox:setTTF("fonts/default.ttf")
|
|
|
|
map.textBox:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
map:linkToElementModel(self, "mapName", true, function(model)
|
|
|
|
local mapName = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if mapName then
|
2023-04-10 09:57:46 -04:00
|
|
|
map.textBox:setText(MapNameToLocalizedMapName(mapName))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(map)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.map = map
|
2023-04-10 09:57:46 -04:00
|
|
|
|
|
|
|
local hardcoreFlag = CoD.ServerBrowserFlag.new(menu, controller)
|
|
|
|
hardcoreFlag:setLeftRight(true, false, 448, 470)
|
|
|
|
hardcoreFlag:setTopBottom(true, true, 0, 0)
|
|
|
|
hardcoreFlag.icon:setImage(RegisterImage("uie_t7_icon_serverbrowser_skull"))
|
|
|
|
hardcoreFlag:linkToElementModel(self, nil, false, function(model)
|
|
|
|
hardcoreFlag:setModel(model, controller)
|
|
|
|
end)
|
|
|
|
hardcoreFlag:mergeStateConditions({
|
2023-04-10 09:15:12 -04:00
|
|
|
{
|
|
|
|
stateName = "FlagOn",
|
2023-04-10 09:57:46 -04:00
|
|
|
condition = function(menu, element, event)
|
|
|
|
return IsSelfModelValueTrue(element, controller, "hardcore")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
|
|
|
}
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
hardcoreFlag:linkToElementModel(hardcoreFlag, "hardcore", true, function(model)
|
|
|
|
menu:updateElementState(hardcoreFlag, {
|
2023-04-10 09:15:12 -04:00
|
|
|
name = "model_validation",
|
|
|
|
menu = menu,
|
2023-04-10 09:57:46 -04:00
|
|
|
modelValue = Engine.GetModelValue(model),
|
2023-04-10 09:15:12 -04:00
|
|
|
modelName = "hardcore"
|
2023-04-10 09:57:46 -04:00
|
|
|
})
|
|
|
|
end)
|
|
|
|
self:addElement(hardcoreFlag)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.hardcoreFlag = hardcoreFlag
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local gametype = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
gametype:setLeftRight(true, false, 472, 576)
|
|
|
|
gametype:setTopBottom(true, false, 2, 20)
|
|
|
|
gametype:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
gametype:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
gametype:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
gametype:linkToElementModel(self, "gameType", true, function(model)
|
|
|
|
local gameType = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if gameType then
|
2023-04-10 09:57:46 -04:00
|
|
|
gametype:setText(Engine.Localize(GetGameTypeDisplayString(gameType)))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(gametype)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.gametype = gametype
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local playerCount = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
playerCount:setLeftRight(true, false, 593, 613)
|
|
|
|
playerCount:setTopBottom(true, false, 2, 20)
|
|
|
|
playerCount:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
playerCount:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_RIGHT)
|
|
|
|
playerCount:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
playerCount:linkToElementModel(self, "clientCount", true, function(model)
|
|
|
|
local clientCount = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if clientCount then
|
2023-04-10 09:57:46 -04:00
|
|
|
playerCount:setText(Engine.Localize(clientCount))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(playerCount)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.playerCount = playerCount
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local slash = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
slash:setLeftRight(true, false, 615, 624)
|
|
|
|
slash:setTopBottom(true, false, 2, 20)
|
|
|
|
slash:setText(Engine.Localize("/"))
|
|
|
|
slash:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
slash:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
slash:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
self:addElement(slash)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.slash = slash
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local maxPlayers = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
maxPlayers:setLeftRight(true, false, 626, 645)
|
|
|
|
maxPlayers:setTopBottom(true, false, 2, 20)
|
|
|
|
maxPlayers:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
maxPlayers:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
maxPlayers:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
maxPlayers:linkToElementModel(self, "maxClients", true, function(model)
|
|
|
|
local maxClients = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if maxClients then
|
2023-04-10 09:57:46 -04:00
|
|
|
maxPlayers:setText(Engine.Localize(maxClients))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(maxPlayers)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.maxPlayers = maxPlayers
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local botCount = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
botCount:setLeftRight(true, false, 637, 659)
|
|
|
|
botCount:setTopBottom(true, false, 2, 20)
|
|
|
|
botCount:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
botCount:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
|
|
|
|
botCount:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
botCount:linkToElementModel(self, "botCount", true, function(model)
|
|
|
|
local _botCount = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if _botCount then
|
2023-04-10 09:57:46 -04:00
|
|
|
botCount:setText("[" .. Engine.Localize(_botCount) .. "]")
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
2023-04-10 10:46:55 -04:00
|
|
|
botCount:linkToElementModel(self, "zombies", true, function(model)
|
|
|
|
local zombies = Engine.GetModelValue(model)
|
|
|
|
if zombies ~= nil then
|
|
|
|
botCount:setAlpha(zombies and 0 or 1)
|
|
|
|
end
|
|
|
|
end)
|
2023-04-10 09:57:46 -04:00
|
|
|
self:addElement(botCount)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.botCount = botCount
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
local ping = LUI.UIText.new()
|
2023-04-10 09:57:46 -04:00
|
|
|
ping:setLeftRight(true, false, 661, 699.37)
|
|
|
|
ping:setTopBottom(true, false, 2, 20)
|
|
|
|
ping:setTTF("fonts/RefrigeratorDeluxe-Regular.ttf")
|
|
|
|
ping:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_CENTER)
|
|
|
|
ping:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
|
|
|
|
ping:linkToElementModel(self, "ping", true, function(model)
|
|
|
|
local _ping = Engine.GetModelValue(model)
|
2023-04-10 09:15:12 -04:00
|
|
|
if _ping then
|
2023-04-10 09:57:46 -04:00
|
|
|
ping:setText(Engine.Localize(_ping))
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
self:addElement(ping)
|
2023-04-10 09:15:12 -04:00
|
|
|
self.ping = ping
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
spacer.id = "spacer"
|
2023-04-10 09:57:46 -04:00
|
|
|
self:registerEventHandler("gain_focus", function(self, event)
|
|
|
|
if self.m_focusable and self.spacer:processEvent(event) then
|
2023-04-10 09:15:12 -04:00
|
|
|
return true
|
|
|
|
else
|
2023-04-10 09:57:46 -04:00
|
|
|
return LUI.UIElement.gainFocus(self, event)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
LUI.OverrideFunction_CallOriginalSecond(self, "close", function(element)
|
2023-04-10 09:15:12 -04:00
|
|
|
element.passwordFlag:close()
|
|
|
|
element.dedicatedFlag:close()
|
|
|
|
element.rankedFlag:close()
|
|
|
|
element.name:close()
|
|
|
|
element.map:close()
|
|
|
|
element.hardcoreFlag:close()
|
|
|
|
element.gametype:close()
|
|
|
|
element.playerCount:close()
|
|
|
|
element.maxPlayers:close()
|
2023-04-10 10:46:55 -04:00
|
|
|
element.botCount:close()
|
2023-04-10 09:15:12 -04:00
|
|
|
element.ping:close()
|
2023-04-10 09:57:46 -04:00
|
|
|
end)
|
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
if PostLoadFunc then
|
2023-04-10 09:57:46 -04:00
|
|
|
PostLoadFunc(self, controller, menu)
|
2023-04-10 09:15:12 -04:00
|
|
|
end
|
2023-04-10 09:57:46 -04:00
|
|
|
|
2023-04-10 09:15:12 -04:00
|
|
|
return self
|
|
|
|
end
|