fix bug
This commit is contained in:
parent
f3a21862c2
commit
c6b4df528f
@ -236,7 +236,7 @@ GConst.ATLAS_PATH = {
|
|||||||
ICON_TASK = "assets/arts/atlas/icon/task.asset",
|
ICON_TASK = "assets/arts/atlas/icon/task.asset",
|
||||||
SHOP = "assets/arts/atlas/ui/shop.asset",
|
SHOP = "assets/arts/atlas/ui/shop.asset",
|
||||||
HERO = "assets/arts/atlas/ui/hero.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",
|
SEVEN_DAY = "assets/arts/atlas/ui/sevenday.asset",
|
||||||
MODULE = "assets/arts/atlas/ui/module.asset",
|
MODULE = "assets/arts/atlas/ui/module.asset",
|
||||||
UI_MAIL = "assets/arts/atlas/ui/mail.asset",
|
UI_MAIL = "assets/arts/atlas/ui/mail.asset",
|
||||||
|
|||||||
@ -1,98 +1,99 @@
|
|||||||
local FundChapterCell = class("FundChapterCell", BaseCell)
|
local FundChapterCell = class("FundChapterCell", BaseCell)
|
||||||
|
|
||||||
function FundChapterCell:init()
|
function FundChapterCell:init()
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
self.progNode = uiMap["fund_chapter_cell.prog"]
|
self.progNode = uiMap["fund_chapter_cell.prog"]
|
||||||
self.imgProg = uiMap["fund_chapter_cell.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
self.imgProg = uiMap["fund_chapter_cell.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
self.lvNode = uiMap["fund_chapter_cell.level"]
|
self.lvNode = uiMap["fund_chapter_cell.level"]
|
||||||
self.txLv = uiMap["fund_chapter_cell.level.tx_lv"]
|
self.txLv = uiMap["fund_chapter_cell.level.tx_lv"]
|
||||||
self.freeRewardCells = {}
|
self.freeRewardCells = {}
|
||||||
for i = 1, 2 do
|
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))
|
table.insert(self.freeRewardCells, uiMap["fund_chapter_cell.rewards_free.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||||
end
|
end
|
||||||
self.proRewardCells = {}
|
self.proRewardCells = {}
|
||||||
for i = 1, 2 do
|
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))
|
table.insert(self.proRewardCells, uiMap["fund_chapter_cell.rewards_pro.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
|
||||||
end
|
end
|
||||||
|
|
||||||
self.colorLight = BF.Color(0.6235294, 0.3137255, 0.1764706, 1)
|
self.colorLight = BF.Color(0.6235294, 0.3137255, 0.1764706, 1)
|
||||||
self.colorGray = BF.Color(0.3568628, 0.3568628, 0.3568628, 1)
|
self.colorGray = BF.Color(0.3568628, 0.3568628, 0.3568628, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundChapterCell:refresh(id, isLast)
|
function FundChapterCell:refresh(id, isLast)
|
||||||
-- 刷新进度
|
-- 刷新进度
|
||||||
local helf = self:getBaseObject():getSizeDeltaY() / 2
|
local helf = self:getBaseObject():getSizeDeltaY() / 2 + 10
|
||||||
if self:getIndex() == 1 then
|
if self:getIndex() == 1 then
|
||||||
self.progNode:setAnchoredPositionY(-helf / 2)
|
self.progNode:setAnchoredPositionY(-helf / 2)
|
||||||
self.progNode:setSizeDeltaY(helf)
|
self.progNode:setSizeDeltaY(helf)
|
||||||
elseif isLast then
|
elseif isLast then
|
||||||
self.progNode:setAnchoredPositionY(helf / 2)
|
self.progNode:setAnchoredPositionY(helf / 2)
|
||||||
self.progNode:setSizeDeltaY(helf)
|
self.progNode:setSizeDeltaY(helf)
|
||||||
else
|
else
|
||||||
self.progNode:setAnchoredPositionY(0)
|
self.progNode:setAnchoredPositionY(0)
|
||||||
self.progNode:setSizeDeltaY(self:getBaseObject():getSizeDeltaY())
|
self.progNode:setSizeDeltaY(self:getBaseObject():getSizeDeltaY())
|
||||||
end
|
end
|
||||||
|
|
||||||
local needChapter = DataManager.ChapterFundData:getNeedChapter(id)
|
local needChapter = DataManager.ChapterFundData:getNeedChapter(id)
|
||||||
local chapterId = DataManager.ChapterData:getChapterPage(needChapter)
|
local chapterId = DataManager.ChapterData:getChapterPage(needChapter)
|
||||||
local stageNum = DataManager.ChapterData:getChapterStage(needChapter)
|
local stageNum = DataManager.ChapterData:getChapterStage(needChapter)
|
||||||
|
|
||||||
local stage = DataManager.ChapterFundData:getStageById(id)
|
local stage = DataManager.ChapterFundData:getStageById(id)
|
||||||
local value = DataManager.ChapterData:getChapterPassed(needChapter) and 1 or 0
|
local value = DataManager.ChapterData:getChapterPassed(needChapter) and 1 or 0
|
||||||
|
|
||||||
self.imgProg.value = value
|
self.imgProg.value = value
|
||||||
self.txLv:setText(chapterId .. "-" .. stageNum)
|
self.txLv:setText(chapterId .. "-" .. stageNum)
|
||||||
if value == 1 then
|
if value == 1 then
|
||||||
self.lvNode:setSprite(GConst.ATLAS_PATH.UI_CHAPTER_FUND, "fund_chapter_bg_2")
|
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
|
-- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorLight
|
||||||
else
|
else
|
||||||
self.lvNode:setSprite(GConst.ATLAS_PATH.UI_CHAPTER_FUND, "fund_chapter_bg_3")
|
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
|
-- self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).color = self.colorGray
|
||||||
end
|
end
|
||||||
|
-- GFunc.centerTxAndImgAndTx(txObj1, spacing1, imgObj, spacing2, txObj2)
|
||||||
|
|
||||||
local freeRewards = DataManager.ChapterFundData:getFreeRewards(id)
|
local freeRewards = DataManager.ChapterFundData:getFreeRewards(id)
|
||||||
local freeReceived = DataManager.ChapterFundData:getFreeGot(id)
|
local freeReceived = DataManager.ChapterFundData:getFreeGot(id)
|
||||||
local canGet = DataManager.ChapterFundData:getFreeCanGet(id)
|
local canGet = DataManager.ChapterFundData:getFreeCanGet(id)
|
||||||
for i, cell in ipairs(self.freeRewardCells) do
|
for i, cell in ipairs(self.freeRewardCells) do
|
||||||
if freeRewards and freeRewards[i] then
|
if freeRewards and freeRewards[i] then
|
||||||
cell:setActive(true)
|
cell:setActive(true)
|
||||||
cell:refreshByConfig(freeRewards[i], freeReceived, freeReceived)
|
cell:refreshByConfig(freeRewards[i], freeReceived, freeReceived)
|
||||||
if canGet then
|
if canGet then
|
||||||
cell:addClickListener(function()
|
cell:addClickListener(function()
|
||||||
ModuleManager.FundChapterManager:getReward(stage)
|
ModuleManager.FundChapterManager:getReward(stage)
|
||||||
end)
|
end)
|
||||||
cell:showFrameAnimation()
|
cell:showFrameAnimation()
|
||||||
else
|
else
|
||||||
cell:hideFrameAnimation()
|
cell:hideFrameAnimation()
|
||||||
cell:clearClickListener()
|
cell:clearClickListener()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
cell:setActive(false)
|
cell:setActive(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local proRewards = DataManager.ChapterFundData:getProRewards(id)
|
local proRewards = DataManager.ChapterFundData:getProRewards(id)
|
||||||
local proReceived = DataManager.ChapterFundData:getProGot(id)
|
local proReceived = DataManager.ChapterFundData:getProGot(id)
|
||||||
local locked = not DataManager.ChapterFundData:getProBought(stage)
|
local locked = not DataManager.ChapterFundData:getProBought(stage)
|
||||||
local canGet = DataManager.ChapterFundData:getProCanGet(id)
|
local canGet = DataManager.ChapterFundData:getProCanGet(id)
|
||||||
for i, cell in ipairs(self.proRewardCells) do
|
for i, cell in ipairs(self.proRewardCells) do
|
||||||
if proRewards and proRewards[i] then
|
if proRewards and proRewards[i] then
|
||||||
cell:setActive(true)
|
cell:setActive(true)
|
||||||
cell:refreshByConfig(proRewards[i], proReceived, proReceived)
|
cell:refreshByConfig(proRewards[i], proReceived, proReceived)
|
||||||
cell:showLock(locked)
|
cell:showLock(locked)
|
||||||
if canGet then
|
if canGet then
|
||||||
cell:addClickListener(function()
|
cell:addClickListener(function()
|
||||||
ModuleManager.FundChapterManager:getReward(stage)
|
ModuleManager.FundChapterManager:getReward(stage)
|
||||||
end)
|
end)
|
||||||
cell:showFrameAnimation()
|
cell:showFrameAnimation()
|
||||||
else
|
else
|
||||||
cell:hideFrameAnimation()
|
cell:hideFrameAnimation()
|
||||||
cell:clearClickListener()
|
cell:clearClickListener()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
cell:setActive(false)
|
cell:setActive(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return FundChapterCell
|
return FundChapterCell
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user