代码重命名
This commit is contained in:
parent
b76db94a30
commit
5ab6aac2b6
@ -84,7 +84,7 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
PLAYER_LV_UP = "PlayerLvUp",
|
PLAYER_LV_UP = "PlayerLvUp",
|
||||||
GOLD_PIG = "GoldPig",
|
GOLD_PIG = "GoldPig",
|
||||||
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
||||||
LEVEL_FUND = "LevelFund",
|
GROWTH_FUND = "GrowthFund",
|
||||||
GROW_UP_GIFT = "GrowUpGift", -- 成长礼包
|
GROW_UP_GIFT = "GrowUpGift", -- 成长礼包
|
||||||
SEVEN_DAY_TASK = "SevenDayTask",
|
SEVEN_DAY_TASK = "SevenDayTask",
|
||||||
SEVEN_DAY_STEP_REWARD = "SevenDayStepReward",
|
SEVEN_DAY_STEP_REWARD = "SevenDayStepReward",
|
||||||
@ -137,7 +137,7 @@ BIReport.GIFT_TYPE = {
|
|||||||
GOLD_PIG = "GoldPig",
|
GOLD_PIG = "GoldPig",
|
||||||
MALL_TREASURE = "MallTreasure",
|
MALL_TREASURE = "MallTreasure",
|
||||||
ACT_CHAPTER_STORE = "ActChapterStore",
|
ACT_CHAPTER_STORE = "ActChapterStore",
|
||||||
LEVEL_FUND = "LevelFund",
|
GROWTH_FUND = "GrowthFund",
|
||||||
GROW_UP_GIFT = "GrowUpGift",
|
GROW_UP_GIFT = "GrowUpGift",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ function DataManager:init()
|
|||||||
self:initManager("TaskData", "app/userdata/task/task_data")
|
self:initManager("TaskData", "app/userdata/task/task_data")
|
||||||
self:initManager("DailyTaskData", "app/userdata/task/daily_task_data")
|
self:initManager("DailyTaskData", "app/userdata/task/daily_task_data")
|
||||||
self:initManager("IdleData", "app/userdata/idle/idle_data")
|
self:initManager("IdleData", "app/userdata/idle/idle_data")
|
||||||
self:initManager("FundData", "app/userdata/fund/fund_data")
|
self:initManager("GrowthFundData", "app/userdata/fund/growth_fund_data")
|
||||||
self:initManager("SevenDayData", "app/userdata/activity/seven_day/seven_day_data")
|
self:initManager("SevenDayData", "app/userdata/activity/seven_day/seven_day_data")
|
||||||
self:initManager("ShopData", "app/userdata/shop/shop_data")
|
self:initManager("ShopData", "app/userdata/shop/shop_data")
|
||||||
self:initManager("SummonData", "app/userdata/summon/summon_data")
|
self:initManager("SummonData", "app/userdata/summon/summon_data")
|
||||||
@ -92,7 +92,7 @@ function DataManager:clear()
|
|||||||
self.BountyData:clear()
|
self.BountyData:clear()
|
||||||
self.DailyTaskData:clear()
|
self.DailyTaskData:clear()
|
||||||
self.IdleData:clear()
|
self.IdleData:clear()
|
||||||
self.FundData:clear()
|
self.GrowthFundData:clear()
|
||||||
self.SevenDayData:clear()
|
self.SevenDayData:clear()
|
||||||
self.ShopData:clear()
|
self.ShopData:clear()
|
||||||
self.SummonData:clear()
|
self.SummonData:clear()
|
||||||
@ -136,7 +136,7 @@ function DataManager:initWithServerData(data)
|
|||||||
self.SummonData:init(data.summon, true)
|
self.SummonData:init(data.summon, true)
|
||||||
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据
|
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据
|
||||||
if data.fund then
|
if data.fund then
|
||||||
self.FundData:init(data.fund.funds)
|
self.GrowthFundData:init(data.fund.funds)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 任务数据最后初始化,依赖其他模块的数据
|
-- 任务数据最后初始化,依赖其他模块的数据
|
||||||
|
|||||||
@ -15,7 +15,7 @@ PayManager.PURCHARSE_ACT_TYPE = {
|
|||||||
COIN_GIFT = 2,
|
COIN_GIFT = 2,
|
||||||
BEGINNER_GIFT = 4,
|
BEGINNER_GIFT = 4,
|
||||||
LEVEL_UP_GIFT = 5,
|
LEVEL_UP_GIFT = 5,
|
||||||
LEVEL_FUND = 6,
|
GROWTH_FUND = 6,
|
||||||
BOUNTY = 7,
|
BOUNTY = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ PayManager.BI_ITEM_GET_TYPE = {
|
|||||||
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND] = BIReport.ITEM_GET_TYPE.LEVEL_FUND,
|
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.ITEM_GET_TYPE.GROWTH_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
||||||
@ -48,7 +48,7 @@ PayManager.BI_GIFT_TYPE = {
|
|||||||
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND] = BIReport.GIFT_TYPE.LEVEL_FUND,
|
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.GIFT_TYPE.GROWTH_FUND,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
local FundManager = class("FundManager", BaseModule)
|
local FundManager = class("FundManager", BaseModule)
|
||||||
|
|
||||||
function FundManager:showLevelFundUI()
|
function FundManager:showLevelFundUI()
|
||||||
UIManager:showUI("app/ui/fund/level_fund_ui")
|
UIManager:showUI("app/ui/fund/growth_fund_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundManager:buyLevelFund(id)
|
function FundManager:buyLevelFund(id)
|
||||||
if not DataManager.FundData:getIsOpen() then
|
if not DataManager.GrowthFundData:getIsOpen() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||||
@ -14,15 +14,15 @@ end
|
|||||||
function FundManager:claimFundRewards()
|
function FundManager:claimFundRewards()
|
||||||
local claimRewards = {}
|
local claimRewards = {}
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
local FundData = DataManager.FundData
|
local GrowthFundData = DataManager.GrowthFundData
|
||||||
local levelInfoIds = FundData:getCurrLevelInfoList()
|
local gradeInfoIds = GrowthFundData:getCurrGradeInfoList()
|
||||||
local isBoughtBase = FundData:getIsBoughtBase()
|
local isBoughtBase = GrowthFundData:getIsBoughtBase()
|
||||||
local isBoughtAdvance = FundData:getIsBoughtAdvance()
|
local isBoughtAdvance = GrowthFundData:getIsBoughtAdvance()
|
||||||
local freeClaimed = FundData:getFreeClaimedMap()
|
local freeClaimed = GrowthFundData:getFreeClaimedMap()
|
||||||
local baseClaimed = FundData:getBaseClaimedMap()
|
local baseClaimed = GrowthFundData:getBaseClaimedMap()
|
||||||
local advanceClaimed = FundData:getAdvanceClaimedMap()
|
local advanceClaimed = GrowthFundData:getAdvanceClaimedMap()
|
||||||
for _, id in ipairs(levelInfoIds) do
|
for _, id in ipairs(gradeInfoIds) do
|
||||||
local levelFundInfo = FundData:getLevelFundCfg()[id]
|
local levelFundInfo = GrowthFundData:getLevelFundCfg()[id]
|
||||||
if levelFundInfo then
|
if levelFundInfo then
|
||||||
if playerLevel >= levelFundInfo.level then -- 等级到了
|
if playerLevel >= levelFundInfo.level then -- 等级到了
|
||||||
if not freeClaimed[id] then -- 能领但是没有领
|
if not freeClaimed[id] then -- 能领但是没有领
|
||||||
@ -66,7 +66,7 @@ function FundManager:onClaimFundRewards(result)
|
|||||||
if result.rewards then
|
if result.rewards then
|
||||||
GFunc.showRewardBox(result.rewards)
|
GFunc.showRewardBox(result.rewards)
|
||||||
end
|
end
|
||||||
DataManager.FundData:onClaimFundRewards(result.id_with_lv)
|
DataManager.GrowthFundData:onClaimFundRewards(result.id_with_lv)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ MainCityConst.LEFT_SIDE_BARS = {
|
|||||||
|
|
||||||
MainCityConst.RIGHT_SIDE_BARS = {
|
MainCityConst.RIGHT_SIDE_BARS = {
|
||||||
"app/ui/main_city/cell/side_bar_gold_pig_cell",
|
"app/ui/main_city/cell/side_bar_gold_pig_cell",
|
||||||
"app/ui/main_city/cell/side_bar_level_fund_cell",
|
"app/ui/main_city/cell/side_bar_growth_fund_cell",
|
||||||
"app/ui/main_city/cell/side_bar_beginner_gift_cell",
|
"app/ui/main_city/cell/side_bar_beginner_gift_cell",
|
||||||
"app/ui/main_city/cell/side_bar_grow_up_gift_1_cell",
|
"app/ui/main_city/cell/side_bar_grow_up_gift_1_cell",
|
||||||
"app/ui/main_city/cell/side_bar_grow_up_gift_2_cell",
|
"app/ui/main_city/cell/side_bar_grow_up_gift_2_cell",
|
||||||
|
|||||||
@ -1,60 +1,60 @@
|
|||||||
local LevelFundCell = class("LevelFundCell", BaseCell)
|
local GrowthFundCell = class("GrowthFundCell", BaseCell)
|
||||||
|
|
||||||
local Fund_REWARD_CELL = "app/ui/fund/cell/level_fund_reward_cell"
|
local Fund_REWARD_CELL = "app/ui/fund/cell/growth_fund_reward_cell"
|
||||||
|
|
||||||
function LevelFundCell:init()
|
function GrowthFundCell:init()
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
local width = GConst.UI_SCREEN_WIDTH
|
local width = GConst.UI_SCREEN_WIDTH
|
||||||
|
|
||||||
self.fundRewardCell1 = uiMap["level_fund_cell.fund_reward_cell_1"]:addLuaComponent(Fund_REWARD_CELL)
|
self.fundRewardCell1 = uiMap["growth_fund_cell.fund_reward_cell_1"]:addLuaComponent(Fund_REWARD_CELL)
|
||||||
self.fundRewardCell1:setAnchoredPositionX(-width/3)
|
self.fundRewardCell1:setAnchoredPositionX(-width/3)
|
||||||
self.fundRewardCell1:addClickListener(function()
|
self.fundRewardCell1:addClickListener(function()
|
||||||
if self.fundId == nil then
|
if self.fundId == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId)
|
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
|
||||||
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
|
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
if not iCslaimed and playerLevel >= needLevel then
|
if not iCslaimed and playerLevel >= needLevel then
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
ModuleManager.FundManager:claimFundRewards()
|
||||||
else
|
else
|
||||||
local freeReward = DataManager.FundData:getFreeFundRewards(self.fundId)
|
local freeReward = DataManager.GrowthFundData:getFreeFundRewards(self.fundId)
|
||||||
local reward = freeReward and freeReward[1]
|
local reward = freeReward and freeReward[1]
|
||||||
if reward then
|
if reward then
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell1:getBaseObject())
|
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell1:getBaseObject())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self.fundRewardCell2 = uiMap["level_fund_cell.fund_reward_cell_2"]:addLuaComponent(Fund_REWARD_CELL)
|
self.fundRewardCell2 = uiMap["growth_fund_cell.fund_reward_cell_2"]:addLuaComponent(Fund_REWARD_CELL)
|
||||||
self.fundRewardCell2:addClickListener(function()
|
self.fundRewardCell2:addClickListener(function()
|
||||||
if self.fundId == nil then
|
if self.fundId == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId)
|
local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId)
|
||||||
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
|
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
if not iCslaimed and playerLevel >= needLevel and DataManager.FundData:getIsBoughtBase(self.fundId) then
|
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtBase(self.fundId) then
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
ModuleManager.FundManager:claimFundRewards()
|
||||||
else
|
else
|
||||||
local baseReward = DataManager.FundData:getBaseFundRewards(self.fundId)
|
local baseReward = DataManager.GrowthFundData:getBaseFundRewards(self.fundId)
|
||||||
local reward = baseReward and baseReward[1]
|
local reward = baseReward and baseReward[1]
|
||||||
if reward then
|
if reward then
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell2:getBaseObject())
|
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell2:getBaseObject())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self.fundRewardCell3 = uiMap["level_fund_cell.fund_reward_cell_3"]:addLuaComponent(Fund_REWARD_CELL)
|
self.fundRewardCell3 = uiMap["growth_fund_cell.fund_reward_cell_3"]:addLuaComponent(Fund_REWARD_CELL)
|
||||||
self.fundRewardCell3:addClickListener(function()
|
self.fundRewardCell3:addClickListener(function()
|
||||||
if self.fundId == nil then
|
if self.fundId == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local iCslaimed = DataManager.FundData:getIsClaimedAdvance(self.fundId)
|
local iCslaimed = DataManager.GrowthFundData:getIsClaimedAdvance(self.fundId)
|
||||||
local needLevel = DataManager.FundData:getNeedLevel(self.fundId)
|
local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId)
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
if not iCslaimed and playerLevel >= needLevel and DataManager.FundData:getIsBoughtAdvance(self.fundId) then
|
if not iCslaimed and playerLevel >= needLevel and DataManager.GrowthFundData:getIsBoughtAdvance(self.fundId) then
|
||||||
ModuleManager.FundManager:claimFundRewards()
|
ModuleManager.FundManager:claimFundRewards()
|
||||||
else
|
else
|
||||||
local advanceReward = DataManager.FundData:getAdvanceFundRewards(self.fundId)
|
local advanceReward = DataManager.GrowthFundData:getAdvanceFundRewards(self.fundId)
|
||||||
local reward = advanceReward and advanceReward[1]
|
local reward = advanceReward and advanceReward[1]
|
||||||
if reward then
|
if reward then
|
||||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell3:getBaseObject())
|
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell3:getBaseObject())
|
||||||
@ -62,28 +62,28 @@ function LevelFundCell:init()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self.fundRewardCell3:setAnchoredPositionX(width/3)
|
self.fundRewardCell3:setAnchoredPositionX(width/3)
|
||||||
self.levelBg = uiMap["level_fund_cell.lv_bg"]
|
self.levelBg = uiMap["growth_fund_cell.lv_bg"]
|
||||||
self.levelBg:setAnchoredPositionX(-width/6)
|
self.levelBg:setAnchoredPositionX(-width/6)
|
||||||
self.levelGrayImg = uiMap["level_fund_cell.lv_bg.gray"]
|
self.levelGrayImg = uiMap["growth_fund_cell.lv_bg.gray"]
|
||||||
self.levelTx = uiMap["level_fund_cell.lv_bg.tx"]
|
self.levelTx = uiMap["growth_fund_cell.lv_bg.tx"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundCell:refresh(id)
|
function GrowthFundCell:refresh(id)
|
||||||
self.fundId = id
|
self.fundId = id
|
||||||
local FundData = DataManager.FundData
|
local GrowthFundData = DataManager.GrowthFundData
|
||||||
local needLevel = DataManager.FundData:getNeedLevel(id)
|
local needLevel = DataManager.GrowthFundData:getNeedLevel(id)
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
local isActive = playerLevel >= needLevel
|
local isActive = playerLevel >= needLevel
|
||||||
self.levelGrayImg:setVisible(not isActive)
|
self.levelGrayImg:setVisible(not isActive)
|
||||||
self.levelTx:setText(GFunc.intToString(needLevel))
|
self.levelTx:setText(GFunc.intToString(needLevel))
|
||||||
local freeReward, baseReward, advanceReward = FundData:getAllStepFundRewards(id)
|
local freeReward, baseReward, advanceReward = GrowthFundData:getAllStepFundRewards(id)
|
||||||
self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, FundData:getIsClaimedFree(id))
|
self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, GrowthFundData:getIsClaimedFree(id))
|
||||||
self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not FundData:getIsBoughtBase(id), FundData:getIsClaimedBase(id))
|
self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not GrowthFundData:getIsBoughtBase(id), GrowthFundData:getIsClaimedBase(id))
|
||||||
self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not FundData:getIsBoughtAdvance(id), FundData:getIsClaimedAdvance(id))
|
self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not GrowthFundData:getIsBoughtAdvance(id), GrowthFundData:getIsClaimedAdvance(id))
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundCell:setVisible(visible)
|
function GrowthFundCell:setVisible(visible)
|
||||||
self.baseObject:setVisible(visible)
|
self.baseObject:setVisible(visible)
|
||||||
end
|
end
|
||||||
|
|
||||||
return LevelFundCell
|
return GrowthFundCell
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 3380bc95e342186458dd56f3cdd4e4f0
|
guid: 2bc37d625f652654b83c5cedaaa8c2f1
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
local LevelFundRewardCell = class("LevelFundRewardCell", BaseCell)
|
local GrowthFundRewardCell = class("GrowthFundRewardCell", BaseCell)
|
||||||
|
|
||||||
function LevelFundRewardCell:init()
|
function GrowthFundRewardCell:init()
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
self.bg = uiMap["fund_reward_cell.bg"]
|
self.bg = uiMap["fund_reward_cell.bg"]
|
||||||
self.icon = uiMap["fund_reward_cell.icon"]
|
self.icon = uiMap["fund_reward_cell.icon"]
|
||||||
@ -18,7 +18,7 @@ function LevelFundRewardCell:init()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:refresh(reward, step, isLock, showCheck)
|
function GrowthFundRewardCell:refresh(reward, step, isLock, showCheck)
|
||||||
if step == 0 then
|
if step == 0 then
|
||||||
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_5")
|
self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_5")
|
||||||
elseif step == 1 then
|
elseif step == 1 then
|
||||||
@ -49,7 +49,7 @@ function LevelFundRewardCell:refresh(reward, step, isLock, showCheck)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:_refreshItem(item)
|
function GrowthFundRewardCell:_refreshItem(item)
|
||||||
local info = ConfigManager:getConfig("item")[item.id]
|
local info = ConfigManager:getConfig("item")[item.id]
|
||||||
if info == nil then
|
if info == nil then
|
||||||
return
|
return
|
||||||
@ -71,20 +71,20 @@ function LevelFundRewardCell:_refreshItem(item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:setVisible(visible)
|
function GrowthFundRewardCell:setVisible(visible)
|
||||||
self.baseObject:setActive(visible)
|
self.baseObject:setActive(visible)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:setAnchoredPositionX(x)
|
function GrowthFundRewardCell:setAnchoredPositionX(x)
|
||||||
self.baseObject:setAnchoredPositionX(x)
|
self.baseObject:setAnchoredPositionX(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:setTouchEnable(enable)
|
function GrowthFundRewardCell:setTouchEnable(enable)
|
||||||
self.baseObject:setTouchEnable(enable)
|
self.baseObject:setTouchEnable(enable)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundRewardCell:addClickListener(callback)
|
function GrowthFundRewardCell:addClickListener(callback)
|
||||||
self.clickCallback = callback
|
self.clickCallback = callback
|
||||||
end
|
end
|
||||||
|
|
||||||
return LevelFundRewardCell
|
return GrowthFundRewardCell
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 7f29b4252c5aeb64abafe246ea6c16e5
|
guid: 3e3a08bdfecbd8b49ada85fa70fe5c8b
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
local LevelFundUI = class("LevelFundUI", BaseUI)
|
local GrowthFundUI = class("GrowthFundUI", BaseUI)
|
||||||
|
|
||||||
function LevelFundUI:isFullScreen()
|
function GrowthFundUI:isFullScreen()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:getCurrencyParams()
|
function GrowthFundUI:getCurrencyParams()
|
||||||
if self.currencyParams == nil then
|
if self.currencyParams == nil then
|
||||||
self.currencyParams = {
|
self.currencyParams = {
|
||||||
itemIds = {
|
itemIds = {
|
||||||
@ -18,21 +18,21 @@ function LevelFundUI:getCurrencyParams()
|
|||||||
return self.currencyParams
|
return self.currencyParams
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:getPrefabPath()
|
function GrowthFundUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/fund/level_fund_ui.prefab"
|
return "assets/prefabs/ui/fund/growth_fund_ui.prefab"
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:ctor()
|
function GrowthFundUI:ctor()
|
||||||
self.fundLevel = DataManager.FundData:getFundLevel()
|
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
|
||||||
self:initLevelInfoList()
|
self:initGradeInfoList()
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:initLevelInfoList()
|
function GrowthFundUI:initGradeInfoList()
|
||||||
self.levelInfoList = DataManager.FundData:getCurrLevelInfoList()
|
self.gradeInfoList = DataManager.GrowthFundData:getCurrGradeInfoList()
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
local cfg = ConfigManager:getConfig("act_level_fund")
|
local cfg = ConfigManager:getConfig("act_level_fund")
|
||||||
self.inactiveIndex = nil
|
self.inactiveIndex = nil
|
||||||
for k, v in ipairs(self.levelInfoList) do
|
for k, v in ipairs(self.gradeInfoList) do
|
||||||
if cfg[v] then
|
if cfg[v] then
|
||||||
if playerLevel < cfg[v].level then
|
if playerLevel < cfg[v].level then
|
||||||
self.inactiveIndex = k
|
self.inactiveIndex = k
|
||||||
@ -41,20 +41,20 @@ function LevelFundUI:initLevelInfoList()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if self.inactiveIndex == nil then
|
if self.inactiveIndex == nil then
|
||||||
self.inactiveIndex = #self.levelInfoList + 1
|
self.inactiveIndex = #self.gradeInfoList + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:onClose()
|
function GrowthFundUI:onClose()
|
||||||
if self.originTitleBgHeight then
|
if self.originTitleBgHeight then
|
||||||
self.uiMap["level_fund_ui.title_img.bg"]:setSizeDeltaY(self.originTitleBgHeight)
|
self.uiMap["growth_fund_ui.title_img.bg"]:setSizeDeltaY(self.originTitleBgHeight)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:onLoadRootComplete()
|
function GrowthFundUI:onLoadRootComplete()
|
||||||
self.uiMap = self.root:genAllChildren()
|
self.uiMap = self.root:genAllChildren()
|
||||||
|
|
||||||
self.uiMap["level_fund_ui.down.close_btn"]:addClickListener(function()
|
self.uiMap["growth_fund_ui.down.close_btn"]:addClickListener(function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -64,77 +64,77 @@ function LevelFundUI:onLoadRootComplete()
|
|||||||
self:bindData()
|
self:bindData()
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:initTitle()
|
function GrowthFundUI:initTitle()
|
||||||
self.titleTx = self.uiMap["level_fund_ui.title_img.title_tx"]
|
self.titleTx = self.uiMap["growth_fund_ui.title_img.title_tx"]
|
||||||
self.titleDialogBg = self.uiMap["level_fund_ui.title_img.bg"]
|
self.titleDialogBg = self.uiMap["growth_fund_ui.title_img.bg"]
|
||||||
self.originTitleBgHeight = self.titleDialogBg:fastGetSizeDeltaY()
|
self.originTitleBgHeight = self.titleDialogBg:fastGetSizeDeltaY()
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:initPayBtns()
|
function GrowthFundUI:initPayBtns()
|
||||||
local width = GConst.UI_SCREEN_WIDTH
|
local width = GConst.UI_SCREEN_WIDTH
|
||||||
|
|
||||||
local freeTx = self.uiMap["level_fund_ui.title_bg_2.free_tx"]
|
local freeTx = self.uiMap["growth_fund_ui.title_bg_2.free_tx"]
|
||||||
freeTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE))
|
freeTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE))
|
||||||
freeTx:setAnchoredPositionX(-width/3)
|
freeTx:setAnchoredPositionX(-width/3)
|
||||||
|
|
||||||
self.payBtn1 = self.uiMap["level_fund_ui.title_bg_2.btn_1"]
|
self.payBtn1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1"]
|
||||||
self.payBtn1:addClickListener(function()
|
self.payBtn1:addClickListener(function()
|
||||||
ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundBaseId())
|
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundBaseId())
|
||||||
end)
|
end)
|
||||||
self.payBtnTx1 = self.uiMap["level_fund_ui.title_bg_2.btn_1.text"]
|
self.payBtnTx1 = self.uiMap["growth_fund_ui.title_bg_2.btn_1.text"]
|
||||||
|
|
||||||
self.payBtn2 = self.uiMap["level_fund_ui.title_bg_2.btn_2"]
|
self.payBtn2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2"]
|
||||||
self.payBtn2:setAnchoredPositionX(width/3)
|
self.payBtn2:setAnchoredPositionX(width/3)
|
||||||
self.payBtn2:addClickListener(function()
|
self.payBtn2:addClickListener(function()
|
||||||
ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundAdvanceId())
|
ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundAdvanceId())
|
||||||
end)
|
end)
|
||||||
self.payBtnTx2 = self.uiMap["level_fund_ui.title_bg_2.btn_2.text"]
|
self.payBtnTx2 = self.uiMap["growth_fund_ui.title_bg_2.btn_2.text"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:initRewards()
|
function GrowthFundUI:initRewards()
|
||||||
self.scrollRect = self.uiMap["level_fund_ui.scrollrect"]
|
self.scrollRect = self.uiMap["growth_fund_ui.scrollrect"]
|
||||||
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
self.scrollRectComp:addInitCallback(function()
|
self.scrollRectComp:addInitCallback(function()
|
||||||
return "app/ui/fund/cell/level_fund_cell"
|
return "app/ui/fund/cell/growth_fund_cell"
|
||||||
end)
|
end)
|
||||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||||
cell:refresh(self.levelInfoList[index])
|
cell:refresh(self.gradeInfoList[index])
|
||||||
end)
|
end)
|
||||||
self.scrollRectComp:clearCells()
|
self.scrollRectComp:clearCells()
|
||||||
self.scrollRectComp:setTotalCount(0)
|
self.scrollRectComp:setTotalCount(0)
|
||||||
|
|
||||||
self.progressBg = self.uiMap["level_fund_ui.scrollrect.viewport.content.progress_bg"]
|
self.progressBg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg"]
|
||||||
self.progressComp = self.uiMap["level_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
self.progressComp = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||||
self.grayImg = self.uiMap["level_fund_ui.scrollrect.viewport.content.gray_img"]
|
self.grayImg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.gray_img"]
|
||||||
self.horizontalLine = self.uiMap["level_fund_ui.scrollrect.viewport.content.line_img"]
|
self.horizontalLine = self.uiMap["growth_fund_ui.scrollrect.viewport.content.line_img"]
|
||||||
self.verticalLine1 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_1"]
|
self.verticalLine1 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_1"]
|
||||||
self.verticalLine2 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_2"]
|
self.verticalLine2 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_2"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:bindData()
|
function GrowthFundUI:bindData()
|
||||||
self:bind(DataManager.FundData, "dirty", function()
|
self:bind(DataManager.GrowthFundData, "dirty", function()
|
||||||
if self.fundLevel ~= DataManager.FundData:getFundLevel() then
|
if self.fundGrade ~= DataManager.GrowthFundData:getFundGrade() then
|
||||||
self.fundLevel = DataManager.FundData:getFundLevel()
|
self.fundGrade = DataManager.GrowthFundData:getFundGrade()
|
||||||
self:initLevelInfoList()
|
self:initGradeInfoList()
|
||||||
end
|
end
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:onRefresh()
|
function GrowthFundUI:onRefresh()
|
||||||
self:refreshTitle()
|
self:refreshTitle()
|
||||||
self:refreshPayBtns()
|
self:refreshPayBtns()
|
||||||
self:refreshRewards()
|
self:refreshRewards()
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:refreshTitle()
|
function GrowthFundUI:refreshTitle()
|
||||||
local fundLevel = DataManager.FundData:getFundLevel()
|
local fundGrade = DataManager.GrowthFundData:getFundGrade()
|
||||||
if fundLevel == 1 then
|
if fundGrade == 1 then
|
||||||
self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png")
|
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png")
|
||||||
elseif fundLevel == 2 then
|
elseif fundGrade == 2 then
|
||||||
self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png")
|
self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png")
|
||||||
end
|
end
|
||||||
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_FUND_DESC_1, fundLevel))
|
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.LEVEL_FUND_DESC_1, fundGrade))
|
||||||
local height = self.titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight + 58
|
local height = self.titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight + 58
|
||||||
if height < self.originTitleBgHeight then
|
if height < self.originTitleBgHeight then
|
||||||
height = self.originTitleBgHeight
|
height = self.originTitleBgHeight
|
||||||
@ -142,17 +142,17 @@ function LevelFundUI:refreshTitle()
|
|||||||
self.titleDialogBg:setSizeDeltaY(height)
|
self.titleDialogBg:setSizeDeltaY(height)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:refreshPayBtns()
|
function GrowthFundUI:refreshPayBtns()
|
||||||
if not DataManager.FundData:getIsBoughtBase() then
|
if not DataManager.GrowthFundData:getIsBoughtBase() then
|
||||||
local rechargeId = DataManager.FundData:getCurrLevelBaseRechargeId()
|
local rechargeId = DataManager.GrowthFundData:getCurrGradeBaseRechargeId()
|
||||||
self.payBtnTx1:setText(GFunc.getFormatPrice(rechargeId))
|
self.payBtnTx1:setText(GFunc.getFormatPrice(rechargeId))
|
||||||
self.payBtn1:setTouchEnable(true)
|
self.payBtn1:setTouchEnable(true)
|
||||||
else
|
else
|
||||||
self.payBtnTx1:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE))
|
self.payBtnTx1:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE))
|
||||||
self.payBtn1:setTouchEnable(false)
|
self.payBtn1:setTouchEnable(false)
|
||||||
end
|
end
|
||||||
if not DataManager.FundData:getIsBoughtAdvance() then
|
if not DataManager.GrowthFundData:getIsBoughtAdvance() then
|
||||||
local rechargeId = DataManager.FundData:getCurrLevelAdvanceRechargeId()
|
local rechargeId = DataManager.GrowthFundData:getCurrGradeAdvanceRechargeId()
|
||||||
self.payBtnTx2:setText(GFunc.getFormatPrice(rechargeId))
|
self.payBtnTx2:setText(GFunc.getFormatPrice(rechargeId))
|
||||||
self.payBtn2:setTouchEnable(true)
|
self.payBtn2:setTouchEnable(true)
|
||||||
else
|
else
|
||||||
@ -161,11 +161,11 @@ function LevelFundUI:refreshPayBtns()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelFundUI:refreshRewards()
|
function GrowthFundUI:refreshRewards()
|
||||||
local count = #self.levelInfoList
|
local count = #self.gradeInfoList
|
||||||
if self.scrollRectComp:getTotalCount() <= 0 then
|
if self.scrollRectComp:getTotalCount() <= 0 then
|
||||||
self.scrollRectComp:refillCells(count)
|
self.scrollRectComp:refillCells(count)
|
||||||
local minIndex = DataManager.FundData:getMinUnclaimedRewardIndex()
|
local minIndex = DataManager.GrowthFundData:getMinUnclaimedRewardIndex()
|
||||||
if minIndex > 1 then
|
if minIndex > 1 then
|
||||||
self.scrollRectComp:moveToIndex(minIndex)
|
self.scrollRectComp:moveToIndex(minIndex)
|
||||||
end
|
end
|
||||||
@ -200,4 +200,4 @@ function LevelFundUI:refreshRewards()
|
|||||||
self.horizontalLine:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth)
|
self.horizontalLine:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth)
|
||||||
end
|
end
|
||||||
|
|
||||||
return LevelFundUI
|
return GrowthFundUI
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 14a96472379bd3b45a9544e750fa0f10
|
guid: 5a975799c3c9cc14fafc8e2c8d9cf4a7
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
24
lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua
Normal file
24
lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
|
||||||
|
local SideBarGrowthFundCell = class("SideBarGrowthFundCell", SideBarBaseCellComp)
|
||||||
|
|
||||||
|
function SideBarGrowthFundCell:getIsOpen()
|
||||||
|
return DataManager.GrowthFundData:getIsOpen()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SideBarGrowthFundCell:getIconRes()
|
||||||
|
return "main_btn_fund"
|
||||||
|
end
|
||||||
|
|
||||||
|
function SideBarGrowthFundCell:onClick()
|
||||||
|
ModuleManager.FundManager:showLevelFundUI()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SideBarGrowthFundCell:getIsShowRedPoint()
|
||||||
|
return DataManager.GrowthFundData:getIfCanClaimReward()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SideBarGrowthFundCell:getHasShake()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return SideBarGrowthFundCell
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b6e1fcafc8ff9f4459edefaa8e079e3e
|
guid: 89fd1069c28a504499e23bd0718b4d8a
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -1,24 +0,0 @@
|
|||||||
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
|
|
||||||
local SideBarLevelFundCell = class("SideBarLevelFundCell", SideBarBaseCellComp)
|
|
||||||
|
|
||||||
function SideBarLevelFundCell:getIsOpen()
|
|
||||||
return DataManager.FundData:getIsOpen()
|
|
||||||
end
|
|
||||||
|
|
||||||
function SideBarLevelFundCell:getIconRes()
|
|
||||||
return "main_btn_fund"
|
|
||||||
end
|
|
||||||
|
|
||||||
function SideBarLevelFundCell:onClick()
|
|
||||||
ModuleManager.FundManager:showLevelFundUI()
|
|
||||||
end
|
|
||||||
|
|
||||||
function SideBarLevelFundCell:getIsShowRedPoint()
|
|
||||||
return DataManager.FundData:getIfCanClaimReward()
|
|
||||||
end
|
|
||||||
|
|
||||||
function SideBarLevelFundCell:getHasShake()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return SideBarLevelFundCell
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d9943057ffc3dd541bfff544d512abee
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
|
||||||
@ -1,16 +1,16 @@
|
|||||||
local FundData = class("FundData", BaseData)
|
local GrowthFundData = class("GrowthFundData", BaseData)
|
||||||
|
|
||||||
local ACT_GIFT_FUND_BASE_ID_1 = 60202
|
local ACT_GIFT_FUND_BASE_ID_1 = 60202
|
||||||
local ACT_GIFT_FUND_BASE_ID_2 = 60402
|
local ACT_GIFT_FUND_BASE_ID_2 = 60402
|
||||||
local ACT_GIFT_FUND_ADVANCE_ID_1 = 60102
|
local ACT_GIFT_FUND_ADVANCE_ID_1 = 60102
|
||||||
local ACT_GIFT_FUND_ADVANCE_ID_2 = 60302
|
local ACT_GIFT_FUND_ADVANCE_ID_2 = 60302
|
||||||
|
|
||||||
function FundData:ctor()
|
function GrowthFundData:ctor()
|
||||||
self.data.dirty = false
|
self.data.dirty = false
|
||||||
self.isClaimAll = false
|
self.isClaimAll = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:init(data)
|
function GrowthFundData:init(data)
|
||||||
data = data or GConst.EMPTY_TABLE
|
data = data or GConst.EMPTY_TABLE
|
||||||
|
|
||||||
self.freeClaimed = {}
|
self.freeClaimed = {}
|
||||||
@ -37,51 +37,51 @@ function FundData:init(data)
|
|||||||
self.advanceClaimedCount = self.advanceClaimedCount + 1
|
self.advanceClaimedCount = self.advanceClaimedCount + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:initLevelInfo()
|
self:initGrowthInfo()
|
||||||
self:initFundLevel()
|
self:initFundGrade()
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:initLevelInfo()
|
function GrowthFundData:initGrowthInfo()
|
||||||
if not self.levelInfoMap then
|
if not self.growthInfoMap then
|
||||||
self.levelInfoMap = {}
|
self.growthInfoMap = {}
|
||||||
local cfg = self:getLevelFundCfg()
|
local cfg = self:getLevelFundCfg()
|
||||||
for id, info in pairs(cfg) do
|
for id, info in pairs(cfg) do
|
||||||
if not self.levelInfoMap[info.stage] then
|
if not self.growthInfoMap[info.stage] then
|
||||||
self.levelInfoMap[info.stage] = {}
|
self.growthInfoMap[info.stage] = {}
|
||||||
end
|
end
|
||||||
table.insert(self.levelInfoMap[info.stage], id)
|
table.insert(self.growthInfoMap[info.stage], id)
|
||||||
end
|
end
|
||||||
for level, _ in pairs(self.levelInfoMap) do
|
for grade, _ in pairs(self.growthInfoMap) do
|
||||||
table.sort(self.levelInfoMap[level], function(a, b)
|
table.sort(self.growthInfoMap[grade], function(a, b)
|
||||||
return a < b
|
return a < b
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:initFundLevel()
|
function GrowthFundData:initFundGrade()
|
||||||
local fundLevel = 1
|
local fundGrade = 1
|
||||||
local totalCount = 0
|
local totalCount = 0
|
||||||
while true do
|
while true do
|
||||||
local levelInfoIds = self.levelInfoMap[fundLevel]
|
local growInfoIds = self.growthInfoMap[fundGrade]
|
||||||
if levelInfoIds == nil then
|
if growInfoIds == nil then
|
||||||
fundLevel = fundLevel - 1
|
fundGrade = fundGrade - 1
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
totalCount = totalCount + #levelInfoIds
|
totalCount = totalCount + #growInfoIds
|
||||||
if self.freeClaimedCount >= totalCount and
|
if self.freeClaimedCount >= totalCount and
|
||||||
self.baseClaimedCount >= totalCount and
|
self.baseClaimedCount >= totalCount and
|
||||||
self.advanceClaimedCount >= totalCount then
|
self.advanceClaimedCount >= totalCount then
|
||||||
fundLevel = fundLevel + 1
|
fundGrade = fundGrade + 1
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fundLevel < 1 then
|
if fundGrade < 1 then
|
||||||
fundLevel = 1
|
fundGrade = 1
|
||||||
end
|
end
|
||||||
self.data.fundLevel = fundLevel
|
self.data.fundGrade = fundGrade
|
||||||
if self.data.fundLevel == 2 then
|
if self.data.fundGrade == 2 then
|
||||||
self.fundBaseId = ACT_GIFT_FUND_BASE_ID_2
|
self.fundBaseId = ACT_GIFT_FUND_BASE_ID_2
|
||||||
self.fundAdvanceId = ACT_GIFT_FUND_ADVANCE_ID_2
|
self.fundAdvanceId = ACT_GIFT_FUND_ADVANCE_ID_2
|
||||||
if self.freeClaimedCount >= totalCount and self.baseClaimedCount >= totalCount and self.advanceClaimedCount >= totalCount then
|
if self.freeClaimedCount >= totalCount and self.baseClaimedCount >= totalCount and self.advanceClaimedCount >= totalCount then
|
||||||
@ -93,58 +93,58 @@ function FundData:initFundLevel()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:markDirty()
|
function GrowthFundData:markDirty()
|
||||||
self.data.dirty = not self.data.dirty
|
self.data.dirty = not self.data.dirty
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsOpen()
|
function GrowthFundData:getIsOpen()
|
||||||
if self.isClaimAll then
|
if self.isClaimAll then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FUND, true)
|
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FUND, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getFundLevel()
|
function GrowthFundData:getFundGrade()
|
||||||
return self.data.fundLevel
|
return self.data.fundGrade
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getFundBaseId()
|
function GrowthFundData:getFundBaseId()
|
||||||
return self.fundBaseId
|
return self.fundBaseId
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getFundAdvanceId()
|
function GrowthFundData:getFundAdvanceId()
|
||||||
return self.fundAdvanceId
|
return self.fundAdvanceId
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getCurrLevelBaseRechargeId()
|
function GrowthFundData:getCurrGradeBaseRechargeId()
|
||||||
local info = self:getActGiftCfg()[self.fundBaseId]
|
local info = self:getActGiftCfg()[self.fundBaseId]
|
||||||
return info.recharge_id
|
return info.recharge_id
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getCurrLevelAdvanceRechargeId()
|
function GrowthFundData:getCurrGradeAdvanceRechargeId()
|
||||||
local info = self:getActGiftCfg()[self.fundAdvanceId]
|
local info = self:getActGiftCfg()[self.fundAdvanceId]
|
||||||
return info.recharge_id
|
return info.recharge_id
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getActGiftCfg()
|
function GrowthFundData:getActGiftCfg()
|
||||||
if self.cfg == nil then
|
if self.cfg == nil then
|
||||||
self.cfg = ConfigManager:getConfig("act_gift")
|
self.cfg = ConfigManager:getConfig("act_gift")
|
||||||
end
|
end
|
||||||
return self.cfg
|
return self.cfg
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getLevelFundCfg()
|
function GrowthFundData:getLevelFundCfg()
|
||||||
if self.levelFundCfg == nil then
|
if self.levelFundCfg == nil then
|
||||||
self.levelFundCfg = ConfigManager:getConfig("act_level_fund")
|
self.levelFundCfg = ConfigManager:getConfig("act_level_fund")
|
||||||
end
|
end
|
||||||
return self.levelFundCfg
|
return self.levelFundCfg
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getCurrLevelInfoList()
|
function GrowthFundData:getCurrGradeInfoList()
|
||||||
return self.levelInfoMap[self.data.fundLevel] or GConst.EMPTY_TABLE
|
return self.growthInfoMap[self.data.fundGrade] or GConst.EMPTY_TABLE
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getNeedLevel(id)
|
function GrowthFundData:getNeedLevel(id)
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo == nil then
|
if levelFundInfo == nil then
|
||||||
return 9999
|
return 9999
|
||||||
@ -152,7 +152,7 @@ function FundData:getNeedLevel(id)
|
|||||||
return levelFundInfo.level
|
return levelFundInfo.level
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getAllStepFundRewards(id)
|
function GrowthFundData:getAllStepFundRewards(id)
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo == nil then
|
if levelFundInfo == nil then
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
@ -160,7 +160,7 @@ function FundData:getAllStepFundRewards(id)
|
|||||||
return levelFundInfo.reward_free, levelFundInfo.reward_small, levelFundInfo.reward
|
return levelFundInfo.reward_free, levelFundInfo.reward_small, levelFundInfo.reward
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getFreeFundRewards(id)
|
function GrowthFundData:getFreeFundRewards(id)
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo == nil then
|
if levelFundInfo == nil then
|
||||||
return nil
|
return nil
|
||||||
@ -168,7 +168,7 @@ function FundData:getFreeFundRewards(id)
|
|||||||
return levelFundInfo.reward_free
|
return levelFundInfo.reward_free
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getBaseFundRewards(id)
|
function GrowthFundData:getBaseFundRewards(id)
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo == nil then
|
if levelFundInfo == nil then
|
||||||
return nil
|
return nil
|
||||||
@ -176,7 +176,7 @@ function FundData:getBaseFundRewards(id)
|
|||||||
return levelFundInfo.reward_small
|
return levelFundInfo.reward_small
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getAdvanceFundRewards(id)
|
function GrowthFundData:getAdvanceFundRewards(id)
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo == nil then
|
if levelFundInfo == nil then
|
||||||
return nil
|
return nil
|
||||||
@ -184,45 +184,45 @@ function FundData:getAdvanceFundRewards(id)
|
|||||||
return levelFundInfo.reward
|
return levelFundInfo.reward
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsBoughtBase()
|
function GrowthFundData:getIsBoughtBase()
|
||||||
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundBaseId) > 0
|
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundBaseId) > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsBoughtAdvance()
|
function GrowthFundData:getIsBoughtAdvance()
|
||||||
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundAdvanceId) > 0
|
return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundAdvanceId) > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getFreeClaimedMap()
|
function GrowthFundData:getFreeClaimedMap()
|
||||||
return self.freeClaimed
|
return self.freeClaimed
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsClaimedFree(id)
|
function GrowthFundData:getIsClaimedFree(id)
|
||||||
return self.freeClaimed[id]
|
return self.freeClaimed[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getBaseClaimedMap()
|
function GrowthFundData:getBaseClaimedMap()
|
||||||
return self.baseClaimed
|
return self.baseClaimed
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsClaimedBase(id)
|
function GrowthFundData:getIsClaimedBase(id)
|
||||||
return self.baseClaimed[id]
|
return self.baseClaimed[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getAdvanceClaimedMap()
|
function GrowthFundData:getAdvanceClaimedMap()
|
||||||
return self.advanceClaimed
|
return self.advanceClaimed
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getIsClaimedAdvance(id)
|
function GrowthFundData:getIsClaimedAdvance(id)
|
||||||
return self.advanceClaimed[id]
|
return self.advanceClaimed[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:getMinUnclaimedRewardIndex()
|
function GrowthFundData:getMinUnclaimedRewardIndex()
|
||||||
local playerLevel = DataManager.PlayerData:getLv()
|
local playerLevel = DataManager.PlayerData:getLv()
|
||||||
local levelInfoIds = self:getCurrLevelInfoList()
|
local growInfoIds = self:getCurrGradeInfoList()
|
||||||
local minIndex = 0
|
local minIndex = 0
|
||||||
local isBoughtBase = self:getIsBoughtBase()
|
local isBoughtBase = self:getIsBoughtBase()
|
||||||
local isBoughtAdvance = self:getIsBoughtAdvance()
|
local isBoughtAdvance = self:getIsBoughtAdvance()
|
||||||
for k, id in ipairs(levelInfoIds) do
|
for k, id in ipairs(growInfoIds) do
|
||||||
local levelFundInfo = self:getLevelFundCfg()[id]
|
local levelFundInfo = self:getLevelFundCfg()[id]
|
||||||
if levelFundInfo then
|
if levelFundInfo then
|
||||||
if playerLevel >= levelFundInfo.level then -- 等级到了
|
if playerLevel >= levelFundInfo.level then -- 等级到了
|
||||||
@ -251,14 +251,14 @@ function FundData:getMinUnclaimedRewardIndex()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 是否有未领取的奖励
|
-- 是否有未领取的奖励
|
||||||
function FundData:getIfCanClaimReward()
|
function GrowthFundData:getIfCanClaimReward()
|
||||||
if not self:getIsOpen() then
|
if not self:getIsOpen() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return self:getMinUnclaimedRewardIndex() > 0
|
return self:getMinUnclaimedRewardIndex() > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:onClaimFundRewards(list)
|
function GrowthFundData:onClaimFundRewards(list)
|
||||||
if list == nil then
|
if list == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -283,12 +283,12 @@ function FundData:onClaimFundRewards(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:initFundLevel()
|
self:initFundGrade()
|
||||||
self:markDirty()
|
self:markDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
function FundData:onBoughtFund()
|
function GrowthFundData:onBoughtFund()
|
||||||
self:markDirty()
|
self:markDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
return FundData
|
return GrowthFundData
|
||||||
10
lua/app/userdata/fund/growth_fund_data.lua.meta
Normal file
10
lua/app/userdata/fund/growth_fund_data.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b4b9202b724428843a59d421a713fe4b
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -100,8 +100,8 @@ function ShopData:updateGiftInfo(gift)
|
|||||||
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[giftType]
|
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[giftType]
|
||||||
if cfgName then
|
if cfgName then
|
||||||
local cfg = ConfigManager:getConfig(cfgName)
|
local cfg = ConfigManager:getConfig(cfgName)
|
||||||
if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND then
|
if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND then
|
||||||
DataManager.FundData:onBoughtFund(giftId)
|
DataManager.GrowthFundData:onBoughtFund(giftId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user