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