ESO Lua File v100010

ingame/campaign/campaigndataregistration.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
ZO_CampaignDataRegistration = ZO_Object:Subclass()
function ZO_CampaignDataRegistration:New(...)
    local registration = ZO_Object.New(self)
    registration:Initialize(...)
    return registration
end
function ZO_CampaignDataRegistration:Initialize(namespace, needsDataFunction)
    EVENT_MANAGER:RegisterForEvent(namespace, EVENT_PLAYER_ACTIVATED, function() self:OnPlayerActivated() end)
    EVENT_MANAGER:RegisterForEvent(namespace, EVENT_PLAYER_DEACTIVATED, function() self:OnPlayerDeactivated() end)
    self.needsData = false
    self:Refresh()
end
function ZO_CampaignDataRegistration:Refresh()
    local needsData = self.needsDataFunction()
    if(self.needsData ~= needsData) then
        self.needsData = needsData
        if(needsData) then
            RegisterForAssignedCampaignData()
        else
            UnregisterForAssignedCampaignData()
        end
    end
end
function ZO_CampaignDataRegistration:OnPlayerActivated()
    self:Refresh()
end
function ZO_CampaignDataRegistration:OnPlayerDeactivated()
    if(self.needsData) then
    end
    self.needsData = false    
end