Skip to main content
Skip to main content

InGameMenuStatisticsFrame

InGameMenuStatisticsFrame

Description

Game statistics display frame for the in-game menu.

Parent

TabbedMenuFrameElement

Functions

buildCellDatabase

Description

Creates a table that contains all different list items. Section headers are excluded and saved separately. These cells are later cloned to form the completed list

Definition

buildCellDatabase()

Code

function InGameMenuStatisticsFrame:buildCellDatabase()
for k, clone in pairs( self.detailsTemplates) do
clone:delete()
self.detailsTemplates[k] = nil
end
self.detailsTemplates = { }

for i = # self.attributesLayout.elements, 1 , - 1 do
local element = self.attributesLayout.elements[i]
local name = element.name

self.detailsTemplates[name] = element:clone()
self.detailsCache[name] = { }
end
end

dequeueDetailsCell

Description

Get a cell with given type name. If there are cells with the correct name in the cellCache, we use those, otherwise a new one is created

Definition

dequeueDetailsCell(string name)

Arguments

stringnameName of the cell

Return Values

stringAcell instance with the requested name

Code

function InGameMenuStatisticsFrame:dequeueDetailsCell(name)
if self.detailsTemplates[name] = = nil then
return nil
end

local cell

local cache = self.detailsCache[name]
if #cache > 0 then
cell = cache[#cache]
cache[#cache] = nil
else
cell = self.detailsTemplates[name]:clone()
end

self.attributesLayout:addElement(cell)

return cell
end

getMenuButtonInfo

Description

Get custom menu button information.

Definition

getMenuButtonInfo()

Return Values

stringArrayof button info as {i={inputAction=, text=, callback=}}

Code

function InGameMenuStatisticsFrame:getMenuButtonInfo()
return self.menuButtonInfo[ self.subCategoryPaging:getState()]
end

queueDetailsCell

Description

Release a cell to the cache after resetting it

Definition

queueDetailsCell(table cell)

Arguments

tablecellThe cell to be added to the cache

Code

function InGameMenuStatisticsFrame:queueDetailsCell(cell)
local cache = self.detailsCache[cell.name]
cache[#cache + 1 ] = cell

self.attributesLayout:removeElement(cell)

cell:unlinkElement()
end