diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 3d9473ec..76cb4518 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -252,6 +252,7 @@ GConst.ATLAS_PATH = { ICON_SUMMON = "assets/arts/atlas/icon/hero_summon.asset", UI_SUPPLY = "assets/arts/atlas/ui/supply.asset", UI_DUNGEON = "assets/arts/atlas/ui/dungeon.asset", + UI_FIRST_CHARGE = "assets/arts/atlas/ui/act_firstcharge.asset", } GConst.TOUCH_EVENT = { diff --git a/lua/app/ui/shop/first_recharge_ui.lua b/lua/app/ui/shop/first_recharge_ui.lua index c8384b1e..5d2484b6 100755 --- a/lua/app/ui/shop/first_recharge_ui.lua +++ b/lua/app/ui/shop/first_recharge_ui.lua @@ -1,5 +1,17 @@ local FirstRechargeUI = class("FirstRechargeUI", BaseUI) +local BTN_LIGHT = { + "act_firstcharge_btn_1_1", + "act_firstcharge_btn_2_1", + "act_firstcharge_btn_3_1", +} + +local BTN_NORMAL = { + "act_firstcharge_btn_1", + "act_firstcharge_btn_2", + "act_firstcharge_btn_3", +} + function FirstRechargeUI:isFullScreen() return false end @@ -39,6 +51,12 @@ function FirstRechargeUI:onLoadRootComplete() self.txTips = uiMap["first_recharge_ui.tips.tx_tips"] self.btnGet = uiMap["first_recharge_ui.btn_get"] self.txGet = uiMap["first_recharge_ui.btn_get.tx_desc"] + + self.matchImg = uiMap["first_recharge_ui.match_img"] + self.nameTx = uiMap["first_recharge_ui.match_img.name_tx"] + self.qltBg = uiMap["first_recharge_ui.match_img.qlt_bg"] + self.qltBgTx = uiMap["first_recharge_ui.match_img.qlt_bg.qlt_tx"] + self.daysBg = {} self.daysTitle = {} self.daysRewardCells = {} @@ -53,12 +71,10 @@ function FirstRechargeUI:onLoadRootComplete() end self.tagNode = uiMap["first_recharge_ui.tag"] self.btnTags = {} - self.imgTags = {} self.txTags = {} for k, key in pairs(GConst.ShopConst.FIRST_RECHARGE_GEARS) do self.btnTags[key] = uiMap["first_recharge_ui.tag.btn_" .. key] self.txTags[key] = uiMap["first_recharge_ui.tag.btn_" .. key .. ".tx_desc"] - self.imgTags[key] = uiMap["first_recharge_ui.tag.btn_" .. key .. ".img_icon"] end DataManager.ShopData:setFirstrechargePoped() @@ -141,9 +157,10 @@ function FirstRechargeUI:onRefresh() if openCount > 1 and DataManager.ShopData:isFirstRechargeOpen(gear) then btn:setActive(true) local cfg = DataManager.ShopData:getActGiftConfig(DataManager.ShopData:getFirstRechargeGiftId(gear)) - self.imgTags[gear]:setSprite(GConst.ATLAS_PATH.UI_FIRST_CHARGE, "act_firstcharge_icon_".. gear) - btn:setSprite(GConst.ATLAS_PATH.UI_FIRST_CHARGE, gear == self.curGear and ("act_firstcharge_bg_2") or ("act_firstcharge_bg_3")) - self.txTags[gear]:setText("" .. I18N:getGlobalText(I18N.GlobalConst.FIRST_CHARGE_2, GFunc.getFormatPrice(cfg.recharge_id)) .. "") + -- btn:setSprite(GConst.ATLAS_PATH.UI_FIRST_CHARGE, gear == self.curGear and ("act_firstcharge_bg_2") or ("act_firstcharge_bg_3")) + -- self.txTags[gear]:setText("" .. I18N:getGlobalText(I18N.GlobalConst.FIRST_CHARGE_2, GFunc.getFormatPrice(cfg.recharge_id)) .. "") + btn:setSprite(GConst.ATLAS_PATH.UI_FIRST_CHARGE, gear == self.curGear and BTN_LIGHT[gear] or BTN_NORMAL[gear]) + self.txTags[gear]:setText(I18N:getGlobalText(I18N.GlobalConst.FIRST_CHARGE_2, GFunc.getFormatPrice(cfg.recharge_id))) local boughtDay = DataManager.ShopData:getFirstRechargeBoughtDays(gear) local rewardDay = DataManager.ShopData:getFirstRechargeRewardDays(gear) if boughtDay > 0 and boughtDay > rewardDay then @@ -159,6 +176,7 @@ function FirstRechargeUI:onRefresh() local boughtDay = DataManager.ShopData:getFirstRechargeBoughtDays(self.curGear) local rewardDay = DataManager.ShopData:getFirstRechargeRewardDays(self.curGear) + local heroId -- 奖励相关 for day, bg in ipairs(self.daysBg) do local giftId = DataManager.ShopData:getFirstRechargeGiftId(self.curGear, day) @@ -168,6 +186,9 @@ function FirstRechargeUI:onRefresh() local canGet = DataManager.ShopData:canGetFirstRechargeReward(self.curGear, day) for i, cell in ipairs(self.daysRewardCells[day]) do if rewards and rewards[i] then + if not heroId then + heroId = rewards[i].id + end cell:setActive(true) cell:refreshByConfig(rewards[i], received, received) if canGet then @@ -181,25 +202,38 @@ function FirstRechargeUI:onRefresh() end self.daysTitle[day]:setText(I18N:getGlobalText(I18N.GlobalConst.FIRST_CHARGE_1, day)) end + if heroId and self.curGear ~= 3 then + self.matchImg:setActive(true) + Logger.logHighlight("================= heroId = %s", heroId) + local heroEntity = DataManager.HeroData:getEntity({id = heroId, level = 0}) + local matchType = heroEntity:getMatchType() + local qlt = heroEntity:getQlt() + self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(matchType)) + self.qltBg:setSprite(GFunc.getHeroQltImg(qlt)) + self.qltBgTx:setText(GFunc.getHeroQltStr(qlt)) + self.nameTx:setText(heroEntity:getName()) + else + self.matchImg:setActive(false) + end -- 购买领取按钮 if boughtDay > 0 then -- 已购买 if boughtDay > rewardDay then self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) - self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_2") + self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_3") self.btnGet:setTouchEnable(true) self.btnGet:addRedPoint(114, 38, 1) else self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.FIRST_CHARGE_3)) - self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_5") + self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_grey_3") self.btnGet:setTouchEnable(false) self.btnGet:removeRedPoint() end else -- 未购买 self.txGet:setText(price) - self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_2") + self.btnGet:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_3") self.btnGet:setTouchEnable(true) self.btnGet:removeRedPoint() end