召唤卡牌

This commit is contained in:
puxuan 2025-08-29 16:20:31 +08:00
parent 8d4d25974b
commit 3d55c77fe3
3 changed files with 24 additions and 20 deletions

View File

@ -4,14 +4,15 @@ local SummonRewardCell = class("SummonRewardCell", BaseCell)
function SummonRewardCell:init()
local uiMap = self:getUIMap()
self.animator = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
self.imgIcon = uiMap["summon_reward_cell.bg.img_icon"]
self.txName = uiMap["summon_reward_cell.bg.tx_name"]
self.txCount = uiMap["summon_reward_cell.bg.tx_count"]
self.imgIcon = uiMap["summon_reward_cell.bg1.img_icon"]
self.txName = uiMap["summon_reward_cell.bg1.tx_name"]
self.txCount = uiMap["summon_reward_cell.bg1.tx_count"]
self.bg = uiMap["summon_reward_cell.bg"]
self.bg1 = uiMap["summon_reward_cell.bg1"]
self.effectQlts = {}
self.effectQlts[2] = uiMap["summon_reward_cell.bg.vfx_b13_chouka_lan_b01"]
self.effectQlts[3] = uiMap["summon_reward_cell.bg.vfx_b13_chouka_zi_b01"]
self.effectQlts[4] = uiMap["summon_reward_cell.bg.vfx_b13_chouka_cheng_b01"]
self.effectQlts[2] = uiMap["summon_reward_cell.bg1.vfx_b13_chouka_lan_b01"]
self.effectQlts[3] = uiMap["summon_reward_cell.bg1.vfx_b13_chouka_zi_b01"]
self.effectQlts[4] = uiMap["summon_reward_cell.bg1.vfx_b13_chouka_cheng_b01"]
end
function SummonRewardCell:getEffectQlts()
return self.effectQlts
@ -27,8 +28,10 @@ function SummonRewardCell:refresh(reward, index, parentUI)
local cfg = DataManager.HeroData:getHeroConfig(reward.item.id)
self.imgIcon:setSprite(GConst.ATLAS_PATH.ICON_HERO_SUMMON, tostring(cfg.icon))
self.bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_card_" .. cfg.qlt)
self.bg1:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_card_" .. cfg.qlt)
self.txName:setText(ModuleManager.HeroManager:getHeroName(reward.item.id))
self.txCount:setText("x" .. reward.item.count)
self:getBaseObject():setActive(true)
self.animator:SetTrigger("t_open")
self.baseObject:performWithDelayGlobal(function()
self:playEffect(cfg.qlt)

View File

@ -366,7 +366,7 @@ function SummonMainUI:onSummon(count, isAd)
ModuleManager.SummonManager:onForceSummonReq(count, 1, self.page)
else
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
if freeCount > 0 then
if freeCount > 0 and count == 1 then
ModuleManager.SummonManager:onForceSummonReq(count, 2, self.page)
return
end

View File

@ -25,17 +25,17 @@ end
function SummonRewardUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
self.btnGet = uiMap["summon_reward_ui.bg.target_node.bottom_bg.btn_get"]
self.btnGet = uiMap["summon_reward_ui.bg.btn_get"]
self.btnGet:addClickListener(function()
self:closeUI()
end)
self.goOne = uiMap["summon_reward_ui.one"]
self.rewardOneCell = uiMap["summon_reward_ui.one.summon_reward_cell"]:addLuaComponent(REWARD_CELL)
self.goOne = uiMap["summon_reward_ui.bg.one"]
self.rewardOneCell = uiMap["summon_reward_ui.bg.one.cell_node.summon_reward_cell"]:addLuaComponent(REWARD_CELL)
self:setCellEffectOrder(self.rewardOneCell )
self.goTen = uiMap["summon_reward_ui.ten"]
self.goTen = uiMap["summon_reward_ui.bg.ten"]
self.rewardTenCells = {}
for i = 1, 10 do
local cell = uiMap["summon_reward_ui.ten.summon_reward_cell_" .. i]:addLuaComponent(REWARD_CELL)
local cell = uiMap["summon_reward_ui.bg.ten.cell_node_" .. i .. ".summon_reward_cell"]:addLuaComponent(REWARD_CELL)
table.insert(self.rewardTenCells, cell)
self:setCellEffectOrder(cell)
end
@ -51,15 +51,15 @@ function SummonRewardUI:onLoadRootComplete()
end,
0.98, 0.3)
self.btnSummonTen = uiMap["summon_reward_ui.btn_summon_ten"]
self.txTen = uiMap["summon_reward_ui.btn_summon_ten.text"]
self.txNumTen = uiMap["summon_reward_ui.btn_summon_ten.cost.tx_num_ten"]
self.imgSummonTenIcon = uiMap["summon_reward_ui.btn_summon_ten.cost.img_icon_1"]
self.btnSummonTen = uiMap["summon_reward_ui.bg.btn_summon_ten"]
self.txTen = uiMap["summon_reward_ui.bg.btn_summon_ten.tx_desc_ten"]
self.txNumTen = uiMap["summon_reward_ui.bg.btn_summon_ten.cost.tx_num_ten"]
self.imgSummonTenIcon = uiMap["summon_reward_ui.bg.btn_summon_ten.cost.img_icon_1"]
self.btnSummonOne = uiMap["summon_reward_ui.btn_summon_one"]
self.txOne = uiMap["summon_reward_ui.btn_summon_one.text"]
self.txNumOne = uiMap["summon_reward_ui.btn_summon_one.cost.tx_num_one"]
self.imgSummonOneIcon = uiMap["summon_reward_ui.btn_summon_one.cost.img_icon_1"]
self.btnSummonOne = uiMap["summon_reward_ui.bg.btn_summon_one"]
self.txOne = uiMap["summon_reward_ui.bg.btn_summon_one.tx_desc_one"]
self.txNumOne = uiMap["summon_reward_ui.bg.btn_summon_one.cost.tx_num_one"]
self.imgSummonOneIcon = uiMap["summon_reward_ui.bg.btn_summon_one.cost.img_icon_1"]
self.btnSummonFree = uiMap["summon_reward_ui.bg.btn_summon_free"]
self.btnSummonFreeTx = uiMap["summon_reward_ui.bg.btn_summon_free.text_free"]
self.btnSummonAd = uiMap["summon_reward_ui.bg.btn_summon_ad"]
@ -197,6 +197,7 @@ function SummonRewardUI:onRefresh()
if qlt == 4 or qlt == 5 then
offsetTime = offsetTime + 1
end
self.rewardTenCells[i]:getBaseObject():setActive(false)
self:performWithDelayGlobal(function()
self.rewardTenCells[i]:refresh(self.rewards[i], i == 3 or i == 7, self)
if qlt == 4 or qlt == 5 then