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 indexs = {}
local typeList = {} local typeList = {}
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do 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 local weight = ((map[typeNum] or 0) + 1) * BattleConst.ELEMENT_WIGHT
if weight > BattleConst.MAX_ELEMENT_WIGHT then if weight > BattleConst.MAX_ELEMENT_WIGHT then
weight = BattleConst.MAX_ELEMENT_WIGHT weight = BattleConst.MAX_ELEMENT_WIGHT

View File

@ -2,31 +2,22 @@ local RewardCell = class("RewardCell", BaseCell)
function RewardCell:init() function RewardCell:init()
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
self.icon = uiMap["reward_cell.bg.icon"] self.icon = uiMap["reward_cell.item_bg.icon"]
self.frameBg = uiMap["reward_cell.bg.frame_bg"] self.frameBg = uiMap["reward_cell.item_bg"]
self.partBg = uiMap["reward_cell.bg.part_bg"] self.mask = uiMap["reward_cell.item_bg.mask"]
self.frame = uiMap["reward_cell.bg.frame"] self.check = uiMap["reward_cell.check"]
self.mask = uiMap["reward_cell.bg.mask"] self.numTx = uiMap["reward_cell.item_bg.num"]
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()
end end
function RewardCell:refresh(reward) function RewardCell:refresh(reward)
self:showMask(false, false) self:showMask(false, false)
-- self:showLock(false)
local id local id
if reward.type == GConst.REWARD_TYPE.ITEM then if reward.type == GConst.REWARD_TYPE.ITEM then
self:_refreshItem(reward.item) self:_refreshItem(reward.item)
id = reward.item.id id = reward.item.id
elseif reward.type == GConst.REWARD_TYPE.EQUIP then -- elseif reward.type == GConst.REWARD_TYPE.EQUIP then
self:_refreshEquip(reward.equip) -- self:_refreshEquip(reward.equip)
id = reward.equip.id -- id = reward.equip.id
elseif reward.type == GConst.REWARD_TYPE.LEGACY then
self:_refreshLegacy(reward.legacy)
id = reward.legacy.id
end end
if id then if id then
@ -38,18 +29,14 @@ end
function RewardCell:refreshByConfig(reward, mask, check) function RewardCell:refreshByConfig(reward, mask, check)
self:showMask(mask, check) self:showMask(mask, check)
-- self:showCheck(false) self:showCheck(false)
-- self:showLock(false)
local id local id
if reward.type == GConst.REWARD_TYPE.ITEM then if reward.type == GConst.REWARD_TYPE.ITEM then
self:_refreshItem(reward) self:_refreshItem(reward)
id = reward.id id = reward.id
elseif reward.type == GConst.REWARD_TYPE.EQUIP then elseif reward.type == GConst.REWARD_TYPE.EQUIP then
self:_refreshEquip(reward) -- self:_refreshEquip(reward)
id = reward.id -- id = reward.id
elseif reward.type == GConst.REWARD_TYPE.LEGACY then
self:_refreshLegacy(reward)
id = reward.id
end end
if id then if id then
@ -65,15 +52,10 @@ function RewardCell:_refreshItem(item)
return return
end end
self.partBg:setVisible(false)
self.numTx:setVisible(true) self.numTx:setVisible(true)
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0") self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
if info.type == 6 then self.numTx:setText(item.count)
self.numTx:setText(BigNumOpt.bigNum2Num(item.count))
else
self.numTx:setText(BigNumOpt.bigNum2Str(item.count))
end
end end
function RewardCell:_refreshEquip(equip) function RewardCell:_refreshEquip(equip)
@ -82,40 +64,16 @@ function RewardCell:_refreshEquip(equip)
return return
end end
self.partBg:setVisible(true)
self.numTx:setVisible(true) self.numTx:setVisible(true)
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. info.qlt) self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. info.qlt)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(info.icon)) self.icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(info.icon))
self.partBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "type_" .. info.qlt) self.numTx:setText(equip.count)
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
end end
function RewardCell:showNumTx(str) function RewardCell:showNumTx(str)
self.numTx:setText(str) self.numTx:setText(str)
end 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) function RewardCell:showNumTx(value)
self.numTx:setText(value) self.numTx:setText(value)
end end
@ -125,29 +83,6 @@ function RewardCell:showMask(show, syncCheck)
self:showCheck(syncCheck) self:showCheck(syncCheck)
end 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() function RewardCell:hideCountTx()
end end
@ -155,10 +90,6 @@ function RewardCell:showCheck(show)
self.check:setVisible(show == true) self.check:setVisible(show == true)
end end
function RewardCell:showLock(show)
self.lock:setVisible(show == true)
end
function RewardCell:setVisible(visible) function RewardCell:setVisible(visible)
self.baseObject:setActive(visible) self.baseObject:setActive(visible)
end end