Back to Home

ESO Lua File v101041

ingame/cutscene/cutscene.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
ZO_Cutscene = ZO_Object:Subclass()
function ZO_Cutscene:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_Cutscene:Initialize(control)
    self.control = control
    control:RegisterForEvent(EVENT_BEGIN_CUTSCENE, function() self:OnBeginCutscene() end)
    control:RegisterForEvent(EVENT_END_CUTSCENE, function() self:OnEndCutscene() end)
    control:RegisterForEvent(EVENT_PLAYER_ACTIVATED, function() self:OnPlayerActivated() end)
    control:RegisterForEvent(EVENT_PLAYER_DEACTIVATED, function() self:OnPlayerDeactivated() end)
    local function OnVideoPlaybackComplete()
        self:OnVideoPlaybackComplete()
    end
    control:RegisterForEvent(EVENT_VIDEO_PLAYBACK_COMPLETE, OnVideoPlaybackComplete)
    control:RegisterForEvent(EVENT_VIDEO_PLAYBACK_ERROR, OnVideoPlaybackComplete)
end
function ZO_Cutscene:OnPlayerActivated()
end
function ZO_Cutscene:OnPlayerDeactivated()
end
function ZO_Cutscene:OnBeginCutscene()
end
function ZO_Cutscene:RefreshCutscene()
    if IsCutsceneActive() then
        self.control:SetHidden(false)
        local videoDataId = GetActiveCutsceneVideoDataId()
        if videoDataId ~= 0 then
            local PLAY_IMMEDIATELY = true
            PlayVideoById(videoDataId, PLAY_IMMEDIATELY, VIDEO_SKIP_MODE_REQUIRE_CONFIRMATION_FOR_SKIP)
            SCENE_MANAGER:SetInUIMode(true)
        else
            RequestEndCutscene()
        end
    else
        self.control:SetHidden(true)
    end
end
function ZO_Cutscene:OnVideoPlaybackComplete()
    if IsCutsceneActive() then
        RequestEndCutscene()
    end
end
function ZO_Cutscene:OnEndCutscene()
end
--Global XML
    CUTSCENE = ZO_Cutscene:New(control)
end