Back to Home

ESO Lua File v101050

ingame/lowlevelplayer/lowlevelplayerscreen_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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
ZO_LowLevelPlayerScreen_Shared = ZO_DeferredInitializingObject:Subclass()
function ZO_LowLevelPlayerScreen_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_LowLevelPlayerScreen_Shared:OnDeferredInitialize()
    self.headerLabel = self.control:GetNamedChild("HeaderText")
    local headerText = zo_strformat(SI_LOW_LEVEL_PLAYER_HEADER, GetUnitDisplayName("player"))
    self.headerLabel:SetText(headerText)
    self.bodyTextLabel = self.control:GetNamedChild("BodyText")
    local campaignNameText = PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetCampaignDisplayName()
    local promotionalEventNameText = PROMOTIONAL_EVENT_MANAGER:GetPromotionalEventsColorizedDisplayName()
    local bodyText = zo_strformat(SI_LOW_LEVEL_PLAYER_BODY, campaignNameText, promotionalEventNameText)
    self.bodyTextLabel:SetText(bodyText)
    local infoContainer = self.control:GetNamedChild("GameplayInfo")
    self.gameplayBackgroundTexture = infoContainer:GetNamedChild("Background")
    self.gameplayTitleLabel = infoContainer:GetNamedChild("Title")
    self.gameplayTimeRemainingLabel = infoContainer:GetNamedChild("TimeRemaining")
    self.gameplayDescriptionLabel = infoContainer:GetNamedChild("Description")
    self.rewardContainer = infoContainer:GetNamedChild("Rewards")
    local function CloseScreenCallback()
        SCENE_MANAGER:ShowBaseScene()
    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_LowLevelPlayerScreen_Shared:UpdateKeybinds()
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_LowLevelPlayerScreen_Shared:UpdateKeybindVisibility()
    self.primaryKeybindButton:UpdateVisibility()
end
function ZO_LowLevelPlayerScreen_Shared:OnShowing()
    KEYBIND_STRIP:RemoveDefaultExit()
    
    local backgroundTextureFile
    local titleText
    local descriptionText
    if PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:IsIntroCampaignComplete() or IsActiveWorldStarterWorld() then
        backgroundTextureFile = "EsoUI/Art/PromotionalEvent/lowLevelPlayer_Gameplay.dds"
        titleText = PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetCampaignDisplayName()
        descriptionText = PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetCampaignDescription()
    else
        backgroundTextureFile = "EsoUI/Art/ReturningPlayer/IntroBackground.dds"
        titleText = zo_strformat(SI_INTRO_GAMEPLAY_EXPERIENCE_NAME_FORMATTER, GetIntroGameplayExperienceDisplayName())
        descriptionText = GetIntroGameplayExperienceDescription()
    end
    self.gameplayBackgroundTexture:SetTexture(backgroundTextureFile)
    self.gameplayTitleLabel:SetText(titleText)
    local remainingTimeText = PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetCampaignRemainingTimeDisplayText()
    self.gameplayTimeRemainingLabel:SetText(remainingTimeText)
    self.gameplayDescriptionLabel:SetText(descriptionText)
    LOW_LEVEL_PLAYER_MANAGER:MarkRewardsAsSeen()
end
function ZO_LowLevelPlayerScreen_Shared:OnShown()
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_LowLevelPlayerScreen_Shared:OnHiding()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_LowLevelPlayerScreen_Shared:OnHidden()
    KEYBIND_STRIP:RestoreDefaultExit()
end
function ZO_LowLevelPlayerScreen_Shared:OnConfirmHideScene(scene, nextSceneName, bypassHideSceneConfirmationReason)
    if bypassHideSceneConfirmationReason == nil and not PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:IsIntroCampaignComplete() 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_LowLevelPlayerScreen_Shared:GetRewards()
    return PROMOTIONAL_EVENT_PERSONAL_CAMPAIGN_MANAGER:GetPrimaryRewards()
end
function ZO_LowLevelPlayerScreen_Shared:RequestJumpToIntroGameplay()
end
ZO_LowLevelPlayerScreen_Shared:MUST_IMPLEMENT("InitializeGridList")
ZO_LowLevelPlayerScreen_Shared:MUST_IMPLEMENT("GetPrimaryKeybindName")
ZO_LowLevelPlayerScreen_Shared:MUST_IMPLEMENT("OnPrimaryKeyPressed")
ZO_LowLevelPlayerScreen_Shared:MUST_IMPLEMENT("ShouldShowPrimaryKeybind")
function ZO_LowLevelPlayerScreen_Shared:UpdateGridList()
    self.rewardGridList:ClearGridList()
    local rewards = self:GetRewards()
    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_LowLevelPlayerScreen_Shared.RewardGridEntrySetup(control, data, selected)
    control.data = data
    if data:GetRewardType() == REWARD_ENTRY_TYPE_REWARD_LIST then
        local quantity = GetNumRewardListEntries(GetRewardListIdFromReward(data:GetRewardId()))
        local shouldHideQuantityLabel = not (quantity > 1)
        if not shouldHideQuantityLabel then
            quantity = zo_strformat(SI_PROMOTIONAL_EVENT_REWARD_LIST_QUANTITY_FORMATTER, quantity - 1)
            control.quantityLabel:SetText(quantity)
        end
        control.quantityLabel:SetHidden(shouldHideQuantityLabel)
    elseif data:GetQuantity() > 1 then
        local quantity = data:GetAbbreviatedQuantity()
        control.quantityLabel:SetText(quantity)
        control.quantityLabel:SetHidden(false)
    else
        control.quantityLabel:SetHidden(true)
    end
    local alpha = data.claimed and 0.4 or 1
    control.icon:SetAlpha(alpha)
    control.quantityLabel:SetAlpha(alpha)
    control.claimedMarkTexture:SetHidden(not data.claimed)
end