39 lines
2.2 KiB
Plaintext
39 lines
2.2 KiB
Plaintext
|
function axr_companions.UICompanionList:InitControls()
|
||
|
local xml = utils_xml.get_hud_xml()
|
||
|
|
||
|
self.dialog = xml:InitStatic("companion_list", self)
|
||
|
|
||
|
local scale = 1
|
||
|
local ratio = utils_xml.screen_ratio()
|
||
|
self.dialog:SetWndPos( vector2():set( 1024 - self.dialog:GetWidth() * ratio * scale , 0 ) )
|
||
|
|
||
|
self.companion_info = {}
|
||
|
for i=1,8 do
|
||
|
self.companion_info[i] = {}
|
||
|
self.companion_info[i].base = xml:InitStatic("companion_list:slot", self.dialog)
|
||
|
self.companion_info[i].background = xml:InitStatic("companion_list:slot:background", self.companion_info[i].base)
|
||
|
self.companion_info[i].icon = xml:InitStatic("companion_list:slot:icon", self.companion_info[i].base)
|
||
|
self.companion_info[i].danger_indicator = xml:InitStatic("companion_list:slot:danger_indicator", self.companion_info[i].base)
|
||
|
self.companion_info[i].team_role_shadow = xml:InitStatic("companion_list:slot:team_role", self.companion_info[i].base)
|
||
|
self.companion_info[i].team_role = xml:InitStatic("companion_list:slot:team_role", self.companion_info[i].base)
|
||
|
self.companion_info[i].distance_shadow = xml:InitTextWnd("companion_list:slot:distance", self.companion_info[i].base)
|
||
|
self.companion_info[i].distance = xml:InitTextWnd("companion_list:slot:distance", self.companion_info[i].base)
|
||
|
self.companion_info[i].prog_health = xml:InitProgressBar("companion_list:slot:health", self.companion_info[i].base)
|
||
|
|
||
|
for _,ele in pairs(self.companion_info[i]) do
|
||
|
local pos = ele:GetWndPos()
|
||
|
ele:SetWndPos( vector2():set( pos.x * ratio * scale , pos.y * scale ) )
|
||
|
|
||
|
local w, h = ele:GetWidth(), ele:GetHeight()
|
||
|
ele:SetWndSize( vector2():set( w * ratio * scale , h * scale ) )
|
||
|
end
|
||
|
|
||
|
local h = self.companion_info[i].background:GetHeight()
|
||
|
self.companion_info[i].distance:SetFont(GetFontSmall())
|
||
|
self.companion_info[i].base:SetWndPos( vector2():set( 0 , self.dialog:GetHeight() - i * (h+5) ) )
|
||
|
|
||
|
local pos = self.companion_info[i].team_role:GetWndPos()
|
||
|
self.companion_info[i].team_role_shadow:SetWndPos( vector2():set( pos.x + 1 * ratio * scale , pos.y + 1 * scale ) )
|
||
|
self.companion_info[i].team_role_shadow:SetTextureColor( GetARGB(255, 0, 0, 0) )
|
||
|
end
|
||
|
end
|