加一个大卡片信息
This commit is contained in:
parent
f268d99606
commit
d5bedb659a
67
lua/app/ui/common/cell/large_hero_cell.lua
Normal file
67
lua/app/ui/common/cell/large_hero_cell.lua
Normal file
@ -0,0 +1,67 @@
|
||||
local LargeHeroCell = class("LargeHeroCell", BaseCell)
|
||||
|
||||
function LargeHeroCell:init()
|
||||
local uiMap = self.baseObject:genAllChildren()
|
||||
self.icon = uiMap["hero_cell.hero_bg.icon"]
|
||||
self.heroBg = uiMap["hero_cell.hero_bg"]
|
||||
self.check = uiMap["hero_cell.hero_bg.mask"]
|
||||
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
|
||||
self.isGray = false
|
||||
|
||||
uiMap["large_hero_cell.hero_bg.info_btn"]:addClickListener(function()
|
||||
if self.clickCallback1 then
|
||||
self.clickCallback1()
|
||||
end
|
||||
end)
|
||||
|
||||
uiMap["large_hero_cell.hero_bg.use_btn"]:addClickListener(function()
|
||||
if self.clickCallback1 then
|
||||
self.clickCallback1()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function LargeHeroCell:refresh(heroEntity, isGray)
|
||||
local heroInfo = heroEntity:getConfig()
|
||||
self:_refresh(heroInfo, isGray)
|
||||
end
|
||||
|
||||
function LargeHeroCell:refreshWithCfgId(id, isGray)
|
||||
local heroInfo = ConfigManager:getConfig("hero")[id]
|
||||
self:_refresh(heroInfo, isGray)
|
||||
end
|
||||
|
||||
function LargeHeroCell:_refresh(heroInfo, isGray)
|
||||
if isGray then
|
||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_GRAY_QLT[heroInfo.qlt])
|
||||
else
|
||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_FRAME_QLT[heroInfo.qlt])
|
||||
end
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, tostring(heroInfo.icon))
|
||||
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
||||
self.check:setVisible(false)
|
||||
self:setGray(isGray)
|
||||
end
|
||||
|
||||
function LargeHeroCell:showCheck(visible)
|
||||
self.check:setVisible(visible)
|
||||
end
|
||||
|
||||
function LargeHeroCell:addClickListener(btn1Callback, btn2Callback)
|
||||
self.clickCallback1 = btn1Callback
|
||||
self.clickCallback2 = btn2Callback
|
||||
end
|
||||
|
||||
function LargeHeroCell:setVisible(visible)
|
||||
self.baseObject:setVisible(visible)
|
||||
end
|
||||
|
||||
function LargeHeroCell:setGray(isGray)
|
||||
if self.isGray == isGray then
|
||||
return
|
||||
end
|
||||
self.icon:setImageGray(isGray)
|
||||
self.matchImg:setImageGray(isGray)
|
||||
end
|
||||
|
||||
return LargeHeroCell
|
||||
10
lua/app/ui/common/cell/large_hero_cell.lua.meta
Normal file
10
lua/app/ui/common/cell/large_hero_cell.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee14cc3908f42fb44b2d72271bf4cb01
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
Loading…
x
Reference in New Issue
Block a user