11 local FONT_TITLE = UIFont.Title
13 local TITLE_HEIGHT =
getTextManager():MeasureStringY(FONT_TITLE, TITLE_TEXT)
14 local TITLE_PADDING_TOP = 50
15 local TITLE_PADDING_BOTTOM = 50
19 ISPanel.initialise(
self)
20 self.charactersByFaction = {}
22 self.titleLabel = ISLabel:
new(TITLE_X, TITLE_Y, TITLE_HEIGHT, TITLE_TEXT, 1, 1, 1, 1, FONT_TITLE,
true)
23 self.titleLabel:initialise()
30 local
yOffset =
self.titleLabel:getY() +
self.titleLabel:getHeight() + TITLE_PADDING_BOTTOM
31 local REFRESH_TEXT_HEIGHT =
getTextManager():MeasureStringY(
FrameworkZ.UserInterfaces.ButtonTheme.hugeButtonFontSize,
"Refresh")
38 self.playerListPanel.onMouseWheel = function(self2, del)
39 self2:setYScroll(self2:getYScroll() - del * 16)
44 self:setStencilRect(self2:getX(), self2:getY(), self2:getWidth(), self2:getHeight())
50 self2:clearStencilRect()
53 self.playerListPanel:initialise()
54 self.playerListPanel:instantiate()
55 self:updatePlayerList()
56 self.playerListPanel:setScrollHeight(
self.bottomDescription:getBottom() + 50) -- Not the best implementation with
self.bottomDescription but it works
57 self.playerListPanel:addScrollBars()
58 self.playerListPanel:setScrollChildren(true)
68 self.charactersByFaction = {}
69 local players = getOnlinePlayers()
71 for
i = 0, players:size() - 1 do
72 local
username = players:get(
i):getUsername()
76 local
faction = character:GetFaction() or "Unaffiliated"
83 table.insert(
self.charactersByFaction[
faction], {name = name, description = description, username = username})
87 self:populatePlayerList()
91 if
self.character:RecognizesCharacter(character) or
self.character == character then
92 return character:GetName(), character:GetDescription()
94 return "Unknown", "Description Hidden"
99 local FONT_BUTTON = UIFont.Title
100 local FONT_FACTION = UIFont.Title
101 local FONT_NAME = UIFont.Large
102 local FONT_DESCRIPTION = UIFont.Medium
107 self.playerListPanel:clearChildren()
109 for
faction, players in pairs(
self.charactersByFaction) do
110 local factionLabel = ISLabel:new(10,
yOffset, 20,
faction, 1, 0.84, 0, 1, FONT_FACTION, true)
111 factionLabel:initialise()
112 self.playerListPanel:addChild(factionLabel)
116 for _,
player in ipairs(players) do
119 local truncatedDescription =
#player.description > 52 and string.sub(player.description, 1, 52) .. "..." or player.description
123 characterButton.internal =
"INFO" --
player.username
124 characterButton.font = FONT_BUTTON
126 characterButton:initialise()
127 self.playerListPanel:addChild(characterButton)
129 local xPadding = characterButton:getWidth() + xMargin * 2
131 local characterLabel = ISLabel:new(xPadding,
yOffset, nameHeight,
player.
name, 1, 1, 1, 1, FONT_NAME, true)
132 characterLabel:initialise()
133 self.playerListPanel:addChild(characterLabel)
135 self.bottomDescription = ISLabel:new(xPadding,
yOffset + nameHeight,
descriptionHeight, truncatedDescription, 0.75, 0.75, 0.75, 1, FONT_DESCRIPTION, true) -- Not the best implementation with
self.bottomDescription but it works
136 self.bottomDescription:initialise()
137 self.playerListPanel:addChild(
self.bottomDescription)
148 print(
"Opening Character Info")
149 elseif button.
internal ==
"REFRESH" then
155 self:setVisible(false)
156 self:removeFromUIManager()
173 setmetatable(o,
self)
176 o.borderColor = {r=0, g=0, b=0,
a=0}
void local descriptionHeight()
void self FrameworkZ UI self nil
void processingNotification backgroundColor a()
void FrameworkZ UI TabPanel()
void self playerListPanel render()
void self refreshButton internal()
void local PANEL_MARGIN_Y()
void local PANEL_MARGIN_X()
void FrameworkZ UI TabSession()
void local PANEL_HEIGHT()
void self refreshButton()
void self playerListPanel prerender()
void button backgroundColor()
Characters module for FrameworkZ. Defines and interacts with CHARACTER object.
Players module for FrameworkZ. Defines and interacts with PLAYER object.
void getCharacterInfo(character)
void onClickButton(button, x, y)
void onClose(button, x, y)
void populatePlayerList()
Contains all of the User Interfaces for FrameworkZ.