ESO Lua File v100015

ingame/zo_loot/keyboard/loothistory_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
ZO_KEYBOARD_LOOT_HISTORY_ENTRY_SPACING_Y = -1
local KEYBOARD_LOOT_HISTORY_ENTRY_TEMPLATE = "ZO_LootHistory_KeyboardEntry"
local ZO_LootHistory_Keyboard = ZO_LootHistory_Shared:Subclass()
function ZO_LootHistory_Keyboard:New(...)
    return ZO_LootHistory_Shared.New(self, ...)
end
function ZO_LootHistory_Keyboard:Initialize(control)
    ZO_LootHistory_Shared.Initialize(self, control)
end
function ZO_LootHistory_Keyboard:InitializeFragment()
    KEYBOARD_LOOT_HISTORY_FRAGMENT = ZO_HUDFadeSceneFragment:New(ZO_LootHistoryControl_Keyboard)
    KEYBOARD_LOOT_HISTORY_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWN then
            self:DisplayLootQueue()
        elseif newState == SCENE_FRAGMENT_HIDING then
            self:HideLootQueue()
        end
    end)
    SCENE_MANAGER:GetScene("loot"):AddFragment(KEYBOARD_LOOT_HISTORY_FRAGMENT)
end
function ZO_LootHistory_Keyboard:InitializeFadingControlBuffer(control)
    local HORIZ_OFFSET = 0
    local VERTICAL_OFFSET = -84
    local MAX_ENTRIES = 6
    local CONTAINER_SHOW_TIME_MS = self:GetContainerShowTime()
    local PERSISTENT_CONTAINER_SHOW_TIME_MS = self:GetPersistentContainerShowTime()
    local anchor = ZO_Anchor:New(BOTTOMRIGHT, GuiRoot, BOTTOMRIGHT, HORIZ_OFFSET, VERTICAL_OFFSET)
    self.lootStreamPersistent = self:CreateFadingStationaryControlBuffer(control:GetNamedChild("PersistentContainer"), "ZO_LootHistory_FadeShared", "ZO_LootHistory_IconEntranceShared", "ZO_LootHistory_ContainerFadeShared", anchor, MAX_ENTRIES, PERSISTENT_CONTAINER_SHOW_TIME_MS, "KeyboardPersistent")
    self.lootStream = self:CreateFadingStationaryControlBuffer(control:GetNamedChild("Container"), "ZO_LootHistory_FadeShared", "ZO_LootHistory_IconEntranceShared", "ZO_LootHistory_ContainerFadeShared", anchor, MAX_ENTRIES, CONTAINER_SHOW_TIME_MS, "Keyboard")
    self.lootStreamPersistent:SetAdditionalEntrySpacingY(ZO_KEYBOARD_LOOT_HISTORY_ENTRY_SPACING_Y)
    self.lootStream:SetAdditionalEntrySpacingY(ZO_KEYBOARD_LOOT_HISTORY_ENTRY_SPACING_Y)
end
function ZO_LootHistory_Keyboard:SetEntryTemplate()
    self.entryTemplate = KEYBOARD_LOOT_HISTORY_ENTRY_TEMPLATE
end
function ZO_LootHistory_Shared:CanShowItemsInHistory()
    local currentSceneName = SCENE_MANAGER:GetCurrentSceneName()
    return currentSceneName == "inventory" or currentSceneName == "interact" or LOOT_WINDOW.returnScene == "inventory"
end
function ZO_LootHistory_Keyboard:OnLootReceived(...)
    ZO_LootHistory_Shared.OnLootReceived(self, ...)
end
function ZO_LootHistory_Keyboard:OnGoldUpdate(...)
    ZO_LootHistory_Shared.OnGoldUpdate(self, ...)
end
function ZO_LootHistory_Keyboard:OnTelvarStoneUpdate(...)
    ZO_LootHistory_Shared.OnTelvarStoneUpdate(self, ...)
end
    LOOT_HISTORY_KEYBOARD = ZO_LootHistory_Keyboard:New(control)
    SYSTEMS:RegisterKeyboardObject(ZO_LOOT_HISTORY_NAME, LOOT_HISTORY_KEYBOARD)
end