local GridCell = class("GridCell", BaseCell) function GridCell:refresh(gridEntity, 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.ani_node.mask"]:setVisible(curElement and curElement ~= gridEntity:getElementType()) uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isCantFallType()) --- 测试代码 uiMap["grid_cell.touch_node.ani_node.count"]:setText(gridEntity:getAroundEliminationCount()) end function GridCell:addTouchListener(func) local uiMap = self:getUIMap() uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func) end return GridCell