Back to Home

ESO Lua File v101044

ingame/contacts/displayname.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local PLAYER_STATUS
local PlayerStatusManager = ZO_InitializingObject:Subclass()
function PlayerStatusManager:Initialize(control)
    self.control = control
    local comboBoxControl = control:GetNamedChild("Status")
    self.comboBox = ZO_ComboBox_ObjectFromContainer(comboBoxControl)
    self.comboBox:SetSortsItems(false)
    self.comboBox:SetDropdownFont("ZoFontHeader")
    self.comboBox:SetSpacing(8)
    self.selectedItem = comboBoxControl:GetNamedChild("SelectedItem")
    control:GetNamedChild("DisplayName"):SetText(GetDisplayName())
    self.OnStatusChanged = function(_, entryText, entry)
        self:SetSelectedStatus(entry.status)
        SelectPlayerStatus(entry.status)
    end
    for i = 1, GetNumPlayerStatuses() do
        local statusTexture = ZO_GetPlayerStatusIcon(i)
        local statusName = GetString("SI_PLAYERSTATUS", i)
        local entryText = zo_iconTextFormat(statusTexture, 32, 32, statusName)
        local entry = self.comboBox:CreateItemEntry(entryText, self.OnStatusChanged)
        entry.status = i
        self.comboBox:AddItem(entry)
    end
    local status = GetPlayerStatus()
    control:RegisterForEvent(EVENT_PLAYER_STATUS_CHANGED, function(_, oldStatus, newStatus) self:OnPlayerStatusChanged(oldStatus, newStatus) end)
end
function PlayerStatusManager:SetSelectedStatus(status)
    self.status = status
    local statusTexture = ZO_GetPlayerStatusIcon(status)
    self.selectedItem:SetNormalTexture(statusTexture)
    self.selectedItem:SetPressedTexture(statusTexture)
end
--Events
function PlayerStatusManager:OnPlayerStatusChanged(oldStatus, newStatus)
    self:SetSelectedStatus(newStatus)
end
function PlayerStatusManager:Status_OnMouseEnter(control)
    InitializeTooltip(InformationTooltip, control, RIGHT, 0, 0)
    SetTooltipText(InformationTooltip, zo_strformat(SI_PLAYER_STATUS_TOOLTIP, GetString("SI_PLAYERSTATUS", self.status)))
end
function PlayerStatusManager:Status_OnMouseExit()
    ClearTooltip(InformationTooltip)
end
--Global XML
    PLAYER_STATUS:Status_OnMouseEnter(control)
end
    PLAYER_STATUS:Status_OnMouseExit()
end
    PLAYER_STATUS = PlayerStatusManager:New(control)
end