主城战令显示
This commit is contained in:
parent
2430f90295
commit
4a162302ff
@ -156,6 +156,10 @@ function MainCityUI:_bind()
|
||||
self:bind(DataManager.DailyTaskData, "redPointFlag", function()
|
||||
self:refreshTask()
|
||||
end)
|
||||
|
||||
self:bind(DataManager.BountyData, "dirty", function()
|
||||
self:refreshBounty()
|
||||
end)
|
||||
end
|
||||
|
||||
function MainCityUI:initBottomUI()
|
||||
@ -451,6 +455,11 @@ function MainCityUI:initBounty()
|
||||
self.bountyBanner:addClickListener(function()
|
||||
ModuleManager.BountyManager:showBountyMainUI()
|
||||
end)
|
||||
self.bountyBannerInfo = self.uiMap["main_ui.top_node.bounty_node.banner.info"]
|
||||
self.bountyBannerDescTx = self.uiMap["main_ui.top_node.bounty_node.banner.desc"]
|
||||
self.bountyBannerSlider = self.uiMap["main_ui.top_node.bounty_node.banner.info.progress_bg.slider"]
|
||||
self.bountyBannerSliderTx = self.uiMap["main_ui.top_node.bounty_node.banner.info.progress_bg.slider_tx"]
|
||||
self.bountyBannerLvTx = self.uiMap["main_ui.top_node.bounty_node.banner.info.progress_bg.lv_tx"]
|
||||
end
|
||||
|
||||
function MainCityUI:initSetting()
|
||||
@ -476,8 +485,28 @@ function MainCityUI:refreshBounty()
|
||||
return
|
||||
end
|
||||
self.bountyNode:setVisible(true)
|
||||
if DataManager.BountyData:getIfCanClaimReward() then
|
||||
local bannerName = DataManager.BountyData:getRewardBannerName()
|
||||
self.bountyBanner:setSprite(GConst.ATLAS_PATH.BOUNTY, bannerName)
|
||||
self.bountyBannerInfo:setVisible(false)
|
||||
self.bountyBannerDescTx:setText("临时文本:收集奖励")
|
||||
else
|
||||
local bannerName = DataManager.BountyData:getBannerName()
|
||||
self.bountyBanner:setSprite(GConst.ATLAS_PATH.BOUNTY, bannerName)
|
||||
self.bountyBannerInfo:setVisible(true)
|
||||
self.bountyBannerDescTx:setText(GConst.EMPTY_STRING)
|
||||
local exp = DataManager.BountyData:getExp()
|
||||
local lvUpExp = DataManager.BountyData:getLvUpExp()
|
||||
local level = DataManager.BountyData:getLevel()
|
||||
local maxLevel = DataManager.BountyData:getMaxLevel()
|
||||
self.bountyBannerSliderTx:setText(exp .. "/" .. lvUpExp)
|
||||
self.bountyBannerSlider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = exp / lvUpExp
|
||||
if level >= maxLevel then
|
||||
self.bountyBannerLvTx:setText("临时文本:MAX")
|
||||
else
|
||||
self.bountyBannerLvTx:setText(tostring(level))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MainCityUI:refreshTask()
|
||||
|
||||
@ -18,7 +18,19 @@ function BountyData:init(data)
|
||||
self.exp = data.exp or 0
|
||||
self.bought = data.bought
|
||||
self.claimed = data.claimed or {}
|
||||
self.claimedCount = 0
|
||||
for k, v in pairs(self.claimed) do
|
||||
if v then
|
||||
self.claimedCount = self.claimedCount + 1
|
||||
end
|
||||
end
|
||||
self.proClaimed = data.pro_claimed or {}
|
||||
self.proClaimedCount = 0
|
||||
for k, v in pairs(self.proClaimed) do
|
||||
if v then
|
||||
self.proClaimedCount = self.proClaimedCount + 1
|
||||
end
|
||||
end
|
||||
self.endTime = 0
|
||||
self:initBountyTime()
|
||||
self:initBountyLevelCfg()
|
||||
@ -72,9 +84,11 @@ function BountyData:checkNextSeason()
|
||||
for k, v in pairs(self.claimed) do
|
||||
self.claimed[k] = false
|
||||
end
|
||||
self.claimedCount = 0
|
||||
for k, v in pairs(self.proClaimed) do
|
||||
self.proClaimed[k] = false
|
||||
end
|
||||
self.proClaimedCount = 0
|
||||
self:initBountyLevelCfg()
|
||||
end
|
||||
|
||||
@ -132,6 +146,10 @@ function BountyData:getBannerName()
|
||||
return "bounty_btn_main_1"
|
||||
end
|
||||
|
||||
function BountyData:getRewardBannerName()
|
||||
return "bounty_btn_main_0"
|
||||
end
|
||||
|
||||
function BountyData:getSeason()
|
||||
return self.season
|
||||
end
|
||||
@ -160,6 +178,19 @@ function BountyData:getIfCanBuyLevel()
|
||||
return false
|
||||
end
|
||||
|
||||
function BountyData:getIfCanClaimReward()
|
||||
if not self:getIsOpen() then
|
||||
return false
|
||||
end
|
||||
if self.claimedCount < self.level then
|
||||
return true
|
||||
end
|
||||
if self.bought and self.proClaimedCount < self:getMaxLevel() then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function BountyData:getIfCanClaimRepeatReward()
|
||||
local maxLevel = self:getMaxLevel()
|
||||
if maxLevel <= 0 then
|
||||
@ -172,12 +203,20 @@ function BountyData:getIfCanClaimRepeatReward()
|
||||
end
|
||||
|
||||
function BountyData:onClaimReward(level)
|
||||
if self.claimed[level] then
|
||||
return
|
||||
end
|
||||
self.claimed[level] = true
|
||||
self.claimedCount = self.claimedCount + 1
|
||||
self:markDirty()
|
||||
end
|
||||
|
||||
function BountyData:onClaimProReward(level)
|
||||
if self.proClaimed[level] then
|
||||
return
|
||||
end
|
||||
self.proClaimed[level] = true
|
||||
self.proClaimedCount = self.proClaimedCount + 1
|
||||
self:markDirty()
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user