ESO Lua File v100010

ingame/tutorial/uiinfoboxtutorial.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_UiInfoBoxTutorial = ZO_TutorialHandlerBase:Subclass()
function ZO_UiInfoBoxTutorial:Initialize()
    self:ClearAll()
        
    local dialog = ZO_TutorialDialog
    self.dialogPane = dialog:GetNamedChild("Pane")
    self.dialogScrollChild = self.dialogPane:GetNamedChild("ScrollChild")
    self.dialogDescription = self.dialogPane:GetNamedChild("Description")
    self.dialogInfo =
    {
        title = {},
        customControl = dialog,
        noChoiceCallback = function(dialog)
                           dialog.data.owner:RemoveTutorial(dialog.data.tutorialIndex)
                       end,
        buttons =
        {
            [1] =
            {
                control = dialog:GetNamedChild("Cancel"),
                text = SI_EXIT_BUTTON,
                keybind = "DIALOG_NEGATIVE",
                clickSound = SOUNDS.DIALOG_ACCEPT,
                callback =  function(dialog)
                                dialog.data.owner:RemoveTutorial(dialog.data.tutorialIndex)
                            end,
            },
        }
    }
    ZO_Dialogs_RegisterCustomDialog("UI_TUTORIAL", self.dialogInfo)
end
function ZO_UiInfoBoxTutorial:SuppressTutorials(suppress, reason)
    -- Suppression is disabled in ZO_UiInfoBoxTutorial
end
function ZO_UiInfoBoxTutorial:GetTutorialType()
    return TUTORIAL_TYPE_UI_INFO_BOX
end
--Additional spacing to account for the backdrop behind a key label if there's one in the last line or the first line
local KEY_LABEL_SPACING = 6
function ZO_UiInfoBoxTutorial:DisplayTutorial(tutorialIndex)
    local title, description = GetTutorialInfo(tutorialIndex)
    self.dialogInfo.title.text = title
    self.dialogDescription:SetText(description)
    local descriptionWidth, descriptionHeight = self.dialogDescription:GetTextDimensions()
    local contentHeight = descriptionHeight + KEY_LABEL_SPACING
    self.dialogPane:SetHeight(contentHeight)
    self.dialogScrollChild:SetHeight(contentHeight)
    ZO_Scroll_ResetToTop(self.dialogPane)
    ZO_Dialogs_ShowDialog("UI_TUTORIAL", { tutorialIndex = tutorialIndex, owner = self })
end
function ZO_UiInfoBoxTutorial:OnDisplayTutorial(tutorialIndex, priority)
    if not IsGameCameraActive() or SCENE_MANAGER:IsInUIMode() then
        ZO_TutorialHandlerBase.OnDisplayTutorial(self, tutorialIndex, priority)
    end
end
function ZO_UiInfoBoxTutorial:RemoveTutorial(tutorialIndex)
    if self:GetCurrentlyDisplayedTutorialIndex() == tutorialIndex then
        if not IsUnitInCombat("player") then
            SetTutorialSeen(tutorialIndex)
        end
        ZO_Dialogs_ReleaseDialog("UI_TUTORIAL")
    else
        self:RemoveFromQueue(self.queue, queuedTutorialIndex)
    end
end
function ZO_UiInfoBoxTutorial:ClearAll()
    self.queue = {}
end