37 lines
1.2 KiB
Lua
37 lines
1.2 KiB
Lua
local FrameCell = class("FrameCell", BaseCell)
|
|
|
|
function FrameCell:init()
|
|
self.uiMap = self:getUIMap()
|
|
|
|
self.imgFrame = self.uiMap["frame_cell.img_frame"]
|
|
self.lock = self.uiMap["frame_cell.lock"]
|
|
self.use = self.uiMap["frame_cell.use"]
|
|
self.txUse = self.uiMap["frame_cell.use.tx_use"]
|
|
self.select = self.uiMap["frame_cell.select"]
|
|
|
|
self.txUse:setText(I18N:getGlobalText(I18N.GlobalConst.ON_USING_DESC))
|
|
|
|
self:addClickListener(function()
|
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.PLAYER_INFO_CLICK_FRAME, self.id)
|
|
end)
|
|
end
|
|
|
|
function FrameCell:refresh(id, isSelect)
|
|
self.id = id
|
|
|
|
-- 红点
|
|
if DataManager.PlayerData:isNewFrame(self.id) then
|
|
self.baseObject:addRedPoint(45, 45, 1)
|
|
else
|
|
self.baseObject:removeRedPoint()
|
|
end
|
|
|
|
self.select:setActive(isSelect)
|
|
local iconId = DataManager.PlayerData:getFrameIconId(self.id)
|
|
self.imgFrame:setSprite(GConst.ATLAS_PATH.ICON_AVATAR, iconId)
|
|
self.lock:setSprite(GConst.ATLAS_PATH.ICON_AVATAR, iconId)
|
|
self.lock:setActive(not DataManager.PlayerData:isFrameUnlock(self.id))
|
|
self.use:setActive(DataManager.PlayerData:getUsingFrameId() == self.id)
|
|
end
|
|
|
|
return FrameCell |