c1_lua/lua/app/ui/battle/cell/grid_cell.lua
xiekaidong ccdd6a778b 棋盘
2023-04-06 10:38:04 +08:00

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