95 lines
2.4 KiB
Lua
95 lines
2.4 KiB
Lua
local uiCtrl = require_ex('UI/Panels/Base/UICtrl')
|
|
local PANEL_ID = PanelId.ActivityRewardRegistrationPopup
|
|
local PHASE_ID = PhaseId.CheckInCBT3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl = HL.Class('ActivityRewardRegistrationPopupCtrl', uiCtrl.UICtrl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.s_messages = HL.StaticField(HL.Table) << {
|
|
[MessageConst.ON_LOGIN_RESUME] = "OnResume",
|
|
[MessageConst.ON_ACTIVITY_UPDATED] = '_OnActivityUpdated',
|
|
}
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.m_genCellFunc = HL.Field(HL.Function)
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.m_activityId = HL.Field(HL.String) << ''
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.m_closeCallBack = HL.Field(HL.Function)
|
|
|
|
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.OnCreate = HL.Override(HL.Any) << function(self, args)
|
|
self.m_closeCallBack = args and args.closeCallback
|
|
self.view.btnClose.onClick:AddListener(function()
|
|
self:_Close()
|
|
end)
|
|
self.view.autoCloseButtonUp.onClick:AddListener(function()
|
|
self:_Close()
|
|
end)
|
|
self.view.autoCloseButtonDown.onClick:AddListener(function()
|
|
self:_Close()
|
|
end)
|
|
self.m_activityId = self.view.config.ACTIVITY_ID
|
|
self.view.activityRewardRegistrationInfo:InitActivityRewardRegistrationInfo({
|
|
activityId = self.m_activityId,
|
|
isPopup = true,
|
|
animation = self.view.rewardStateNode,
|
|
})
|
|
self.view.controllerHintPlaceholder:InitControllerHintPlaceholder({self.view.inputGroup.groupId})
|
|
end
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl.OnResume = HL.Method(HL.String) << function(loginStepKey)
|
|
if loginStepKey ~= LoginCheckConst.LOGIN_CHECK_STEP_KEY.CHECK_IN then
|
|
return
|
|
end
|
|
if not PhaseManager:IsPhaseRepeated(PHASE_ID) then
|
|
PhaseManager:OpenPhaseFast(PHASE_ID)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl._Close = HL.Method() << function(self)
|
|
if self.m_closeCallBack then
|
|
self.m_closeCallBack()
|
|
end
|
|
PhaseManager:PopPhase(PHASE_ID)
|
|
end
|
|
|
|
|
|
|
|
|
|
ActivityRewardRegistrationPopupCtrl._OnActivityUpdated = HL.Method(HL.Any) << function(self, arg)
|
|
local id = unpack(arg)
|
|
if id ~= self.m_activityId then
|
|
return
|
|
end
|
|
local activity = GameInstance.player.activitySystem:GetActivity(id)
|
|
if not activity then
|
|
Notify(MessageConst.SHOW_TOAST,Language.LUA_ACTIVITY_FORBIDDEN)
|
|
self:_Close()
|
|
end
|
|
end
|
|
|
|
HL.Commit(ActivityRewardRegistrationPopupCtrl) |