diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index a0b7816f..ae812972 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -236,7 +236,7 @@ GConst.ATLAS_PATH = { ICON_TASK = "assets/arts/atlas/icon/task.asset", SHOP = "assets/arts/atlas/ui/shop.asset", HERO = "assets/arts/atlas/ui/hero.asset", - FUND = "assets/arts/atlas/ui/fund.asset", + UI_FUND = "assets/arts/atlas/ui/fund.asset", SEVEN_DAY = "assets/arts/atlas/ui/sevenday.asset", MODULE = "assets/arts/atlas/ui/module.asset", UI_MAIL = "assets/arts/atlas/ui/mail.asset", diff --git a/lua/app/ui/fund/cell/fund_chapter_cell.lua b/lua/app/ui/fund/cell/fund_chapter_cell.lua index 95e6f4c5..be9e4928 100755 --- a/lua/app/ui/fund/cell/fund_chapter_cell.lua +++ b/lua/app/ui/fund/cell/fund_chapter_cell.lua @@ -1,98 +1,99 @@ local FundChapterCell = class("FundChapterCell", BaseCell) function FundChapterCell:init() - local uiMap = self:getUIMap() - self.progNode = uiMap["fund_chapter_cell.prog"] - self.imgProg = uiMap["fund_chapter_cell.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) - self.lvNode = uiMap["fund_chapter_cell.level"] - self.txLv = uiMap["fund_chapter_cell.level.tx_lv"] - self.freeRewardCells = {} - for i = 1, 2 do - table.insert(self.freeRewardCells, uiMap["fund_chapter_cell.rewards_free.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) - end - self.proRewardCells = {} - for i = 1, 2 do - table.insert(self.proRewardCells, uiMap["fund_chapter_cell.rewards_pro.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) - end + local uiMap = self:getUIMap() + self.progNode = uiMap["fund_chapter_cell.prog"] + self.imgProg = uiMap["fund_chapter_cell.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) + self.lvNode = uiMap["fund_chapter_cell.level"] + self.txLv = uiMap["fund_chapter_cell.level.tx_lv"] + self.freeRewardCells = {} + for i = 1, 2 do + table.insert(self.freeRewardCells, uiMap["fund_chapter_cell.rewards_free.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) + end + self.proRewardCells = {} + for i = 1, 2 do + table.insert(self.proRewardCells, uiMap["fund_chapter_cell.rewards_pro.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)) + end - self.colorLight = BF.Color(0.6235294, 0.3137255, 0.1764706, 1) - self.colorGray = BF.Color(0.3568628, 0.3568628, 0.3568628, 1) + self.colorLight = BF.Color(0.6235294, 0.3137255, 0.1764706, 1) + self.colorGray = BF.Color(0.3568628, 0.3568628, 0.3568628, 1) end function FundChapterCell:refresh(id, isLast) - -- 刷新进度 - local helf = self:getBaseObject():getSizeDeltaY() / 2 - if self:getIndex() == 1 then - self.progNode:setAnchoredPositionY(-helf / 2) - self.progNode:setSizeDeltaY(helf) - elseif isLast then - self.progNode:setAnchoredPositionY(helf / 2) - self.progNode:setSizeDeltaY(helf) - else - self.progNode:setAnchoredPositionY(0) - self.progNode:setSizeDeltaY(self:getBaseObject():getSizeDeltaY()) - end + -- 刷新进度 + local helf = self:getBaseObject():getSizeDeltaY() / 2 + 10 + if self:getIndex() == 1 then + self.progNode:setAnchoredPositionY(-helf / 2) + self.progNode:setSizeDeltaY(helf) + elseif isLast then + self.progNode:setAnchoredPositionY(helf / 2) + self.progNode:setSizeDeltaY(helf) + else + self.progNode:setAnchoredPositionY(0) + self.progNode:setSizeDeltaY(self:getBaseObject():getSizeDeltaY()) + end - local needChapter = DataManager.ChapterFundData:getNeedChapter(id) - local chapterId = DataManager.ChapterData:getChapterPage(needChapter) - local stageNum = DataManager.ChapterData:getChapterStage(needChapter) - - local stage = DataManager.ChapterFundData:getStageById(id) - local value = DataManager.ChapterData:getChapterPassed(needChapter) and 1 or 0 + local needChapter = DataManager.ChapterFundData:getNeedChapter(id) + local chapterId = DataManager.ChapterData:getChapterPage(needChapter) + local stageNum = DataManager.ChapterData:getChapterStage(needChapter) + + local stage = DataManager.ChapterFundData:getStageById(id) + local value = DataManager.ChapterData:getChapterPassed(needChapter) and 1 or 0 - self.imgProg.value = value - self.txLv:setText(chapterId .. "-" .. stageNum) - if value == 1 then - self.lvNode:setSprite(GConst.ATLAS_PATH.UI_CHAPTER_FUND, "fund_chapter_bg_2") - self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorLight - else - self.lvNode:setSprite(GConst.ATLAS_PATH.UI_CHAPTER_FUND, "fund_chapter_bg_3") - self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorGray - end + self.imgProg.value = value + self.txLv:setText(chapterId .. "-" .. stageNum) + if value == 1 then + self.lvNode:setSprite(GConst.ATLAS_PATH.UI_FUND, "fund_dec_1") + -- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorLight + else + self.lvNode:setSprite(GConst.ATLAS_PATH.UI_FUND, "fund_dec_3") + -- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorGray + end + -- GFunc.centerTxAndImgAndTx(txObj1, spacing1, imgObj, spacing2, txObj2) - local freeRewards = DataManager.ChapterFundData:getFreeRewards(id) - local freeReceived = DataManager.ChapterFundData:getFreeGot(id) - local canGet = DataManager.ChapterFundData:getFreeCanGet(id) - for i, cell in ipairs(self.freeRewardCells) do - if freeRewards and freeRewards[i] then - cell:setActive(true) - cell:refreshByConfig(freeRewards[i], freeReceived, freeReceived) - if canGet then - cell:addClickListener(function() - ModuleManager.FundChapterManager:getReward(stage) - end) - cell:showFrameAnimation() - else - cell:hideFrameAnimation() - cell:clearClickListener() - end - else - cell:setActive(false) - end - end + local freeRewards = DataManager.ChapterFundData:getFreeRewards(id) + local freeReceived = DataManager.ChapterFundData:getFreeGot(id) + local canGet = DataManager.ChapterFundData:getFreeCanGet(id) + for i, cell in ipairs(self.freeRewardCells) do + if freeRewards and freeRewards[i] then + cell:setActive(true) + cell:refreshByConfig(freeRewards[i], freeReceived, freeReceived) + if canGet then + cell:addClickListener(function() + ModuleManager.FundChapterManager:getReward(stage) + end) + cell:showFrameAnimation() + else + cell:hideFrameAnimation() + cell:clearClickListener() + end + else + cell:setActive(false) + end + end - local proRewards = DataManager.ChapterFundData:getProRewards(id) - local proReceived = DataManager.ChapterFundData:getProGot(id) - local locked = not DataManager.ChapterFundData:getProBought(stage) - local canGet = DataManager.ChapterFundData:getProCanGet(id) - for i, cell in ipairs(self.proRewardCells) do - if proRewards and proRewards[i] then - cell:setActive(true) - cell:refreshByConfig(proRewards[i], proReceived, proReceived) - cell:showLock(locked) - if canGet then - cell:addClickListener(function() - ModuleManager.FundChapterManager:getReward(stage) - end) - cell:showFrameAnimation() - else - cell:hideFrameAnimation() - cell:clearClickListener() - end - else - cell:setActive(false) - end - end + local proRewards = DataManager.ChapterFundData:getProRewards(id) + local proReceived = DataManager.ChapterFundData:getProGot(id) + local locked = not DataManager.ChapterFundData:getProBought(stage) + local canGet = DataManager.ChapterFundData:getProCanGet(id) + for i, cell in ipairs(self.proRewardCells) do + if proRewards and proRewards[i] then + cell:setActive(true) + cell:refreshByConfig(proRewards[i], proReceived, proReceived) + cell:showLock(locked) + if canGet then + cell:addClickListener(function() + ModuleManager.FundChapterManager:getReward(stage) + end) + cell:showFrameAnimation() + else + cell:hideFrameAnimation() + cell:clearClickListener() + end + else + cell:setActive(false) + end + end end return FundChapterCell