64 lines
2.2 KiB
Lua
64 lines
2.2 KiB
Lua
|
local XUiPanelTrialTips = XClass(nil, "XUiPanelTrialTips")
|
||
|
|
||
|
function XUiPanelTrialTips:Ctor(ui)
|
||
|
self.GameObject = ui.gameObject
|
||
|
self.Transform = ui.transform
|
||
|
XTool.InitUiObject(self)
|
||
|
self:InitAutoScript()
|
||
|
end
|
||
|
|
||
|
function XUiPanelTrialTips:SetTrialType(trialtype)
|
||
|
if trialtype == XDataCenter.TrialManager.TrialTypeCfg.TrialFor then
|
||
|
self.ImgFor.gameObject:SetActive(true)
|
||
|
self.ImgBackEnd.gameObject:SetActive(false)
|
||
|
self.ImgBackEnd2.gameObject:SetActive(false)
|
||
|
elseif trialtype == XDataCenter.TrialManager.TrialTypeCfg.TrialBackEnd then
|
||
|
self.ImgFor.gameObject:SetActive(false)
|
||
|
self.ImgBackEnd.gameObject:SetActive(true)
|
||
|
self.ImgBackEnd2.gameObject:SetActive(false)
|
||
|
else
|
||
|
self.ImgFor.gameObject:SetActive(false)
|
||
|
self.ImgBackEnd.gameObject:SetActive(false)
|
||
|
self.ImgBackEnd2.gameObject:SetActive(true)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- auto
|
||
|
-- Automatic generation of code, forbid to edit
|
||
|
function XUiPanelTrialTips:InitAutoScript()
|
||
|
self:AutoInitUi()
|
||
|
self:AutoAddListener()
|
||
|
end
|
||
|
|
||
|
function XUiPanelTrialTips:AutoInitUi()
|
||
|
-- self.ImgFor = self.Transform:Find("ImgFor"):GetComponent("Image")
|
||
|
-- self.ImgForIcon = self.Transform:Find("ImgFor/ImgForIcon"):GetComponent("Image")
|
||
|
-- self.ImgBackEnd = self.Transform:Find("ImgBackEnd"):GetComponent("Image")
|
||
|
-- self.ImgBackEndIcon = self.Transform:Find("ImgBackEnd/ImgBackEndIcon"):GetComponent("Image")
|
||
|
-- self.ImgBackEnd2 = self.Transform:Find("ImgBackEnd2"):GetComponent("Image")
|
||
|
-- self.ImgForIconA = self.Transform:Find("ImgBackEnd2/ImgForIcon"):GetComponent("Image")
|
||
|
end
|
||
|
|
||
|
function XUiPanelTrialTips:RegisterClickEvent(uiNode, func)
|
||
|
if func == nil then
|
||
|
XLog.Error("XUiPanelTrialTips:RegisterClickEvent函数出错, 原因:点击回调函数不能为空")
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if type(func) ~= "function" then
|
||
|
XLog.Error("XUiPanelTrialTips:RegisterClickEvent函数错误, 参数func需要是function类型, func的类型是" .. type(func))
|
||
|
end
|
||
|
|
||
|
local listener = function(...)
|
||
|
func(self, ...)
|
||
|
end
|
||
|
|
||
|
CsXUiHelper.RegisterClickEvent(uiNode, listener)
|
||
|
end
|
||
|
|
||
|
function XUiPanelTrialTips:AutoAddListener()
|
||
|
end
|
||
|
-- auto
|
||
|
|
||
|
return XUiPanelTrialTips
|