reward显示

This commit is contained in:
xiekaidong 2023-04-12 21:46:16 +08:00
parent eb17b324c4
commit f268d99606
2 changed files with 14 additions and 83 deletions

View File

@ -755,7 +755,7 @@ function BattleController:getRandomGridInfo()
local indexs = {}
local typeList = {}
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
if not self:getSealElementType()[typeNum] then
if not self:getSealElementType()[typeNum] and self.battleData:getSkillEntityByElement(typeNum) then
local weight = ((map[typeNum] or 0) + 1) * BattleConst.ELEMENT_WIGHT
if weight > BattleConst.MAX_ELEMENT_WIGHT then
weight = BattleConst.MAX_ELEMENT_WIGHT

View File

@ -2,31 +2,22 @@ local RewardCell = class("RewardCell", BaseCell)
function RewardCell:init()
local uiMap = self:getUIMap()
self.icon = uiMap["reward_cell.bg.icon"]
self.frameBg = uiMap["reward_cell.bg.frame_bg"]
self.partBg = uiMap["reward_cell.bg.part_bg"]
self.frame = uiMap["reward_cell.bg.frame"]
self.mask = uiMap["reward_cell.bg.mask"]
self.check = uiMap["reward_cell.bg.check"]
self.partIcon = uiMap["reward_cell.bg.part_bg.icon"]
self.numTx = uiMap["reward_cell.bg.num_tx"]
self:hideFrameAnimation()
self.icon = uiMap["reward_cell.item_bg.icon"]
self.frameBg = uiMap["reward_cell.item_bg"]
self.mask = uiMap["reward_cell.item_bg.mask"]
self.check = uiMap["reward_cell.check"]
self.numTx = uiMap["reward_cell.item_bg.num"]
end
function RewardCell:refresh(reward)
self:showMask(false, false)
-- self:showLock(false)
local id
if reward.type == GConst.REWARD_TYPE.ITEM then
self:_refreshItem(reward.item)
id = reward.item.id
elseif reward.type == GConst.REWARD_TYPE.EQUIP then
self:_refreshEquip(reward.equip)
id = reward.equip.id
elseif reward.type == GConst.REWARD_TYPE.LEGACY then
self:_refreshLegacy(reward.legacy)
id = reward.legacy.id
-- elseif reward.type == GConst.REWARD_TYPE.EQUIP then
-- self:_refreshEquip(reward.equip)
-- id = reward.equip.id
end
if id then
@ -38,18 +29,14 @@ end
function RewardCell:refreshByConfig(reward, mask, check)
self:showMask(mask, check)
-- self:showCheck(false)
-- self:showLock(false)
self:showCheck(false)
local id
if reward.type == GConst.REWARD_TYPE.ITEM then
self:_refreshItem(reward)
id = reward.id
elseif reward.type == GConst.REWARD_TYPE.EQUIP then
self:_refreshEquip(reward)
id = reward.id
elseif reward.type == GConst.REWARD_TYPE.LEGACY then
self:_refreshLegacy(reward)
id = reward.id
-- self:_refreshEquip(reward)
-- id = reward.id
end
if id then
@ -65,15 +52,10 @@ function RewardCell:_refreshItem(item)
return
end
self.partBg:setVisible(false)
self.numTx:setVisible(true)
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
if info.type == 6 then
self.numTx:setText(BigNumOpt.bigNum2Num(item.count))
else
self.numTx:setText(BigNumOpt.bigNum2Str(item.count))
end
self.numTx:setText(item.count)
end
function RewardCell:_refreshEquip(equip)
@ -82,40 +64,16 @@ function RewardCell:_refreshEquip(equip)
return
end
self.partBg:setVisible(true)
self.numTx:setVisible(true)
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. info.qlt)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(info.icon))
self.partBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "type_" .. info.qlt)
self.partIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "e" .. info.part)
if type(equip.count) == "table" then
self.numTx:setText(BigNumOpt.bigNum2Str(equip.count))
else
self.numTx:setText(equip.count)
end
self.numTx:setText(equip.count)
end
function RewardCell:showNumTx(str)
self.numTx:setText(str)
end
function RewardCell:_refreshLegacy(legacy)
local info = ConfigManager:getConfig("legacy")[legacy.id]
if info == nil then
return
end
self.partBg:setVisible(false)
self.numTx:setVisible(true)
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_LEGACY, "frame_" .. info.qlt)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_LEGACY, tostring(info.icon))
if type(legacy.count) == "table" then
self.numTx:setText(BigNumOpt.bigNum2Str(legacy.count))
else
self.numTx:setText(legacy.count)
end
end
function RewardCell:showNumTx(value)
self.numTx:setText(value)
end
@ -125,29 +83,6 @@ function RewardCell:showMask(show, syncCheck)
self:showCheck(syncCheck)
end
function RewardCell:showFrameAnimation(rewardType)
self.frame:setVisible(true)
self.frame:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR).enabled = true
if rewardType == GConst.REWARD_TYPE.EQUIP then
if self.frameAniType ~= rewardType then
-- CS.UnityEngine.Animator.StringToHash("frame_reward_equip") 结果是-540830890
-- self.frame:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR):Play(-540830890, -1, 0)
self.frameAniType = rewardType
end
else
if self.frameAniType ~= GConst.REWARD_TYPE.ITEM then
-- CS.UnityEngine.Animator.StringToHash("frame_reward") 结果是997722489
-- self.frame:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR):Play(997722489, -1, 0)
self.frameAniType = GConst.REWARD_TYPE.ITEM
end
end
end
function RewardCell:hideFrameAnimation()
self.frame:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR).enabled = false
self.frame:setVisible(false)
end
function RewardCell:hideCountTx()
end
@ -155,10 +90,6 @@ function RewardCell:showCheck(show)
self.check:setVisible(show == true)
end
function RewardCell:showLock(show)
self.lock:setVisible(show == true)
end
function RewardCell:setVisible(visible)
self.baseObject:setActive(visible)
end