5e0d58cfad
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
40 lines
1.4 KiB
Lua
40 lines
1.4 KiB
Lua
local NoteListBtnCtrl = class("NoteListBtnCtrl", BaseCtrl)
|
|
NoteListBtnCtrl._mapNodeConfig = {
|
|
btnItem = {
|
|
sComponentName = "UIButton",
|
|
callback = "OnBtnClick_Item"
|
|
},
|
|
imgNoteIcon = {sComponentName = "Image"},
|
|
imgIconMask = {sComponentName = "Image"},
|
|
txtNoteName = {sComponentName = "TMP_Text"},
|
|
imgChoose = {},
|
|
txtLv = {sComponentName = "TMP_Text"},
|
|
txtNotHave = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "StarTower_Depot_Potential_Lock"
|
|
}
|
|
}
|
|
NoteListBtnCtrl._mapEventConfig = {
|
|
SelectNoteListBtn = "OnEvent_SelectNoteListBtn"
|
|
}
|
|
function NoteListBtnCtrl:SetItem(noteCfg, nLv)
|
|
self.nNoteId = noteCfg.Id
|
|
self.nLv = nLv
|
|
self:SetPngSprite(self._mapNode.imgNoteIcon, noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
|
self:SetPngSprite(self._mapNode.imgIconMask, noteCfg.Icon .. AllEnum.DiscSkillIconSurfix.Small)
|
|
NovaAPI.SetTMPText(self._mapNode.txtNoteName, noteCfg.Name)
|
|
NovaAPI.SetTMPText(self._mapNode.txtLv, "Lv." .. nLv)
|
|
if nLv <= 0 then
|
|
self._mapNode.imgIconMask.gameObject:SetActive(true)
|
|
self._mapNode.txtLv.gameObject:SetActive(false)
|
|
self._mapNode.txtNotHave.gameObject:SetActive(true)
|
|
end
|
|
end
|
|
function NoteListBtnCtrl:OnEvent_SelectNoteListBtn(nNoteId, _)
|
|
self._mapNode.imgChoose.gameObject:SetActive(self.nNoteId == nNoteId)
|
|
end
|
|
function NoteListBtnCtrl:OnBtnClick_Item()
|
|
EventManager.Hit("SelectNoteListBtn", self.nNoteId, self.nLv)
|
|
end
|
|
return NoteListBtnCtrl
|