forked from endernon/PGRData
60 lines
1.8 KiB
Lua
60 lines
1.8 KiB
Lua
local XUiPanelRewardTips = XClass(nil, "XUiPanelRewardTips")
|
|
|
|
function XUiPanelRewardTips:Ctor(ui,parent,stageId)
|
|
self.GameObject = ui.gameObject
|
|
self.Transform = ui.transform
|
|
self.Parent = parent
|
|
self.StageId = stageId
|
|
self:InitAutoScript()
|
|
self:Refresh()
|
|
end
|
|
|
|
function XUiPanelRewardTips:Refresh()
|
|
local stageCfg = XDataCenter.FubenManager.GetstageCfg(self.StageId)
|
|
local rewardTipId = stageCfg.RewardTipId
|
|
local rewardTipIcon, rewardTipQuality = self:GetIconById(rewardTipId)
|
|
if rewardTipIcon then
|
|
self.RImgIcon:SetRawImage(rewardTipIcon)
|
|
XUiHelper.SetQualityIcon(self.Parent, self.ImgQuality, rewardTipQuality)
|
|
end
|
|
end
|
|
|
|
function XUiPanelRewardTips:GetIconById(id)
|
|
if not id or id == 0 then return nil end
|
|
return XGoodsCommonManager.GetGoodsIcon(id), XGoodsCommonManager.GetGoodsDefaultQuality(id)
|
|
end
|
|
|
|
-- auto
|
|
-- Automatic generation of code, forbid to edit
|
|
function XUiPanelRewardTips:InitAutoScript()
|
|
self:AutoInitUi()
|
|
self:AutoAddListener()
|
|
end
|
|
|
|
function XUiPanelRewardTips:AutoInitUi()
|
|
self.RImgIcon = self.Transform:Find("RImgIcon"):GetComponent("RawImage")
|
|
self.ImgQuality = self.Transform:Find("ImgQuality"):GetComponent("Image")
|
|
end
|
|
|
|
function XUiPanelRewardTips:RegisterClickEvent(uiNode, func)
|
|
if func == nil then
|
|
XLog.Error("XUiPanelRewardTips:RegisterClickEvent函数错误, 参数func不能为空")
|
|
return
|
|
end
|
|
|
|
if type(func) ~= "function" then
|
|
XLog.Error("XUiPanelRewardTips:RegisterClickEvent函数错误, 参数func需要是function类型, func的类型是" .. type(func))
|
|
end
|
|
|
|
local listener = function(...)
|
|
func(self, ...)
|
|
end
|
|
|
|
CsXUiHelper.RegisterClickEvent(uiNode, listener)
|
|
end
|
|
|
|
function XUiPanelRewardTips:AutoAddListener()
|
|
end
|
|
-- auto
|
|
|
|
return XUiPanelRewardTips
|