diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 2acbf867..0af215f9 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -158,7 +158,6 @@ function DataManager:initWithServerData(data) self.DungeonData:initDungeonShards(data.chapter_shards_challenge) self.FormationData:init(data.fight_info) self.EquipData:init(data.heroes_equips) - self.EquipData:initGifts(data.act_weapon_armor_gift) self.SkinData:init(data.bag.skins) -- HeroData要在EquipData、SkinData之后初始化,依赖它们的属性数据 self.HeroData:init(data.bag.heroes) diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua index 333b46c5..ec121971 100644 --- a/lua/app/module/maincity/maincity_const.lua +++ b/lua/app/module/maincity/maincity_const.lua @@ -38,8 +38,8 @@ MainCityConst.RIGHT_SIDE_BARS = { "app/ui/main_city/cell/side_bar_introduct_gift_cell", "app/ui/main_city/cell/side_bar_beginner_gift_cell", "app/ui/main_city/cell/side_bar_discount_cell", - "app/ui/main_city/cell/side_bar_weapon_gift_cell", - "app/ui/main_city/cell/side_bar_armor_gift_cell", + -- "app/ui/main_city/cell/side_bar_weapon_gift_cell", + -- "app/ui/main_city/cell/side_bar_armor_gift_cell", "app/ui/main_city/cell/side_bar_grow_up_gift_cell", } diff --git a/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua b/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua index 2cc749c0..cf084171 100644 --- a/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua +++ b/lua/app/ui/dungeon_armor/dungeon_armor_main_ui.lua @@ -1,7 +1,7 @@ local DungeonArmorMainUI = class("DungeonArmorMainUI", BaseUI) local CHAPTER_LAYER_CELL = "app/ui/dungeon_armor/cell/chapter_cell" -local GIFT_CELL = "app/ui/main_city/cell/side_bar_armor_gift_cell" +-- local GIFT_CELL = "app/ui/main_city/cell/side_bar_armor_gift_cell" function DungeonArmorMainUI:getCurrencyParams() if self.currencyParams == nil then @@ -69,7 +69,7 @@ function DungeonArmorMainUI:_display() self.btnFund:setActive(not GFunc.isShenhe()) self:refreshFund() - self:initRightBtns() + -- self:initRightBtns() self:refreshScrollrect() self:refreshFormation() self:refreshStarNode() @@ -295,35 +295,35 @@ function DungeonArmorMainUI:refreshTime() self:refreshRightBtns() end -function DungeonArmorMainUI:initRightBtns() - if self.rightBtnCells then - return - end - local uiMap = self.root:genAllChildren() - self.rightNode = uiMap["dungeon_armor_main_ui.right_node"] - self.rightArrow = uiMap["dungeon_armor_main_ui.right_node.arrow_node"] - self.rightBtnCells = {} - self.rightBtnCells.giftCell = CellManager:addCellComp(uiMap["dungeon_armor_main_ui.right_node.side_bar.side_bar_cell"], GIFT_CELL) +-- function DungeonArmorMainUI:initRightBtns() +-- if self.rightBtnCells then +-- return +-- end +-- local uiMap = self.root:genAllChildren() +-- self.rightNode = uiMap["dungeon_armor_main_ui.right_node"] +-- self.rightArrow = uiMap["dungeon_armor_main_ui.right_node.arrow_node"] +-- self.rightBtnCells = {} +-- self.rightBtnCells.giftCell = CellManager:addCellComp(uiMap["dungeon_armor_main_ui.right_node.side_bar.side_bar_cell"], GIFT_CELL) - self.rightArrow:setVisible(false) +-- self.rightArrow:setVisible(false) - self:refreshRightBtns() -end +-- self:refreshRightBtns() +-- end -function DungeonArmorMainUI:refreshRightBtns() - local y = 0 - if self.rightBtnCells.giftCell:checkIsOpen() then - y = y - 60 - self.rightBtnCells.giftCell:setActive(true) - self.rightBtnCells.giftCell:setVisible(true) - self.rightBtnCells.giftCell:getBaseObject():setAnchoredPositionY(y) - self.rightBtnCells.giftCell:refresh() - else - self.rightBtnCells.giftCell:setVisible(false) - end +-- function DungeonArmorMainUI:refreshRightBtns() +-- local y = 0 +-- if self.rightBtnCells.giftCell:checkIsOpen() then +-- y = y - 60 +-- self.rightBtnCells.giftCell:setActive(true) +-- self.rightBtnCells.giftCell:setVisible(true) +-- self.rightBtnCells.giftCell:getBaseObject():setAnchoredPositionY(y) +-- self.rightBtnCells.giftCell:refresh() +-- else +-- self.rightBtnCells.giftCell:setVisible(false) +-- end - -- 暂不处理箭头的问题 - self.rightNode:setVisible(y < 0) -end +-- -- 暂不处理箭头的问题 +-- self.rightNode:setVisible(y < 0) +-- end return DungeonArmorMainUI \ No newline at end of file diff --git a/lua/app/ui/dungeon_weapon/dungeon_weapon_main_ui.lua b/lua/app/ui/dungeon_weapon/dungeon_weapon_main_ui.lua index 912ef795..f6f81df2 100644 --- a/lua/app/ui/dungeon_weapon/dungeon_weapon_main_ui.lua +++ b/lua/app/ui/dungeon_weapon/dungeon_weapon_main_ui.lua @@ -52,7 +52,7 @@ function DungeonWeaponMainUI:_display() local uiMap = self.root:genAllChildren() uiMap["dungeon_weapon_mian_ui.banner.btn_formation.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_4)) - self:initRightBtns() + -- self:initRightBtns() self:refreshScrollrect() self:refreshFormation() self:refreshRemianNode() @@ -126,35 +126,35 @@ function DungeonWeaponMainUI:refreshTime() self:refreshRightBtns() end -function DungeonWeaponMainUI:initRightBtns() - if self.rightBtnCells then - return - end - local uiMap = self.root:genAllChildren() - self.rightNode = uiMap["dungeon_weapon_mian_ui.right_node"] - self.rightArrow = uiMap["dungeon_weapon_mian_ui.right_node.arrow_node"] - self.rightBtnCells = {} - self.rightBtnCells.giftCell = CellManager:addCellComp(uiMap["dungeon_weapon_mian_ui.right_node.side_bar.side_bar_cell"], GIFT_CELL) +-- function DungeonWeaponMainUI:initRightBtns() +-- if self.rightBtnCells then +-- return +-- end +-- local uiMap = self.root:genAllChildren() +-- self.rightNode = uiMap["dungeon_weapon_mian_ui.right_node"] +-- self.rightArrow = uiMap["dungeon_weapon_mian_ui.right_node.arrow_node"] +-- self.rightBtnCells = {} +-- self.rightBtnCells.giftCell = CellManager:addCellComp(uiMap["dungeon_weapon_mian_ui.right_node.side_bar.side_bar_cell"], GIFT_CELL) - self.rightArrow:setVisible(false) +-- self.rightArrow:setVisible(false) - self:refreshRightBtns() -end +-- self:refreshRightBtns() +-- end -function DungeonWeaponMainUI:refreshRightBtns() - local y = 0 - if self.rightBtnCells.giftCell:checkIsOpen() then - y = y - 60 - self.rightBtnCells.giftCell:setActive(true) - self.rightBtnCells.giftCell:setVisible(true) - self.rightBtnCells.giftCell:getBaseObject():setAnchoredPositionY(y) - self.rightBtnCells.giftCell:refresh() - else - self.rightBtnCells.giftCell:setVisible(false) - end +-- function DungeonWeaponMainUI:refreshRightBtns() +-- local y = 0 +-- if self.rightBtnCells.giftCell:checkIsOpen() then +-- y = y - 60 +-- self.rightBtnCells.giftCell:setActive(true) +-- self.rightBtnCells.giftCell:setVisible(true) +-- self.rightBtnCells.giftCell:getBaseObject():setAnchoredPositionY(y) +-- self.rightBtnCells.giftCell:refresh() +-- else +-- self.rightBtnCells.giftCell:setVisible(false) +-- end - -- 暂不处理箭头的问题 - self.rightNode:setVisible(y < 0) -end +-- -- 暂不处理箭头的问题 +-- self.rightNode:setVisible(y < 0) +-- end return DungeonWeaponMainUI \ No newline at end of file diff --git a/lua/app/userdata/equip/equip_data.lua b/lua/app/userdata/equip/equip_data.lua index 8a3a0c01..cc21b579 100644 --- a/lua/app/userdata/equip/equip_data.lua +++ b/lua/app/userdata/equip/equip_data.lua @@ -141,164 +141,4 @@ function EquipData:onUpgradeEquip(heroId, part) DataManager.HeroData:getHeroById(heroId):onEquipAttrChange() end --- 装备礼包相关 ----------------------------------------------------------------------------- - --- 初始化礼包信息 -function EquipData:initGifts(data) - self.gifts = data.active_gifts or GConst.EMPTY_TABLE - - Logger.logHighlight("初始化装备礼包") - Logger.printTable(self.gifts) - - ModuleManager.EquipManager:updateEquipGiftTimer() - self:setDirty() -end - --- 获取礼包最近的结束时间 -function EquipData:getGiftNearestRemainTime(actType) - local checkList = actType ~= nil and self:getGiftIdsByType(actType) or table.keys(self.gifts) - local nearest = nil - - for idx, id in pairs(checkList) do - local time = self:getGiftRemainTime(id) - if nearest == nil or nearest > time then - nearest = time - end - end - - return nearest -end - --- 获取所有存在的该类型礼包 -function EquipData:getGiftIdsByType(actType) - local ids = {} - for id, data in pairs(self.gifts) do - local cfg = DataManager.ShopData:getActGiftConfig()[id] - if cfg and actType == cfg.type and self:getGiftRemainTime(id) > 0 then - table.insert(ids, id) - end - end - table.sort(ids, function(a, b) return a > b end) - - return ids -end - --- 获取可以展示的礼包 -function EquipData:getCanShowGiftId(heroId, part) - local giftId = self:getEquipGiftId(heroId, part) - - if not self:hasGiftData(giftId) then - return nil - end - - if self:getGiftRemainTime(giftId) > 0 then - return giftId - end - - return nil -end - --- 当前是否存在礼包数据 -function EquipData:hasGiftData(giftId) - return self.gifts[giftId] ~= nil -end - --- 获取装备对应的礼包id -function EquipData:getEquipGiftId(heroId, part) - local giftType - if part == GConst.EquipConst.PART_TYPE.WEAPON then - giftType = PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT - else - giftType = PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT - end - - if giftType == nil then - return nil - end - - local level = DataManager.EquipData:getEquip(heroId, part):getLevel() - for idx, id in pairs(self:getGiftIdsByType(giftType)) do - if self:meetGiftLevelRange(id, level) then - return id - end - end - - return nil -end - --- 是否满足礼包的等级条件 -function EquipData:meetGiftLevelRange(giftId, level) - local cfg = DataManager.ShopData:getActGiftConfig()[giftId] - if cfg == nil or cfg.parameter_pro == nil then - return - end - - return level >= cfg.parameter_pro[1] and level <= cfg.parameter_pro[2] -end - --- 获取礼包剩余时间 -function EquipData:getGiftRemainTime(giftId) - -- 没有礼包 - if self.gifts[giftId] == nil then - return 0 - end - - -- 在冷却中 - if self:isGiftCooling(giftId) then - return 0 - end - - return (self.gifts[giftId].expire_at // 1000) - Time:getServerTime() -end - --- 礼包是否在冷却时间中 -function EquipData:isGiftCooling(giftId) - local giftData = DataManager.ShopData:getActGiftDetailData(PayManager.PURCHARSE_TYPE.ACT_GIFT, giftId) - - if giftData then - local latestBuyTime = giftData.latest_buy_at // 1000 - local cfg = DataManager.ShopData:getActGiftConfig()[giftId] - if latestBuyTime > 0 then - -- 购买冷却 - local cdTime = (cfg.cd or 0) * 3600 - if latestBuyTime + cdTime > Time:getServerTime() then - return true - end - elseif self:hasGiftData(giftId) then - -- 到期冷却 - if self.gifts[giftId].cd_end_at // 1000 < Time:getServerTime() then - return true - end - end - end - - return false -end - --- 获取礼包显示的标题 -function EquipData:getGiftTitle(giftId) - local gift = DataManager.ShopData:getActGiftConfig()[giftId] - if gift == nil then - return nil - end - - if gift.type == PayManager.PURCHARSE_ACT_TYPE.WEAPON_UPGRADE_GIFT then - return I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_28, gift.parameter_pro[1] + 20) - elseif gift.type == PayManager.PURCHARSE_ACT_TYPE.ARMOR_UPGRADE_GIFT then - return I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_27, gift.parameter_pro[1] + 20) - end -end - --- 礼包状态改变 -function EquipData:onGiftStateChange() - Logger.logHighlight("装备礼包状态改变") - self:setDirty() -end - --- 购买礼包成功 -function EquipData:onBuyGiftSuccess(giftId) - Logger.logHighlight("购买装备礼包成功:"..giftId) - self:setDirty() -end - return EquipData \ No newline at end of file