Back to Home

ESO Lua File v100019

ingameshared/marketcurrency/keyboard/marketcurrency_keyboard.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ZO_MarketCurrency_Keyboard = ZO_MarketCurrency_Shared:Subclass()
function ZO_MarketCurrency_Keyboard:New(...)
    return ZO_MarketCurrency_Shared.New(self,...)
end
function ZO_MarketCurrency_Keyboard:Initialize(control)
    ZO_MarketCurrency_Shared.Initialize(self, control)
    
    MARKET_CURRENCY_KEYBOARD_FRAGMENT = ZO_FadeSceneFragment:New(control)
end
function ZO_MarketCurrency_Keyboard:InitializeControls()
    local currencyContainer = self.control:GetNamedChild("Container")
    self.crownsContainer = currencyContainer:GetNamedChild("Crowns")
    self.crownsCurrencyLabel = self.crownsContainer:GetNamedChild("CurrencyValue")
    local crownsContainerWidth = self.crownsContainer:GetWidth()
    local crownsNameWidth = self.crownsContainer:GetNamedChild("CurrencyName"):GetWidth()
    self.crownsCurrencyLabel:SetWidth(crownsContainerWidth - crownsNameWidth)
    self.gemsContainer = currencyContainer:GetNamedChild("Gems")
    self.gemsCurrencyLabel = self.gemsContainer:GetNamedChild("CurrencyValue")
    local gemsContainerWidth = self.gemsContainer:GetWidth()
    local gemsNameWidth = self.gemsContainer:GetNamedChild("CurrencyName"):GetWidth()
    self.gemsCurrencyLabel:SetWidth(gemsContainerWidth - gemsNameWidth)
end
do
    local CURRENCY_ICON_SIZE = "100%"
    function ZO_MarketCurrency_Keyboard:OnCrownsUpdated(currentCurrency, difference)
        local crownsIcon = ZO_Currency_GetPlatformFormattedCurrencyIcon(ZO_Currency_MarketCurrencyToUICurrency(MKCT_CROWNS), CURRENCY_ICON_SIZE)
        local currencyString = zo_strformat(SI_CURRENCY_AMOUNT_WITH_ICON, ZO_CommaDelimitNumber(currentCurrency), crownsIcon)
        self.crownsCurrencyLabel:SetText(currencyString)
    end
    function ZO_MarketCurrency_Keyboard:OnCrownGemsUpdated(currentCurrency, difference)
        local gemsIcon = ZO_Currency_GetPlatformFormattedCurrencyIcon(ZO_Currency_MarketCurrencyToUICurrency(MKCT_CROWN_GEMS), CURRENCY_ICON_SIZE)
        local currencyString = zo_strformat(SI_CURRENCY_AMOUNT_WITH_ICON, ZO_CommaDelimitNumber(currentCurrency), gemsIcon)
        self.gemsCurrencyLabel:SetText(currencyString)
    end
end
function ZO_MarketCurrency_Keyboard:OnMouseEnterCurrencyLabel(control, currencyType)
    InitializeTooltip(InformationTooltip, control, BOTTOM, 0, -2)
    local currencyTooltip
    if currencyType == MKCT_CROWNS then
        currencyTooltip = GetString(SI_MARKET_CROWNS_TOOLTIP)
    elseif currencyType == MKCT_CROWN_GEMS then
        currencyTooltip = GetString(SI_MARKET_CROWN_GEMS_TOOLTIP)
    end
    SetTooltipText(InformationTooltip, currencyTooltip)
end
function ZO_MarketCurrency_Keyboard:OnMouseExitCurrencyLabel(control)
    ClearTooltip(InformationTooltip)
end
function ZO_MarketCurrency_Keyboard:SetBuyCrownsCallback(callback)
end
function ZO_MarketCurrency_Keyboard:OnBuyCrownsClicked(control)
    if self.customBuyCrownsCallback then
        self.customBuyCrownsCallback()
    else
        ShowBuyCrownsDialog()
    end
end
-- XML Handlers
    MARKET_CURRENCY_KEYBOARD = ZO_MarketCurrency_Keyboard:New(control)
end
    MARKET_CURRENCY_KEYBOARD:OnMouseEnterCurrencyLabel(...)
end
   MARKET_CURRENCY_KEYBOARD:OnMouseExitCurrencyLabel(...)
end
    MARKET_CURRENCY_KEYBOARD:OnBuyCrownsClicked(...)
end