diff --git a/lua/app/common/event_manager.lua b/lua/app/common/event_manager.lua index ecde0dc2..092347ef 100644 --- a/lua/app/common/event_manager.lua +++ b/lua/app/common/event_manager.lua @@ -31,6 +31,8 @@ EventManager.CUSTOM_EVENT = { UPDATE_MAIN_MALL_HEIGHT = "UPDATE_MAIN_MALL_HEIGHT", -- 更新主要商品的高度 GO_DAILY_CHALLENGE = "GO_DAILY_CHALLENGE", -- 跳转每日挑战 GO_CHAPTER = "GO_CHAPTER", -- 跳转主线章节 + CLOSE_BOX_HERO_UI = "CLOSE_BOX_HERO_UI", + CLOSE_BOX_OPEN_UI = "CLOSE_BOX_OPEN_UI", -- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN", -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" } diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index db0157af..a2e18102 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1408,14 +1408,15 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx) end function BattleUnitComp:judgeSkillEffectCondition(skill, index) - if not skill or skill:haveBuffCondition() then + if not skill or not skill:haveBuffCondition() then return true end - local buffConditionIndex, conditionRel = skill:getBuffConditionRel(index) - if not buffConditionIndex then + local rel = skill:getBuffConditionRel(index) + if not rel then return true end + local buffConditionIndex, conditionRel = rel[1], rel[2] local buffConditions = skill:getBuffCondition(buffConditionIndex) return BATTLE_SKILL_CONDITION_HANDLE.judgeSkillEffectCondition(buffConditions, conditionRel, self.battleController) @@ -1791,20 +1792,11 @@ function BattleUnitComp:getEffectAndPlay(fxInfo, isLoop) effectObj:setLocalPosition(0, 0, 0) end end - if fxInfo.follow_direction then - if self.side == BattleConst.SIDE_ATK then - if effectObj:getIsEulerAnglesFlip() then - effectObj:setLocalEulerAngles(0, 0, 0) - end - effectObj:setLocalScale(fxScale, fxScale, fxScale) - else - if effectObj:getIsEulerAnglesFlip() then - effectObj:setLocalEulerAngles(0, 180, 0) - effectObj:setLocalScale(fxScale, fxScale, fxScale) - else - effectObj:setLocalScale(-fxScale, fxScale, fxScale) - end + if fxInfo.flip then + if effectObj:getIsEulerAnglesFlip() then + effectObj:setLocalEulerAngles(0, 180, 0) end + effectObj:setLocalScale(fxScale, fxScale, fxScale) else if effectObj:getIsEulerAnglesFlip() then effectObj:setLocalEulerAngles(0, 0, 0) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 1079043d..60c35ba5 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1018,7 +1018,9 @@ function BattleController:calculateCurElimination(onlyCheck) local elementType = entity:getElementType() if not info.noAni and info.isIdle then if not info.isSkill then - elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1 + if not entity:isElmentTypeInvalid() then + elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1 + end if boomGridIds[info.posId] and boomGridIds[info.posId][GRID_BREAK_CONDITION.LINE] then lineCount = lineCount + 1 linkElementType = elementType diff --git a/lua/app/module/bounty/bounty_manager.lua b/lua/app/module/bounty/bounty_manager.lua index 9d63dea2..d04ecf86 100644 --- a/lua/app/module/bounty/bounty_manager.lua +++ b/lua/app/module/bounty/bounty_manager.lua @@ -20,7 +20,29 @@ end function BountyManager:onClaimReward(result) if result.err_code == GConst.ERROR_STR.SUCCESS then if result.rewards then - GFunc.showRewardBox(result.rewards) + -- 读表获取该层奖励 如果是箱子走单独奖励展示接口 + local isSpecialBox = false + local index = result.reqData.level + local isPro = result.reqData.is_pro + local info = DataManager.BountyData:getSeasonInfoByLevel(index) + local rewardType + local rewardId + if info then + local reward = isPro and info.reward_pro or info.reward + rewardType = reward and reward.type + rewardId = reward and reward.id + if rewardType == GConst.REWARD_TYPE.ITEM then + local itemCfgInfo = ConfigManager:getConfig("item")[rewardId] + if itemCfgInfo and itemCfgInfo.type == GConst.ItemConst.ITEM_TYPE.BOX then + isSpecialBox = true + end + end + end + if isSpecialBox then + ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY, params = rewardId, rewards = result.rewards}) + else + GFunc.showRewardBox(result.rewards) + end end if result.reqData.is_pro ~= nil then if result.reqData.is_pro then diff --git a/lua/app/module/item/item_const.lua b/lua/app/module/item/item_const.lua index 83a76b94..f5edc2f7 100644 --- a/lua/app/module/item/item_const.lua +++ b/lua/app/module/item/item_const.lua @@ -4,6 +4,10 @@ ItemConst.ITEM_ID_GOLD = 1 ItemConst.ITEM_ID_GEM = 2 ItemConst.ITEM_ID_VIT = 3 ItemConst.ITEM_ID_BOUNTY_EXP = 7 +ItemConst.ITEM_ID_BOX_LV_1 = 8 +ItemConst.ITEM_ID_BOX_LV_2 = 9 +ItemConst.ITEM_ID_BOX_LV_3 = 10 +ItemConst.ITEM_ID_BOX_LV_4 = 11 ItemConst.ITEM_ID_EXP = 12 ItemConst.ITEM_ID_BOX_KEY_LV_1 = 13 ItemConst.ITEM_ID_BOX_KEY_LV_2 = 14 diff --git a/lua/app/module/shop/shop_const.lua b/lua/app/module/shop/shop_const.lua index e1e2ef5e..fba495eb 100644 --- a/lua/app/module/shop/shop_const.lua +++ b/lua/app/module/shop/shop_const.lua @@ -10,6 +10,11 @@ ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也 [PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = true } +ShopConst.BOX_REWARD_TYPE = { + SUMMON = 1, + BOUNTY = 2, +} + ShopConst.GEM_ICON_NAME = { [1] = "shop_diamond_1", [2] = "shop_diamond_1", diff --git a/lua/app/module/shop/shop_manager.lua b/lua/app/module/shop/shop_manager.lua index 1ceb87d4..8ea48b6c 100644 --- a/lua/app/module/shop/shop_manager.lua +++ b/lua/app/module/shop/shop_manager.lua @@ -8,11 +8,12 @@ function ShopManager:showBoxLevelUI() UIManager:showUI("app/ui/shop/box_level_ui") end +-- 宝箱奖励开箱界面 type,params,rewards function ShopManager:showBoxOpenUI(params) UIManager:showUI("app/ui/shop/box_open_ui", params) end --- 商店宝箱奖励展示界面 +-- 宝箱奖励展示界面 function ShopManager:showBoxRewardUI(params) UIManager:showUI("app/ui/shop/box_reward_ui", params) end diff --git a/lua/app/module/summon/summon_manager.lua b/lua/app/module/summon/summon_manager.lua index 091759c6..710a7eb0 100644 --- a/lua/app/module/summon/summon_manager.lua +++ b/lua/app/module/summon/summon_manager.lua @@ -28,12 +28,10 @@ end function SummonManager:summonFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then - DataManager.SummonData:cacheSummonRewards(result.rewards) -- 缓存一下 防止有其他地方需要使用 DataManager.SummonData:init(result.summon_info) - if result.reqData then local summonType = result.reqData.type - ModuleManager.ShopManager:showBoxOpenUI({type = summonType}) + ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.SUMMON, params = summonType, rewards = result.rewards}) -- 任务 if summonType == GConst.SummonConst.SUMMON_TYPE.LV_1 then ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_OPEN_SHOP_BOX_LEVEL_1, 1) diff --git a/lua/app/ui/battle/battle_daily_challenge_buff_ui.lua b/lua/app/ui/battle/battle_daily_challenge_buff_ui.lua index cae11cea..9c814fa8 100644 --- a/lua/app/ui/battle/battle_daily_challenge_buff_ui.lua +++ b/lua/app/ui/battle/battle_daily_challenge_buff_ui.lua @@ -18,6 +18,13 @@ function BattleDailyChallengeBuffUI:ctor() end end +function BattleDailyChallengeBuffUI:onClose() + if self.txSeq then + self.txSeq:Kill() + self.txSeq = nil + end +end + function BattleDailyChallengeBuffUI:onLoadRootComplete() self:_display() self:_addListeners() @@ -32,6 +39,17 @@ function BattleDailyChallengeBuffUI:_display() for index, obj in ipairs(buffDescs) do obj:setText(self.buffDescs[index]) end + local txNode = uiMap["battle_daily_challenge_buff_ui.raw_img"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) + txNode.alpha = 0 + uiMap["battle_daily_challenge_buff_ui.ui_spine_obj"]:playAnim("idle", false, true) + + if self.txSeq then + self.txSeq:Kill() + self.txSeq = nil + end + self.txSeq = self.root:createBindTweenSequence() + self.txSeq:AppendInterval(0.2) + self.txSeq:Append(txNode:DOFade(1, 0.2)) end function BattleDailyChallengeBuffUI:_addListeners() diff --git a/lua/app/ui/shop/box_hero_ui.lua b/lua/app/ui/shop/box_hero_ui.lua index b7ca62ae..be7665cc 100644 --- a/lua/app/ui/shop/box_hero_ui.lua +++ b/lua/app/ui/shop/box_hero_ui.lua @@ -56,6 +56,11 @@ function BoxHeroUI:onLoadRootComplete() end) self:refresh() + + -- 奖励界面打开时 关闭此界面 + self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI, function() + self:closeUI() + end) end function BoxHeroUI:refresh() @@ -70,7 +75,7 @@ function BoxHeroUI:refresh() self.itemCellList[i]:setNum("") self.itemTextList[i]:setText(rewards[i].num) self.itemCellList[i]:addClickListener(function() - ModuleManager.TipsManager:showItemTips(rewards[i].id, self.itemCellList[i]:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(rewards[i].id, GConst.REWARD_TYPE.ITEM, self.itemCellList[i]:getBaseObject()) end) if ConfigManager:getConfig("item")[rewards[i].id].type == 3 then @@ -102,10 +107,8 @@ function BoxHeroUI:onClickSummon() local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType) if GFunc.checkCost(costItem.id, costItem.num, false) then ModuleManager.SummonManager:summon(self.summonType, 1) - self:closeUI() elseif GFunc.checkCost(cost.id, cost.num, true) then ModuleManager.SummonManager:summon(self.summonType, 2) - self:closeUI() end end diff --git a/lua/app/ui/shop/box_level_ui.lua b/lua/app/ui/shop/box_level_ui.lua index 0112b1d7..a68b31ac 100644 --- a/lua/app/ui/shop/box_level_ui.lua +++ b/lua/app/ui/shop/box_level_ui.lua @@ -137,7 +137,7 @@ function BoxLevelUI:refresh() self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0) self.box1Add1ItemCell:setNum("") self.box1Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject()) end) self.box1Add1Text:setText("+" .. tostring(reward1[1].num)) else @@ -145,7 +145,7 @@ function BoxLevelUI:refresh() self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0) self.box1Add1ItemCell:setNum("") self.box1Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject()) end) self.box1Add1Text:setText("+" .. tostring(reward1[1].num)) @@ -153,7 +153,7 @@ function BoxLevelUI:refresh() self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0) self.box1Add2ItemCell:setNum("") self.box1Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[2].id, self.box1Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[2].id, GConst.REWARD_TYPE.ITEM, self.box1Add2ItemCell:getBaseObject()) end) self.box1Add2Text:setText("+" .. tostring(reward1[2].num)) end @@ -164,7 +164,7 @@ function BoxLevelUI:refresh() self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0) self.box2Add1ItemCell:setNum("") self.box2Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject()) end) self.box2Add1Text:setText("+" .. tostring(reward2[1].num)) else @@ -172,7 +172,7 @@ function BoxLevelUI:refresh() self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0) self.box2Add1ItemCell:setNum("") self.box2Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject()) end) self.box2Add1Text:setText("+" .. tostring(reward2[1].num)) @@ -180,7 +180,7 @@ function BoxLevelUI:refresh() self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0) self.box2Add2ItemCell:setNum("") self.box2Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[2].id, self.box2Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[2].id, GConst.REWARD_TYPE.ITEM, self.box2Add2ItemCell:getBaseObject()) end) self.box2Add2Text:setText("+" .. tostring(reward2[2].num)) end @@ -191,7 +191,7 @@ function BoxLevelUI:refresh() self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0) self.box3Add1ItemCell:setNum("") self.box3Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject()) end) self.box3Add1Text:setText("+" .. tostring(reward3[1].num)) else @@ -199,7 +199,7 @@ function BoxLevelUI:refresh() self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0) self.box3Add1ItemCell:setNum("") self.box3Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject()) end) self.box3Add1Text:setText("+" .. tostring(reward3[1].num)) @@ -207,7 +207,7 @@ function BoxLevelUI:refresh() self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0) self.box3Add2ItemCell:setNum("") self.box3Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[2].id, self.box3Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[2].id, GConst.REWARD_TYPE.ITEM, self.box3Add2ItemCell:getBaseObject()) end) self.box3Add2Text:setText("+" .. tostring(reward3[2].num)) end diff --git a/lua/app/ui/shop/box_level_up_ui.lua b/lua/app/ui/shop/box_level_up_ui.lua index 25fae603..5e1fd8c8 100644 --- a/lua/app/ui/shop/box_level_up_ui.lua +++ b/lua/app/ui/shop/box_level_up_ui.lua @@ -84,7 +84,7 @@ function BoxLevelUpUI:refresh() self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0) self.box1Add1ItemCell:setNum("") self.box1Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject()) end) self.box1Add1Text:setText("+" .. tostring(reward1[1].num)) else @@ -92,7 +92,7 @@ function BoxLevelUpUI:refresh() self.box1Add1ItemCell:refreshByCfg(reward1[1].id, 0) self.box1Add1ItemCell:setNum("") self.box1Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[1].id, self.box1Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[1].id, GConst.REWARD_TYPE.ITEM, self.box1Add1ItemCell:getBaseObject()) end) self.box1Add1Text:setText("+" .. tostring(reward1[1].num)) @@ -100,7 +100,7 @@ function BoxLevelUpUI:refresh() self.box1Add2ItemCell:refreshByCfg(reward1[2].id, 0) self.box1Add2ItemCell:setNum("") self.box1Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward1[2].id, self.box1Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward1[2].id, GConst.REWARD_TYPE.ITEM, self.box1Add2ItemCell:getBaseObject()) end) self.box1Add2Text:setText("+" .. tostring(reward1[2].num)) end @@ -111,7 +111,7 @@ function BoxLevelUpUI:refresh() self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0) self.box2Add1ItemCell:setNum("") self.box2Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject()) end) self.box2Add1Text:setText("+" .. tostring(reward2[1].num)) else @@ -119,7 +119,7 @@ function BoxLevelUpUI:refresh() self.box2Add1ItemCell:refreshByCfg(reward2[1].id, 0) self.box2Add1ItemCell:setNum("") self.box2Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[1].id, self.box2Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[1].id, GConst.REWARD_TYPE.ITEM, self.box2Add1ItemCell:getBaseObject()) end) self.box2Add1Text:setText("+" .. tostring(reward2[1].num)) @@ -127,7 +127,7 @@ function BoxLevelUpUI:refresh() self.box2Add2ItemCell:refreshByCfg(reward2[2].id, 0) self.box2Add2ItemCell:setNum("") self.box2Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward2[2].id, self.box2Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward2[2].id, GConst.REWARD_TYPE.ITEM, self.box2Add2ItemCell:getBaseObject()) end) self.box2Add2Text:setText("+" .. tostring(reward2[2].num)) end @@ -138,7 +138,7 @@ function BoxLevelUpUI:refresh() self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0) self.box3Add1ItemCell:setNum("") self.box3Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject()) end) self.box3Add1Text:setText("+" .. tostring(reward3[1].num)) else @@ -146,7 +146,7 @@ function BoxLevelUpUI:refresh() self.box3Add1ItemCell:refreshByCfg(reward3[1].id, 0) self.box3Add1ItemCell:setNum("") self.box3Add1ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[1].id, self.box3Add1ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[1].id, GConst.REWARD_TYPE.ITEM, self.box3Add1ItemCell:getBaseObject()) end) self.box3Add1Text:setText("+" .. tostring(reward3[1].num)) @@ -154,7 +154,7 @@ function BoxLevelUpUI:refresh() self.box3Add2ItemCell:refreshByCfg(reward3[2].id, 0) self.box3Add2ItemCell:setNum("") self.box3Add2ItemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(reward3[2].id, self.box3Add2ItemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(reward3[2].id, GConst.REWARD_TYPE.ITEM, self.box3Add2ItemCell:getBaseObject()) end) self.box3Add2Text:setText("+" .. tostring(reward3[2].num)) end diff --git a/lua/app/ui/shop/box_open_ui.lua b/lua/app/ui/shop/box_open_ui.lua index e6cf95ef..a900dca8 100644 --- a/lua/app/ui/shop/box_open_ui.lua +++ b/lua/app/ui/shop/box_open_ui.lua @@ -1,14 +1,26 @@ local BoxOpenUI = class("BoxOpenUI", BaseUI) -local ICON_NAME = { +local SUMMON_ICON_NAME = { [GConst.SummonConst.SUMMON_TYPE.LV_1] = "shop_chest_1", [GConst.SummonConst.SUMMON_TYPE.LV_2] = "shop_chest_2", [GConst.SummonConst.SUMMON_TYPE.LV_3] = "shop_chest_3" } +local BOUNTY_ICON_NAME = { + [GConst.ItemConst.ITEM_ID_BOX_LV_1] = "shop_chest_2", + [GConst.ItemConst.ITEM_ID_BOX_LV_2] = "shop_chest_2", + [GConst.ItemConst.ITEM_ID_BOX_LV_3] = "shop_chest_3", + [GConst.ItemConst.ITEM_ID_BOX_LV_4] = "shop_chest_3", +} function BoxOpenUI:ctor(params) self.params = params or {} -- 将信息传递给下一个界面 - self.summonType = self.params.type or GConst.SummonConst.SUMMON_TYPE.LV_1 + self.type = self.params and self.params.type + self.iconName = "shop_chest_1" -- 默认图标 + if self.type == GConst.ShopConst.BOX_REWARD_TYPE.SUMMON then + self.iconName = SUMMON_ICON_NAME[self.params.params or GConst.SummonConst.SUMMON_TYPE.LV_1] + elseif self.type == GConst.ShopConst.BOX_REWARD_TYPE.BOUNTY then + self.iconName = BOUNTY_ICON_NAME[self.params.params or GConst.ItemConst.ITEM_ID_BOX_KEY_LV_1] + end end function BoxOpenUI:isFullScreen() @@ -27,13 +39,19 @@ function BoxOpenUI:onLoadRootComplete() self.openBtn = self.uiMap["box_open_ui.open_btn"] self.btnText = self.uiMap["box_open_ui.open_btn.text"] - self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType]) + self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, self.iconName) self.btnText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_7)) -- 立即打开 self.openBtn:addClickListener(function() ModuleManager.ShopManager:showBoxRewardUI(self.params) + end) + + -- 奖励界面打开时 关闭此界面 + self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI, function() self:closeUI() end) + + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI) end return BoxOpenUI \ No newline at end of file diff --git a/lua/app/ui/shop/box_reward_ui.lua b/lua/app/ui/shop/box_reward_ui.lua index 222e0523..2d180985 100644 --- a/lua/app/ui/shop/box_reward_ui.lua +++ b/lua/app/ui/shop/box_reward_ui.lua @@ -3,7 +3,7 @@ local BOX_HERO_CELL = "app/ui/shop/cell/box_hero_cell" function BoxRewardUI:ctor(params) self.params = params or {} - self.rewards = params.rewards or DataManager.SummonData:getLastSummonRewards() -- 目前从缓存里拿 + self.rewards = params.rewards or {} self.fragmentRewards = {} self.coinNum = 0 @@ -71,6 +71,9 @@ function BoxRewardUI:onLoadRootComplete() ModuleManager.ShopManager:showBoxLevelUpUI() end end) + + -- 关闭上一个界面 + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_BOX_OPEN_UI) end return BoxRewardUI \ No newline at end of file diff --git a/lua/app/ui/shop/cell/box_hero_cell.lua b/lua/app/ui/shop/cell/box_hero_cell.lua index 82c01150..3544df4e 100644 --- a/lua/app/ui/shop/cell/box_hero_cell.lua +++ b/lua/app/ui/shop/cell/box_hero_cell.lua @@ -10,8 +10,13 @@ function BoxHeroCell:refresh(data) self.data = data local id = data.id local num = data.count - - self.heroCell:refreshWithCfgId(id) + + local heroEntity = DataManager.HeroData:getHeroById(id) + if heroEntity then + self.heroCell:refresh(heroEntity) + else + self.heroCell:refreshWithCfgId(id) + end self.heroNumText:setText("X" .. tostring(num)) end diff --git a/lua/app/ui/shop/cell/pop_reward_cell.lua b/lua/app/ui/shop/cell/pop_reward_cell.lua index 86149f16..fcd29ea0 100644 --- a/lua/app/ui/shop/cell/pop_reward_cell.lua +++ b/lua/app/ui/shop/cell/pop_reward_cell.lua @@ -22,7 +22,7 @@ function PopRewardCell:refresh(id, num, showBg) self.popHeroCell:refreshWithCfgId(id, num) self.popHeroCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(id, self.popHeroCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(id, GConst.REWARD_TYPE.ITEM, self.popHeroCell:getBaseObject()) end) self.descTx:setText(ModuleManager.HeroManager:getHeroName(id)) else -- 通用道具 @@ -32,7 +32,7 @@ function PopRewardCell:refresh(id, num, showBg) self.itemCell:refreshByCfg(id, 0) self.itemCell:setNum("") self.itemCell:addClickListener(function() - ModuleManager.TipsManager:showItemTips(id, self.itemCell:getBaseObject()) + ModuleManager.TipsManager:showRewardTips(id, GConst.REWARD_TYPE.ITEM, self.itemCell:getBaseObject()) end) self.descTx:setText(num) end diff --git a/lua/app/userdata/summon/summon_data.lua b/lua/app/userdata/summon/summon_data.lua index b0802be6..434d542f 100644 --- a/lua/app/userdata/summon/summon_data.lua +++ b/lua/app/userdata/summon/summon_data.lua @@ -79,12 +79,11 @@ function SummonData:getSummonRewardByLv(summonType, level) end function SummonData:getSummonTotalRewardByLv(summonType, level) - level = level or self:getSummonLevel() - local rewards = {} - for lv = 1, level do - local lvRewards = self:getSummonRewardByLv(summonType, lv) - for _, reward in ipairs(lvRewards) do + local rewards = self:getSummonRewardByLv(summonType, 1) -- 基础奖励 + if level > 1 then + local addRewards = self:getSummonRewardByLv(summonType, level) + for _, reward in ipairs(addRewards) do table.insert(rewards, reward) end end @@ -108,16 +107,6 @@ function SummonData:getSummonMaxExp(level) return cfg[#cfg].exp or 0 end --- 缓存上次抽宝箱的奖励 -function SummonData:cacheSummonRewards(rewards) - self.summonRewards = rewards -end - --- 获取缓存的数据 -function SummonData:getLastSummonRewards() - return self.summonRewards or {} -end - -- 如果宝箱等级提升了 则标记 function SummonData:markNeedPopBoxLvUpUI() self.needPopBoxLvUpUI = true