Back to Home

ESO Lua File v100019

ingame/map/worldmaphouses_shared.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
ZO_MapHouses_Shared = ZO_Object:Subclass()
function ZO_MapHouses_Shared:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_MapHouses_Shared:Initialize(control)
    self.control = control
    self:InitializeList(control)
    self.fragment = ZO_FadeSceneFragment:New(control)
    self.fragment:RegisterCallback("StateChange",  function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            self:OnShowing()
        elseif newState == SCENE_FRAGMENT_HIDDEN then
            self:OnHidden()
        end
    end)
    local function UpdateForModeChange(modeData)
    end
    local function OnFastTravelNetworkUpdated()
        if self.fragment:IsShowing() then
            self:RefreshHouseList()
        end
    end
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapModeChanged", UpdateForModeChange)
    control:RegisterForEvent(EVENT_FAST_TRAVEL_NETWORK_UPDATED, OnFastTravelNetworkUpdated)
end
function ZO_MapHouses_Shared:InitializeList()
    -- To be overriden
end
function ZO_MapHouses_Shared:RefreshHouseList()
    WORLD_MAP_HOUSES_DATA:RefreshHouseList()
    local houseList = WORLD_MAP_HOUSES_DATA:GetHouseList()
    self.noHousesLabel:SetHidden(#houseList > 0)
end
function ZO_MapHouses_Shared:SetListEnabled(enabled)
    self.listEnabled = enabled
end
function ZO_MapHouses_Shared:IsListEnabled()
    return self.listEnabled
end
function ZO_MapHouses_Shared:GetFragment()
    return self.fragment
end
function ZO_MapHouses_Shared:SetNoHousesLabelControl(control)
    self.noHousesLabel = control
end
function ZO_MapHouses_Shared:OnShowing()
    self:RefreshHouseList()
end
function ZO_MapHouses_Shared:OnHidden()
    --To be overriden
end