Back to Home

ESO Lua File v100019

ingame/map/worldmaplocations_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
69
70
71
72
73
74
75
76
77
78
79
80
81
ZO_MapLocations_Shared = ZO_Object:Subclass()
function ZO_MapLocations_Shared:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_MapLocations_Shared:Initialize(control)
    self.control = control
    self:InitializeList(control)
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", function()
        self:UpdateSelectedMap()
    end)
    self:UpdateSelectedMap()
    self:BuildLocationList()
    local function UpdateForModeChange(modeData)
    end
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapModeChanged", UpdateForModeChange)
end
function ZO_MapLocations_Shared:InitializeList()
    -- Stub
end
function ZO_MapLocations_Shared:UpdateSelectedMap()
    -- Stub
end
function ZO_MapLocations_Shared:BuildLocationList()
    -- Stub
end
function ZO_MapLocations_Shared:GetDisabled()
    return self.listDisabled
end
-- Singleton shared data
ZO_MapLocationsData_Singleton = ZO_Object:Subclass()
function ZO_MapLocationsData_Singleton:New(...)
    local object = ZO_Object.New(self)
    return object
end
function ZO_MapLocationsData_Singleton:GetLocationList()
    if not self.mapData then
        self:RefreshLocationList()
    end
    return self.mapData
end
function ZO_MapLocationsData_Singleton:RefreshLocationList()
    local mapData = {}
    for i = 1, GetNumMaps() do
        local mapName, mapType, mapContentType, zoneId, description = GetMapInfo(i)
        mapData[#mapData + 1] = { locationName = ZO_CachedStrFormat(SI_ZONE_NAME, mapName), description = description, index = i }
    end
    table.sort(mapData, function(a,b)
        return a.locationName < b.locationName
    end)
    self.mapData = mapData
end
    if not WORLD_MAP_LOCATIONS_DATA then
        WORLD_MAP_LOCATIONS_DATA = ZO_MapLocationsData_Singleton:New(control)
    end
    return WORLD_MAP_LOCATIONS_DATA
end