16 lines
742 B
Lua
16 lines
742 B
Lua
local GridCell = class("GridCell", BaseCell)
|
|
|
|
function GridCell:refresh(gridEntity, func, curElement)
|
|
local atlas, icon = ModuleManager.BattleManager:getElementIcon(gridEntity:getElementType())
|
|
local uiMap = self:getUIMap()
|
|
if self.lastIcon ~= icon then
|
|
self.lastIcon = icon
|
|
uiMap["grid_cell.touch_node.ani_node.middle_bg"]:setSprite(atlas, icon)
|
|
end
|
|
|
|
uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func)
|
|
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(curElement and curElement ~= gridEntity:getElementType())
|
|
uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isCantFallType())
|
|
end
|
|
|
|
return GridCell |