99 lines
2.8 KiB
Lua
99 lines
2.8 KiB
Lua
local TurntableCell = class("TurntableCell", BaseCell)
|
|
|
|
function TurntableCell:init()
|
|
local uiMap = self:getUIMap()
|
|
self.reawrdBg = uiMap["turntable_cell.reward_bg"]
|
|
self.rewardCell = uiMap["turntable_cell.reward_bg.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
|
self.txBig = uiMap["turntable_cell.reward_bg.tx_big"]
|
|
self.selectEffect = uiMap["turntable_cell.effect_node.vfx_b10_ui_hhzp_b01"]
|
|
self.imgSelect = uiMap["turntable_cell.effect_node.img_select"]
|
|
self.itemEffect = uiMap["turntable_cell.reward_bg.vfx_b10_ui_xnzp_b02"]
|
|
|
|
if self.selectEffect == nil then
|
|
self.selectEffect = uiMap["turntable_cell.effect_node.vfx_b10_ui_mfzp_b01"]
|
|
end
|
|
if self.itemEffect == nil then
|
|
self.itemEffect = uiMap["turntable_cell.effect_node.vfx_b10_ui_mfzp_b02"]
|
|
end
|
|
end
|
|
|
|
function TurntableCell:refresh(parentUI, dataKey, id)
|
|
local data = DataManager[dataKey]
|
|
|
|
local uiOrder = parentUI:getUIOrder()
|
|
local cfgInfo = data:getTurntableCfg(id)
|
|
local isBig = cfgInfo.color_x == 1
|
|
local reward = cfgInfo.reward
|
|
|
|
-- 特殊处理
|
|
if dataKey == "ActSailingData" and self.selectEffect ~= nil then
|
|
self.bigEffect = self.selectEffect
|
|
self.selectEffect = nil
|
|
end
|
|
if dataKey == "ActValentineData" then
|
|
self.selectEffect = nil
|
|
end
|
|
|
|
if self.txBig then
|
|
if isBig then
|
|
self.txBig:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_MAGIC_DESC_17))
|
|
else
|
|
self.txBig:setText(GConst.EMPTY_STRING)
|
|
end
|
|
end
|
|
if self.bigEffect then
|
|
if isBig then
|
|
self.bigEffect:setActive(true)
|
|
self.bigEffect:play()
|
|
self.bigEffect:setSortingOrder(uiOrder, 10)
|
|
else
|
|
self.bigEffect:setActive(false)
|
|
end
|
|
end
|
|
|
|
self.rewardCell:refreshByConfig(reward)
|
|
|
|
-- 奖励摆正
|
|
local rotationZ = self:getBaseObject():getLocalEulerAnglesZ()
|
|
self.reawrdBg:setLocalEulerAnglesZ(-rotationZ)
|
|
|
|
-- 默认不选中
|
|
self:setSelectEffect(false)
|
|
self:setSelectFlowEffect(false)
|
|
self:setItemEffect(false)
|
|
end
|
|
|
|
function TurntableCell:setSelectEffect(isSelect, uiOrder)
|
|
if self.selectEffect then
|
|
if isSelect then
|
|
self.selectEffect:setActive(true)
|
|
self.selectEffect:play()
|
|
self.selectEffect:setSortingOrder(uiOrder, 10)
|
|
else
|
|
self.selectEffect:setActive(false)
|
|
end
|
|
end
|
|
|
|
if self.imgSelect then
|
|
if isSelect then
|
|
self.imgSelect:setActive(true)
|
|
self.imgSelect:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).overrideSorting = true
|
|
self.imgSelect:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).sortingOrder = uiOrder + 10
|
|
else
|
|
self.imgSelect:setActive(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
function TurntableCell:setSelectFlowEffect(isSelect, uiOrder)
|
|
end
|
|
|
|
function TurntableCell:setItemEffect(isSelect, uiOrder)
|
|
self.itemEffect:setActive(isSelect)
|
|
if isSelect then
|
|
self.itemEffect:play()
|
|
self.itemEffect:setSortingOrder(uiOrder, 13)
|
|
end
|
|
end
|
|
|
|
return TurntableCell |