Back to Home

ESO Lua File v100028

ingame/alerttext/keyboard/alerttext_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
local DEFAULT_KEYBOARD_ALERT_TEMPLATE = "ZO_AlertLine"
local ZO_AlertText_Keyboard = ZO_AlertText_Base:Subclass()
function ZO_AlertText_Keyboard:New(...)
    return ZO_AlertText_Base.New(self, ...)
end
function ZO_AlertText_Keyboard:InternalPerformAlert(category, soundId, message)
     local color = self:GetAlertColor(category)
    local alertData = {
        lines = {
            {text = message, category = category, color = color, soundId = soundId}
        }
    }
    self.alerts:AddEntry(DEFAULT_KEYBOARD_ALERT_TEMPLATE, alertData)
end
local function OnScriptAccessViolation(eventCode, functionName)
     ZO_Dialogs_ShowDialog("SCRIPT_ACCESS_VIOLATION", nil, {mainTextParams = {functionName}})
end
local function SetupFunction(control, data)
    control:SetWidth(GuiRoot:GetRight() - ZO_Compass:GetRight() - 40)
    ZO_SoundAlert(data.category, data.soundId)
end
function ZO_AlertText_Keyboard:Initialize(control)
    ZO_AlertText_Base.Initialize(self)
    control:RegisterForEvent(EVENT_SCRIPT_ACCESS_VIOLATION, OnScriptAccessViolation)
    local MAX_DISPLAYED_ENTRIES_KEYBOARD = 3
    self.alerts = ZO_FadingControlBuffer:New(control, MAX_DISPLAYED_ENTRIES_KEYBOARD, nil, nil, "AlertFade", "AlertTranslate", ZO_Anchor:New(TOPRIGHT, GuiRoot))
    self.alerts:AddTemplate(DEFAULT_KEYBOARD_ALERT_TEMPLATE, {setup = SetupFunction})
end
    ALERT_MESSAGES = ZO_AlertText_Keyboard:New(control)
end