PGRData/Script/matrix/xui/xuisclassconstructwelfare/XUiSClassConstructWelfare.lua
2024-09-01 22:49:41 +02:00

60 lines
No EOL
2 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 自选S级构造体礼包界面
-- 该类其实不是签到类型只是因为服务端改动过于繁琐强行加在signin表了。客户端做特殊处理,实际上是另一个类型
local XUiSClassConstructWelfare = XClass(nil, "XUiSClassConstructWelfare")
function XUiSClassConstructWelfare:Ctor(ui, rootUi)
self.GameObject = ui.gameObject
self.Transform = ui.transform
self.RootUi = rootUi
XTool.InitUiObject(self)
self:InitButton()
end
function XUiSClassConstructWelfare:InitButton()
XUiHelper.RegisterClickEvent(self, self.BtnGet, self.OnBtnGetClick)
XUiHelper.RegisterClickEvent(self, self.BtnHelp, self.OnBtnHelpClick)
end
function XUiSClassConstructWelfare:Refresh(signId)
self.SignId = signId
XEventManager.DispatchEvent(XEventId.EVENT_SING_IN_OPEN_BTN, true)
local grid = XUiGridCommon.New(self.RootUi, self.GridCommon)
local sItemId = 94008
grid:Refresh({TemplateId = sItemId})
end
function XUiSClassConstructWelfare:OnBtnGetClick()
-- 如果已经领取过了 不能再领
if not XDataCenter.SignInManager.IsShowSignIn(self.SignId, true) then
XUiManager.TipError(CS.XTextManager.GetText("CanNotClaimRewardsRepeatedly"))
return
end
XDataCenter.SignInManager.SignInRequest(self.SignId, function (rewardGoodsList)
self.BtnGet:SetDisable(true)
XUiManager.OpenUiObtain(rewardGoodsList, nil, function ()
if self.RootUi and self.RootUi.OnBtnCloseClick then
self.RootUi:OnBtnCloseClick()
end
if self.RootUi and self.RootUi.RefreshRightView then
self.RootUi:RefreshRightView()
end
end)
end)
end
function XUiSClassConstructWelfare:OnBtnHelpClick()
local signInInfos = XSignInConfigs.GetSignInInfos(self.SignId)
XUiManager.UiFubenDialogTip("", signInInfos[1].Description or "")
end
function XUiSClassConstructWelfare:OnHide()
end
function XUiSClassConstructWelfare:OnShow()
end
return XUiSClassConstructWelfare