Back to Home

ESO Lua File v100036

pregame/console/downloadbar/downloadbar.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
local TOTAL_DOWNLOAD_PERCENT = 100
local SCENE_TABLE =
{
    GAME_STARTUP_MAIN_GAMEPAD_SCENE,
}
local DownloadBar_Gamepad = ZO_CallbackObject:Subclass()
function DownloadBar_Gamepad:New(control)
    local object = ZO_CallbackObject.New(self)
    object:Initialize(control)
    return object
end
function DownloadBar_Gamepad:Initialize(control)
    self.control = control
    self.bar = control:GetNamedChild("BarContainer")
    self.label = control:GetNamedChild("PercentLabel")
    GAMEPAD_DOWNLOAD_BAR_FRAGMENT = ZO_FadeSceneFragment:New(ZO_DownloadBar_Gamepad)
    -- Now determine if this needs to be shown
    if(IsGateInstalled("BaseGame")) then
        self.completed = true
    else
        self.completed = false
        for i,scene in ipairs(SCENE_TABLE) do
            scene:AddFragment(GAMEPAD_DOWNLOAD_BAR_FRAGMENT)
        end
    end
end
function DownloadBar_Gamepad:Update()
    if(not self.completed) then
        local progress = GetInstallationProgress()
        if(progress) then
            self:UpdateDownloadPercent(progress)
        end
    end
end
function DownloadBar_Gamepad:UpdateDownloadPercent(downloadPercent)
    if(downloadPercent >= TOTAL_DOWNLOAD_PERCENT and IsGateInstalled("BaseGame")) then
        self.completed = true
        for i,scene in ipairs(SCENE_TABLE) do
            scene:RemoveFragment(GAMEPAD_DOWNLOAD_BAR_FRAGMENT)
        end
        self:FireCallbacks("DownloadComplete")
    else
        self.currentDownload = downloadPercent
        ZO_StatusBar_SmoothTransition(self.bar, downloadPercent, TOTAL_DOWNLOAD_PERCENT)
        self.label:SetText(downloadPercent .."%")
    end
end
    GAMEPAD_DOWNLOAD_BAR = DownloadBar_Gamepad:New(self)
end
    GAMEPAD_DOWNLOAD_BAR:Update()    
end