Back to Home

ESO Lua File v101038

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
ZO_MapLocations_Shared = ZO_InitializingObject:Subclass()
function ZO_MapLocations_Shared:Initialize(control)
    self.control = control
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", function()
        self:UpdateSelectedMap()
    end)
    local function UpdateForModeChange(modeData)
        self:SetListDisabled(not WORLD_MAP_MANAGER:IsMapChangingAllowed())
    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_InitializingObject:Subclass()
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, zoneIndex, description = GetMapInfoByIndex(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