Back to Home

ESO Lua File v101050

ingame/returningplayer/returningplayerintroscreen_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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
ZO_ReturningPlayerIntroScreen_Shared = ZO_DeferredInitializingObject:Subclass()
function ZO_ReturningPlayerIntroScreen_Shared:Initialize(control, scene)
    self.control = control
    ZO_DeferredInitializingObject.Initialize(self, scene)
    self.fragment = ZO_FadeSceneFragment:New(control)
    scene:AddFragment(self.fragment)
    scene:SetHideSceneConfirmationCallback(function(...) self:OnConfirmHideScene(...) end)
end
function ZO_ReturningPlayerIntroScreen_Shared:OnDeferredInitialize()
    self.headerLabel = self.control:GetNamedChild("HeaderText")
    local headerText = zo_strformat(SI_RETURNING_PLAYER_HEADER, GetUnitDisplayName("player"))
    self.headerLabel:SetText(headerText)
    self.bodyTextLabel = self.control:GetNamedChild("BodyText")
    local activityName = GetIntroGameplayExperienceDisplayName()
    local bodyText = zo_strformat(SI_RETURNING_PLAYER_INTRO_BODY, activityName)
    self.bodyTextLabel:SetText(bodyText)
    local infoContainer = self.control:GetNamedChild("GameplayInfo")
    self.gameplayTitleLabel = infoContainer:GetNamedChild("Title")
    self.gameplayDescriptionLabel = infoContainer:GetNamedChild("Description")
    self.rewardContainer = infoContainer:GetNamedChild("Rewards")
    local titleText = zo_strformat(SI_INTRO_GAMEPLAY_EXPERIENCE_NAME_FORMATTER, activityName)
    self.gameplayTitleLabel:SetText(titleText)
    local descriptionText = GetIntroGameplayExperienceDescription()
    self.gameplayDescriptionLabel:SetText(descriptionText)
    local function CloseScreenCallback()
        SYSTEMS:ShowScene("returningPlayerRewards")
    end
    self.closeKeybindButton = self.control:GetNamedChild("Close")
    self.closeKeybindDescriptor =
    {
        name = GetString(SI_DIALOG_EXIT),
        keybind = "UI_SHORTCUT_EXIT",
        ethereal = true,
        narrateEthereal = true,
        etherealNarrationOrder = 2,
        callback = CloseScreenCallback,
    }
    self.closeKeybindButton:SetKeybindButtonDescriptor(self.closeKeybindDescriptor)
    self.primaryKeybindButton = self.control:GetNamedChild("Primary")
    local function ShouldShowPrimaryKeybind()
        return self:ShouldShowPrimaryKeybind()
    end
    self.primaryKeybindDescriptor =
    {
        name = function()
            return self:GetPrimaryKeybindName()
        end,
        keybind = "UI_SHORTCUT_PRIMARY",
        ethereal = true,
        etherealNarrationOrder = 1,
        callback = function()
            self:OnPrimaryKeyPressed()
        end,
        visible = ShouldShowPrimaryKeybind,
    }
    self.primaryKeybindButton:SetKeybindButtonDescriptor(self.primaryKeybindDescriptor)
    local backKeybindDescriptor = KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(CloseScreenCallback)
    backKeybindDescriptor.ethereal = true
    backKeybindDescriptor.narrateEthereal = false
    self.keybindStripDescriptor =
    {
        self.closeKeybindDescriptor,
        self.primaryKeybindDescriptor,
        backKeybindDescriptor,
    }
end
function ZO_ReturningPlayerIntroScreen_Shared:UpdateKeybinds()
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_ReturningPlayerIntroScreen_Shared:UpdateKeybindVisibility()
    self.primaryKeybindButton:UpdateVisibility()
end
function ZO_ReturningPlayerIntroScreen_Shared:OnShowing()
    KEYBIND_STRIP:RemoveDefaultExit()
end
function ZO_ReturningPlayerIntroScreen_Shared:OnShown()
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_ReturningPlayerIntroScreen_Shared:OnHiding()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_ReturningPlayerIntroScreen_Shared:OnHidden()
    KEYBIND_STRIP:RestoreDefaultExit()
end
function ZO_ReturningPlayerIntroScreen_Shared:OnConfirmHideScene(scene, nextSceneName, bypassHideSceneConfirmationReason)
    if bypassHideSceneConfirmationReason == nil and ShouldShowPromotionalEventPersonalCampaignLeaveIntroPrompt() then
        ZO_Dialogs_ShowPlatformDialog("CONFIRM_LEAVE_PERSONAL_CAMPAIGN_INTRO",
        {
            confirmCallback = function() scene:AcceptHideScene() end,
            declineCallback = function() scene:RejectHideScene() end,
        },
        {
            mainTextParams = 
            {
                PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetWhiteIntroGameplayDisplayName(),
                PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetColorizedCampaignDisplayName()
            },
        })
    else
        scene:AcceptHideScene()
    end
end
function ZO_ReturningPlayerIntroScreen_Shared:GetIntroCampaignRewards()
    local rewardData = PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetIntroCampaignRewardData()
    if rewardData then
        if rewardData:GetRewardType() == REWARD_ENTRY_TYPE_REWARD_LIST then
            local rewardId = rewardData:GetRewardId()
            local rewardListId = GetRewardListIdFromReward(rewardId)
            return REWARDS_MANAGER:GetAllRewardInfoForRewardList(rewardListId)
        else
            return { rewardData }
        end
    end
    return {}
end
function ZO_ReturningPlayerIntroScreen_Shared:RequestJumpToIntroGameplay()
end
ZO_ReturningPlayerIntroScreen_Shared:MUST_IMPLEMENT("InitializeGridList")
ZO_ReturningPlayerIntroScreen_Shared:MUST_IMPLEMENT("GetPrimaryKeybindName")
ZO_ReturningPlayerIntroScreen_Shared:MUST_IMPLEMENT("OnPrimaryKeyPressed")
ZO_ReturningPlayerIntroScreen_Shared:MUST_IMPLEMENT("ShouldShowPrimaryKeybind")
function ZO_ReturningPlayerIntroScreen_Shared:UpdateGridList()
    self.rewardGridList:ClearGridList()
    local rewards = self:GetIntroCampaignRewards()
    for index, reward in ipairs(rewards) do
        local rewardEntry = ZO_GridSquareEntryData_Shared:New(reward)
        self.rewardGridList:AddEntry(rewardEntry)
    end
    self.rewardGridList:CommitGridList()
end
function ZO_ReturningPlayerIntroScreen_Shared.RewardGridEntrySetup(control, data, selected)
    control.data = data
    if data:GetQuantity() > 1 then
        local quantity = data:GetAbbreviatedQuantity()
        control.quantityLabel:SetText(quantity)
        control.quantityLabel:SetHidden(false)
    else
        control.quantityLabel:SetHidden(true)
    end
end