diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 6c9295e5..b671dfc5 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -84,7 +84,7 @@ BIReport.ITEM_GET_TYPE = { PLAYER_LV_UP = "PlayerLvUp", GOLD_PIG = "GoldPig", BATTLE_SKILL_REFRESH = "BattleSkillRefresh", - LEVEL_FUND = "LevelFund", + GROWTH_FUND = "GrowthFund", GROW_UP_GIFT = "GrowUpGift", -- 成长礼包 SEVEN_DAY_TASK = "SevenDayTask", SEVEN_DAY_STEP_REWARD = "SevenDayStepReward", @@ -137,7 +137,7 @@ BIReport.GIFT_TYPE = { GOLD_PIG = "GoldPig", MALL_TREASURE = "MallTreasure", ACT_CHAPTER_STORE = "ActChapterStore", - LEVEL_FUND = "LevelFund", + GROWTH_FUND = "GrowthFund", GROW_UP_GIFT = "GrowUpGift", } diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 2e08160a..4af4a7b9 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -20,7 +20,7 @@ function DataManager:init() self:initManager("TaskData", "app/userdata/task/task_data") self:initManager("DailyTaskData", "app/userdata/task/daily_task_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("ShopData", "app/userdata/shop/shop_data") self:initManager("SummonData", "app/userdata/summon/summon_data") @@ -92,7 +92,7 @@ function DataManager:clear() self.BountyData:clear() self.DailyTaskData:clear() self.IdleData:clear() - self.FundData:clear() + self.GrowthFundData:clear() self.SevenDayData:clear() self.ShopData:clear() self.SummonData:clear() @@ -133,10 +133,10 @@ function DataManager:initWithServerData(data) self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包 self.ShopData:initGrowUpGift(data.act_grow_up_gift, data.now_ts) -- 成长礼包 self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包 - self.SummonData:init(data.summon, true) + self.SummonData:init(data.summon, true) -- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据 if data.fund then - self.FundData:init(data.fund.funds) + self.GrowthFundData:init(data.fund.funds) end -- 任务数据最后初始化,依赖其他模块的数据 diff --git a/lua/app/common/pay_manager.lua b/lua/app/common/pay_manager.lua index 9fc449b8..ff78d38d 100644 --- a/lua/app/common/pay_manager.lua +++ b/lua/app/common/pay_manager.lua @@ -15,7 +15,7 @@ PayManager.PURCHARSE_ACT_TYPE = { COIN_GIFT = 2, BEGINNER_GIFT = 4, LEVEL_UP_GIFT = 5, - LEVEL_FUND = 6, + GROWTH_FUND = 6, 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.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_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_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.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_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_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG, diff --git a/lua/app/module/fund/fund_manager.lua b/lua/app/module/fund/fund_manager.lua index 231ae975..13a49952 100644 --- a/lua/app/module/fund/fund_manager.lua +++ b/lua/app/module/fund/fund_manager.lua @@ -1,11 +1,11 @@ local FundManager = class("FundManager", BaseModule) function FundManager:showLevelFundUI() - UIManager:showUI("app/ui/fund/level_fund_ui") + UIManager:showUI("app/ui/fund/growth_fund_ui") end function FundManager:buyLevelFund(id) - if not DataManager.FundData:getIsOpen() then + if not DataManager.GrowthFundData:getIsOpen() then return end PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT) @@ -14,15 +14,15 @@ end function FundManager:claimFundRewards() local claimRewards = {} local playerLevel = DataManager.PlayerData:getLv() - local FundData = DataManager.FundData - local levelInfoIds = FundData:getCurrLevelInfoList() - local isBoughtBase = FundData:getIsBoughtBase() - local isBoughtAdvance = FundData:getIsBoughtAdvance() - local freeClaimed = FundData:getFreeClaimedMap() - local baseClaimed = FundData:getBaseClaimedMap() - local advanceClaimed = FundData:getAdvanceClaimedMap() - for _, id in ipairs(levelInfoIds) do - local levelFundInfo = FundData:getLevelFundCfg()[id] + local GrowthFundData = DataManager.GrowthFundData + local gradeInfoIds = GrowthFundData:getCurrGradeInfoList() + local isBoughtBase = GrowthFundData:getIsBoughtBase() + local isBoughtAdvance = GrowthFundData:getIsBoughtAdvance() + local freeClaimed = GrowthFundData:getFreeClaimedMap() + local baseClaimed = GrowthFundData:getBaseClaimedMap() + local advanceClaimed = GrowthFundData:getAdvanceClaimedMap() + for _, id in ipairs(gradeInfoIds) do + local levelFundInfo = GrowthFundData:getLevelFundCfg()[id] if levelFundInfo then if playerLevel >= levelFundInfo.level then -- 等级到了 if not freeClaimed[id] then -- 能领但是没有领 @@ -66,7 +66,7 @@ function FundManager:onClaimFundRewards(result) if result.rewards then GFunc.showRewardBox(result.rewards) end - DataManager.FundData:onClaimFundRewards(result.id_with_lv) + DataManager.GrowthFundData:onClaimFundRewards(result.id_with_lv) end end diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua index d887e565..a8fa62c0 100644 --- a/lua/app/module/maincity/maincity_const.lua +++ b/lua/app/module/maincity/maincity_const.lua @@ -24,7 +24,7 @@ MainCityConst.LEFT_SIDE_BARS = { MainCityConst.RIGHT_SIDE_BARS = { "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_grow_up_gift_1_cell", "app/ui/main_city/cell/side_bar_grow_up_gift_2_cell", diff --git a/lua/app/ui/fund/cell/level_fund_cell.lua b/lua/app/ui/fund/cell/growth_fund_cell.lua similarity index 51% rename from lua/app/ui/fund/cell/level_fund_cell.lua rename to lua/app/ui/fund/cell/growth_fund_cell.lua index fa151873..7127d00e 100644 --- a/lua/app/ui/fund/cell/level_fund_cell.lua +++ b/lua/app/ui/fund/cell/growth_fund_cell.lua @@ -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 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:addClickListener(function() if self.fundId == nil then return end - local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId) - local needLevel = DataManager.FundData:getNeedLevel(self.fundId) + local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId) + local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId) local playerLevel = DataManager.PlayerData:getLv() if not iCslaimed and playerLevel >= needLevel then ModuleManager.FundManager:claimFundRewards() else - local freeReward = DataManager.FundData:getFreeFundRewards(self.fundId) + local freeReward = DataManager.GrowthFundData:getFreeFundRewards(self.fundId) local reward = freeReward and freeReward[1] if reward then ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell1:getBaseObject()) 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() if self.fundId == nil then return end - local iCslaimed = DataManager.FundData:getIsClaimedBase(self.fundId) - local needLevel = DataManager.FundData:getNeedLevel(self.fundId) + local iCslaimed = DataManager.GrowthFundData:getIsClaimedBase(self.fundId) + local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId) 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() else - local baseReward = DataManager.FundData:getBaseFundRewards(self.fundId) + local baseReward = DataManager.GrowthFundData:getBaseFundRewards(self.fundId) local reward = baseReward and baseReward[1] if reward then ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell2:getBaseObject()) 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() if self.fundId == nil then return end - local iCslaimed = DataManager.FundData:getIsClaimedAdvance(self.fundId) - local needLevel = DataManager.FundData:getNeedLevel(self.fundId) + local iCslaimed = DataManager.GrowthFundData:getIsClaimedAdvance(self.fundId) + local needLevel = DataManager.GrowthFundData:getNeedLevel(self.fundId) 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() else - local advanceReward = DataManager.FundData:getAdvanceFundRewards(self.fundId) + local advanceReward = DataManager.GrowthFundData:getAdvanceFundRewards(self.fundId) local reward = advanceReward and advanceReward[1] if reward then ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.fundRewardCell3:getBaseObject()) @@ -62,28 +62,28 @@ function LevelFundCell:init() end end) 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.levelGrayImg = uiMap["level_fund_cell.lv_bg.gray"] - self.levelTx = uiMap["level_fund_cell.lv_bg.tx"] + self.levelGrayImg = uiMap["growth_fund_cell.lv_bg.gray"] + self.levelTx = uiMap["growth_fund_cell.lv_bg.tx"] end -function LevelFundCell:refresh(id) +function GrowthFundCell:refresh(id) self.fundId = id - local FundData = DataManager.FundData - local needLevel = DataManager.FundData:getNeedLevel(id) + local GrowthFundData = DataManager.GrowthFundData + local needLevel = DataManager.GrowthFundData:getNeedLevel(id) local playerLevel = DataManager.PlayerData:getLv() local isActive = playerLevel >= needLevel self.levelGrayImg:setVisible(not isActive) self.levelTx:setText(GFunc.intToString(needLevel)) - local freeReward, baseReward, advanceReward = FundData:getAllStepFundRewards(id) - self.fundRewardCell1:refresh(freeReward[1], isActive and 1 or 0, false, FundData:getIsClaimedFree(id)) - self.fundRewardCell2:refresh(baseReward[1], isActive and 2 or 0, not FundData:getIsBoughtBase(id), FundData:getIsClaimedBase(id)) - self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not FundData:getIsBoughtAdvance(id), FundData:getIsClaimedAdvance(id)) + local freeReward, baseReward, advanceReward = GrowthFundData:getAllStepFundRewards(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 GrowthFundData:getIsBoughtBase(id), GrowthFundData:getIsClaimedBase(id)) + self.fundRewardCell3:refresh(advanceReward[1], isActive and 3 or 0, not GrowthFundData:getIsBoughtAdvance(id), GrowthFundData:getIsClaimedAdvance(id)) end -function LevelFundCell:setVisible(visible) +function GrowthFundCell:setVisible(visible) self.baseObject:setVisible(visible) end -return LevelFundCell \ No newline at end of file +return GrowthFundCell \ No newline at end of file diff --git a/lua/app/ui/fund/level_fund_ui.lua.meta b/lua/app/ui/fund/cell/growth_fund_cell.lua.meta similarity index 86% rename from lua/app/ui/fund/level_fund_ui.lua.meta rename to lua/app/ui/fund/cell/growth_fund_cell.lua.meta index f65e895f..871c0417 100644 --- a/lua/app/ui/fund/level_fund_ui.lua.meta +++ b/lua/app/ui/fund/cell/growth_fund_cell.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3380bc95e342186458dd56f3cdd4e4f0 +guid: 2bc37d625f652654b83c5cedaaa8c2f1 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/ui/fund/cell/level_fund_reward_cell.lua b/lua/app/ui/fund/cell/growth_fund_reward_cell.lua similarity index 82% rename from lua/app/ui/fund/cell/level_fund_reward_cell.lua rename to lua/app/ui/fund/cell/growth_fund_reward_cell.lua index 4bea8d9f..9ee479d8 100644 --- a/lua/app/ui/fund/cell/level_fund_reward_cell.lua +++ b/lua/app/ui/fund/cell/growth_fund_reward_cell.lua @@ -1,6 +1,6 @@ -local LevelFundRewardCell = class("LevelFundRewardCell", BaseCell) +local GrowthFundRewardCell = class("GrowthFundRewardCell", BaseCell) -function LevelFundRewardCell:init() +function GrowthFundRewardCell:init() local uiMap = self:getUIMap() self.bg = uiMap["fund_reward_cell.bg"] self.icon = uiMap["fund_reward_cell.icon"] @@ -18,7 +18,7 @@ function LevelFundRewardCell:init() end) end -function LevelFundRewardCell:refresh(reward, step, isLock, showCheck) +function GrowthFundRewardCell:refresh(reward, step, isLock, showCheck) if step == 0 then self.bg:setSprite(GConst.ATLAS_PATH.FUND, "fund_bg_5") elseif step == 1 then @@ -49,7 +49,7 @@ function LevelFundRewardCell:refresh(reward, step, isLock, showCheck) end end -function LevelFundRewardCell:_refreshItem(item) +function GrowthFundRewardCell:_refreshItem(item) local info = ConfigManager:getConfig("item")[item.id] if info == nil then return @@ -71,20 +71,20 @@ function LevelFundRewardCell:_refreshItem(item) end end -function LevelFundRewardCell:setVisible(visible) +function GrowthFundRewardCell:setVisible(visible) self.baseObject:setActive(visible) end -function LevelFundRewardCell:setAnchoredPositionX(x) +function GrowthFundRewardCell:setAnchoredPositionX(x) self.baseObject:setAnchoredPositionX(x) end -function LevelFundRewardCell:setTouchEnable(enable) +function GrowthFundRewardCell:setTouchEnable(enable) self.baseObject:setTouchEnable(enable) end -function LevelFundRewardCell:addClickListener(callback) +function GrowthFundRewardCell:addClickListener(callback) self.clickCallback = callback end -return LevelFundRewardCell \ No newline at end of file +return GrowthFundRewardCell \ No newline at end of file diff --git a/lua/app/ui/fund/cell/level_fund_cell.lua.meta b/lua/app/ui/fund/cell/growth_fund_reward_cell.lua.meta similarity index 86% rename from lua/app/ui/fund/cell/level_fund_cell.lua.meta rename to lua/app/ui/fund/cell/growth_fund_reward_cell.lua.meta index 86dd2f01..6e16472c 100644 --- a/lua/app/ui/fund/cell/level_fund_cell.lua.meta +++ b/lua/app/ui/fund/cell/growth_fund_reward_cell.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7f29b4252c5aeb64abafe246ea6c16e5 +guid: 3e3a08bdfecbd8b49ada85fa70fe5c8b ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/ui/fund/level_fund_ui.lua b/lua/app/ui/fund/growth_fund_ui.lua similarity index 52% rename from lua/app/ui/fund/level_fund_ui.lua rename to lua/app/ui/fund/growth_fund_ui.lua index a7541702..7c4a8ffc 100644 --- a/lua/app/ui/fund/level_fund_ui.lua +++ b/lua/app/ui/fund/growth_fund_ui.lua @@ -1,10 +1,10 @@ -local LevelFundUI = class("LevelFundUI", BaseUI) +local GrowthFundUI = class("GrowthFundUI", BaseUI) -function LevelFundUI:isFullScreen() +function GrowthFundUI:isFullScreen() return true end -function LevelFundUI:getCurrencyParams() +function GrowthFundUI:getCurrencyParams() if self.currencyParams == nil then self.currencyParams = { itemIds = { @@ -18,21 +18,21 @@ function LevelFundUI:getCurrencyParams() return self.currencyParams end -function LevelFundUI:getPrefabPath() - return "assets/prefabs/ui/fund/level_fund_ui.prefab" +function GrowthFundUI:getPrefabPath() + return "assets/prefabs/ui/fund/growth_fund_ui.prefab" end -function LevelFundUI:ctor() - self.fundLevel = DataManager.FundData:getFundLevel() - self:initLevelInfoList() +function GrowthFundUI:ctor() + self.fundGrade = DataManager.GrowthFundData:getFundGrade() + self:initGradeInfoList() end -function LevelFundUI:initLevelInfoList() - self.levelInfoList = DataManager.FundData:getCurrLevelInfoList() +function GrowthFundUI:initGradeInfoList() + self.gradeInfoList = DataManager.GrowthFundData:getCurrGradeInfoList() local playerLevel = DataManager.PlayerData:getLv() local cfg = ConfigManager:getConfig("act_level_fund") self.inactiveIndex = nil - for k, v in ipairs(self.levelInfoList) do + for k, v in ipairs(self.gradeInfoList) do if cfg[v] then if playerLevel < cfg[v].level then self.inactiveIndex = k @@ -41,20 +41,20 @@ function LevelFundUI:initLevelInfoList() end end if self.inactiveIndex == nil then - self.inactiveIndex = #self.levelInfoList + 1 + self.inactiveIndex = #self.gradeInfoList + 1 end end -function LevelFundUI:onClose() +function GrowthFundUI:onClose() 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 -function LevelFundUI:onLoadRootComplete() +function GrowthFundUI:onLoadRootComplete() 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() end) @@ -64,77 +64,77 @@ function LevelFundUI:onLoadRootComplete() self:bindData() end -function LevelFundUI:initTitle() - self.titleTx = self.uiMap["level_fund_ui.title_img.title_tx"] - self.titleDialogBg = self.uiMap["level_fund_ui.title_img.bg"] +function GrowthFundUI:initTitle() + self.titleTx = self.uiMap["growth_fund_ui.title_img.title_tx"] + self.titleDialogBg = self.uiMap["growth_fund_ui.title_img.bg"] self.originTitleBgHeight = self.titleDialogBg:fastGetSizeDeltaY() end -function LevelFundUI:initPayBtns() +function GrowthFundUI:initPayBtns() 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: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() - ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundBaseId()) + ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundBaseId()) 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:addClickListener(function() - ModuleManager.FundManager:buyLevelFund(DataManager.FundData:getFundAdvanceId()) + ModuleManager.FundManager:buyLevelFund(DataManager.GrowthFundData:getFundAdvanceId()) 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 -function LevelFundUI:initRewards() - self.scrollRect = self.uiMap["level_fund_ui.scrollrect"] +function GrowthFundUI:initRewards() + self.scrollRect = self.uiMap["growth_fund_ui.scrollrect"] self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRectComp:addInitCallback(function() - return "app/ui/fund/cell/level_fund_cell" + return "app/ui/fund/cell/growth_fund_cell" end) self.scrollRectComp:addRefreshCallback(function(index, cell) - cell:refresh(self.levelInfoList[index]) + cell:refresh(self.gradeInfoList[index]) end) self.scrollRectComp:clearCells() self.scrollRectComp:setTotalCount(0) - self.progressBg = self.uiMap["level_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.grayImg = self.uiMap["level_fund_ui.scrollrect.viewport.content.gray_img"] - self.horizontalLine = self.uiMap["level_fund_ui.scrollrect.viewport.content.line_img"] - self.verticalLine1 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_1"] - self.verticalLine2 = self.uiMap["level_fund_ui.scrollrect.viewport.content.vertical_line_2"] + self.progressBg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg"] + self.progressComp = self.uiMap["growth_fund_ui.scrollrect.viewport.content.progress_bg.progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) + self.grayImg = self.uiMap["growth_fund_ui.scrollrect.viewport.content.gray_img"] + self.horizontalLine = self.uiMap["growth_fund_ui.scrollrect.viewport.content.line_img"] + self.verticalLine1 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_1"] + self.verticalLine2 = self.uiMap["growth_fund_ui.scrollrect.viewport.content.vertical_line_2"] end -function LevelFundUI:bindData() - self:bind(DataManager.FundData, "dirty", function() - if self.fundLevel ~= DataManager.FundData:getFundLevel() then - self.fundLevel = DataManager.FundData:getFundLevel() - self:initLevelInfoList() +function GrowthFundUI:bindData() + self:bind(DataManager.GrowthFundData, "dirty", function() + if self.fundGrade ~= DataManager.GrowthFundData:getFundGrade() then + self.fundGrade = DataManager.GrowthFundData:getFundGrade() + self:initGradeInfoList() end self:onRefresh() end) end -function LevelFundUI:onRefresh() +function GrowthFundUI:onRefresh() self:refreshTitle() self:refreshPayBtns() self:refreshRewards() end -function LevelFundUI:refreshTitle() - local fundLevel = DataManager.FundData:getFundLevel() - if fundLevel == 1 then - self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png") - elseif fundLevel == 2 then - self.uiMap["level_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png") +function GrowthFundUI:refreshTitle() + local fundGrade = DataManager.GrowthFundData:getFundGrade() + if fundGrade == 1 then + self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_1.png") + elseif fundGrade == 2 then + self.uiMap["growth_fund_ui.title_img"]:setTexture("assets/arts/textures/background/fund/fund_bg_2.png") 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 if height < self.originTitleBgHeight then height = self.originTitleBgHeight @@ -142,17 +142,17 @@ function LevelFundUI:refreshTitle() self.titleDialogBg:setSizeDeltaY(height) end -function LevelFundUI:refreshPayBtns() - if not DataManager.FundData:getIsBoughtBase() then - local rechargeId = DataManager.FundData:getCurrLevelBaseRechargeId() +function GrowthFundUI:refreshPayBtns() + if not DataManager.GrowthFundData:getIsBoughtBase() then + local rechargeId = DataManager.GrowthFundData:getCurrGradeBaseRechargeId() self.payBtnTx1:setText(GFunc.getFormatPrice(rechargeId)) self.payBtn1:setTouchEnable(true) else self.payBtnTx1:setText(I18N:getGlobalText(I18N.GlobalConst.ALREADY_ACTIVE)) self.payBtn1:setTouchEnable(false) end - if not DataManager.FundData:getIsBoughtAdvance() then - local rechargeId = DataManager.FundData:getCurrLevelAdvanceRechargeId() + if not DataManager.GrowthFundData:getIsBoughtAdvance() then + local rechargeId = DataManager.GrowthFundData:getCurrGradeAdvanceRechargeId() self.payBtnTx2:setText(GFunc.getFormatPrice(rechargeId)) self.payBtn2:setTouchEnable(true) else @@ -161,11 +161,11 @@ function LevelFundUI:refreshPayBtns() end end -function LevelFundUI:refreshRewards() - local count = #self.levelInfoList +function GrowthFundUI:refreshRewards() + local count = #self.gradeInfoList if self.scrollRectComp:getTotalCount() <= 0 then self.scrollRectComp:refillCells(count) - local minIndex = DataManager.FundData:getMinUnclaimedRewardIndex() + local minIndex = DataManager.GrowthFundData:getMinUnclaimedRewardIndex() if minIndex > 1 then self.scrollRectComp:moveToIndex(minIndex) end @@ -200,4 +200,4 @@ function LevelFundUI:refreshRewards() self.horizontalLine:setAnchoredPositionY(-topRecoveryOffset - (self.inactiveIndex - 1)*cellWidth) end -return LevelFundUI \ No newline at end of file +return GrowthFundUI \ No newline at end of file diff --git a/lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua.meta b/lua/app/ui/fund/growth_fund_ui.lua.meta similarity index 86% rename from lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua.meta rename to lua/app/ui/fund/growth_fund_ui.lua.meta index fb7a3b35..dc167370 100644 --- a/lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua.meta +++ b/lua/app/ui/fund/growth_fund_ui.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 14a96472379bd3b45a9544e750fa0f10 +guid: 5a975799c3c9cc14fafc8e2c8d9cf4a7 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua b/lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua new file mode 100644 index 00000000..a1efe9ec --- /dev/null +++ b/lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua @@ -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 \ No newline at end of file diff --git a/lua/app/ui/fund/cell/level_fund_reward_cell.lua.meta b/lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua.meta similarity index 86% rename from lua/app/ui/fund/cell/level_fund_reward_cell.lua.meta rename to lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua.meta index 3f54d7bc..da3aa0f0 100644 --- a/lua/app/ui/fund/cell/level_fund_reward_cell.lua.meta +++ b/lua/app/ui/main_city/cell/side_bar_growth_fund_cell.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b6e1fcafc8ff9f4459edefaa8e079e3e +guid: 89fd1069c28a504499e23bd0718b4d8a ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua b/lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua deleted file mode 100644 index a7d242fe..00000000 --- a/lua/app/ui/main_city/cell/side_bar_level_fund_cell.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/lua/app/userdata/fund/fund_data.lua.meta b/lua/app/userdata/fund/fund_data.lua.meta deleted file mode 100644 index 172ebcdf..00000000 --- a/lua/app/userdata/fund/fund_data.lua.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: d9943057ffc3dd541bfff544d512abee -ScriptedImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 2 - userData: - assetBundleName: - assetBundleVariant: - script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/fund/fund_data.lua b/lua/app/userdata/fund/growth_fund_data.lua similarity index 68% rename from lua/app/userdata/fund/fund_data.lua rename to lua/app/userdata/fund/growth_fund_data.lua index 5b96e49d..746dad1c 100644 --- a/lua/app/userdata/fund/fund_data.lua +++ b/lua/app/userdata/fund/growth_fund_data.lua @@ -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_2 = 60402 local ACT_GIFT_FUND_ADVANCE_ID_1 = 60102 local ACT_GIFT_FUND_ADVANCE_ID_2 = 60302 -function FundData:ctor() +function GrowthFundData:ctor() self.data.dirty = false self.isClaimAll = false end -function FundData:init(data) +function GrowthFundData:init(data) data = data or GConst.EMPTY_TABLE self.freeClaimed = {} @@ -37,51 +37,51 @@ function FundData:init(data) self.advanceClaimedCount = self.advanceClaimedCount + 1 end end - self:initLevelInfo() - self:initFundLevel() + self:initGrowthInfo() + self:initFundGrade() end -function FundData:initLevelInfo() - if not self.levelInfoMap then - self.levelInfoMap = {} +function GrowthFundData:initGrowthInfo() + if not self.growthInfoMap then + self.growthInfoMap = {} local cfg = self:getLevelFundCfg() for id, info in pairs(cfg) do - if not self.levelInfoMap[info.stage] then - self.levelInfoMap[info.stage] = {} + if not self.growthInfoMap[info.stage] then + self.growthInfoMap[info.stage] = {} end - table.insert(self.levelInfoMap[info.stage], id) + table.insert(self.growthInfoMap[info.stage], id) end - for level, _ in pairs(self.levelInfoMap) do - table.sort(self.levelInfoMap[level], function(a, b) + for grade, _ in pairs(self.growthInfoMap) do + table.sort(self.growthInfoMap[grade], function(a, b) return a < b end) end end end -function FundData:initFundLevel() - local fundLevel = 1 +function GrowthFundData:initFundGrade() + local fundGrade = 1 local totalCount = 0 while true do - local levelInfoIds = self.levelInfoMap[fundLevel] - if levelInfoIds == nil then - fundLevel = fundLevel - 1 + local growInfoIds = self.growthInfoMap[fundGrade] + if growInfoIds == nil then + fundGrade = fundGrade - 1 break end - totalCount = totalCount + #levelInfoIds + totalCount = totalCount + #growInfoIds if self.freeClaimedCount >= totalCount and self.baseClaimedCount >= totalCount and self.advanceClaimedCount >= totalCount then - fundLevel = fundLevel + 1 + fundGrade = fundGrade + 1 else break end end - if fundLevel < 1 then - fundLevel = 1 + if fundGrade < 1 then + fundGrade = 1 end - self.data.fundLevel = fundLevel - if self.data.fundLevel == 2 then + self.data.fundGrade = fundGrade + if self.data.fundGrade == 2 then self.fundBaseId = ACT_GIFT_FUND_BASE_ID_2 self.fundAdvanceId = ACT_GIFT_FUND_ADVANCE_ID_2 if self.freeClaimedCount >= totalCount and self.baseClaimedCount >= totalCount and self.advanceClaimedCount >= totalCount then @@ -93,58 +93,58 @@ function FundData:initFundLevel() end end -function FundData:markDirty() +function GrowthFundData:markDirty() self.data.dirty = not self.data.dirty end -function FundData:getIsOpen() +function GrowthFundData:getIsOpen() if self.isClaimAll then return false end return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FUND, true) end -function FundData:getFundLevel() - return self.data.fundLevel +function GrowthFundData:getFundGrade() + return self.data.fundGrade end -function FundData:getFundBaseId() +function GrowthFundData:getFundBaseId() return self.fundBaseId end -function FundData:getFundAdvanceId() +function GrowthFundData:getFundAdvanceId() return self.fundAdvanceId end -function FundData:getCurrLevelBaseRechargeId() +function GrowthFundData:getCurrGradeBaseRechargeId() local info = self:getActGiftCfg()[self.fundBaseId] return info.recharge_id end -function FundData:getCurrLevelAdvanceRechargeId() +function GrowthFundData:getCurrGradeAdvanceRechargeId() local info = self:getActGiftCfg()[self.fundAdvanceId] return info.recharge_id end -function FundData:getActGiftCfg() +function GrowthFundData:getActGiftCfg() if self.cfg == nil then self.cfg = ConfigManager:getConfig("act_gift") end return self.cfg end -function FundData:getLevelFundCfg() +function GrowthFundData:getLevelFundCfg() if self.levelFundCfg == nil then self.levelFundCfg = ConfigManager:getConfig("act_level_fund") end return self.levelFundCfg end -function FundData:getCurrLevelInfoList() - return self.levelInfoMap[self.data.fundLevel] or GConst.EMPTY_TABLE +function GrowthFundData:getCurrGradeInfoList() + return self.growthInfoMap[self.data.fundGrade] or GConst.EMPTY_TABLE end -function FundData:getNeedLevel(id) +function GrowthFundData:getNeedLevel(id) local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo == nil then return 9999 @@ -152,7 +152,7 @@ function FundData:getNeedLevel(id) return levelFundInfo.level end -function FundData:getAllStepFundRewards(id) +function GrowthFundData:getAllStepFundRewards(id) local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo == nil then return nil, nil, nil @@ -160,7 +160,7 @@ function FundData:getAllStepFundRewards(id) return levelFundInfo.reward_free, levelFundInfo.reward_small, levelFundInfo.reward end -function FundData:getFreeFundRewards(id) +function GrowthFundData:getFreeFundRewards(id) local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo == nil then return nil @@ -168,7 +168,7 @@ function FundData:getFreeFundRewards(id) return levelFundInfo.reward_free end -function FundData:getBaseFundRewards(id) +function GrowthFundData:getBaseFundRewards(id) local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo == nil then return nil @@ -176,7 +176,7 @@ function FundData:getBaseFundRewards(id) return levelFundInfo.reward_small end -function FundData:getAdvanceFundRewards(id) +function GrowthFundData:getAdvanceFundRewards(id) local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo == nil then return nil @@ -184,45 +184,45 @@ function FundData:getAdvanceFundRewards(id) return levelFundInfo.reward end -function FundData:getIsBoughtBase() +function GrowthFundData:getIsBoughtBase() return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundBaseId) > 0 end -function FundData:getIsBoughtAdvance() +function GrowthFundData:getIsBoughtAdvance() return DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, self.fundAdvanceId) > 0 end -function FundData:getFreeClaimedMap() +function GrowthFundData:getFreeClaimedMap() return self.freeClaimed end -function FundData:getIsClaimedFree(id) +function GrowthFundData:getIsClaimedFree(id) return self.freeClaimed[id] end -function FundData:getBaseClaimedMap() +function GrowthFundData:getBaseClaimedMap() return self.baseClaimed end -function FundData:getIsClaimedBase(id) +function GrowthFundData:getIsClaimedBase(id) return self.baseClaimed[id] end -function FundData:getAdvanceClaimedMap() +function GrowthFundData:getAdvanceClaimedMap() return self.advanceClaimed end -function FundData:getIsClaimedAdvance(id) +function GrowthFundData:getIsClaimedAdvance(id) return self.advanceClaimed[id] end -function FundData:getMinUnclaimedRewardIndex() +function GrowthFundData:getMinUnclaimedRewardIndex() local playerLevel = DataManager.PlayerData:getLv() - local levelInfoIds = self:getCurrLevelInfoList() + local growInfoIds = self:getCurrGradeInfoList() local minIndex = 0 local isBoughtBase = self:getIsBoughtBase() local isBoughtAdvance = self:getIsBoughtAdvance() - for k, id in ipairs(levelInfoIds) do + for k, id in ipairs(growInfoIds) do local levelFundInfo = self:getLevelFundCfg()[id] if levelFundInfo then if playerLevel >= levelFundInfo.level then -- 等级到了 @@ -251,14 +251,14 @@ function FundData:getMinUnclaimedRewardIndex() end -- 是否有未领取的奖励 -function FundData:getIfCanClaimReward() +function GrowthFundData:getIfCanClaimReward() if not self:getIsOpen() then return false end return self:getMinUnclaimedRewardIndex() > 0 end -function FundData:onClaimFundRewards(list) +function GrowthFundData:onClaimFundRewards(list) if list == nil then return end @@ -283,12 +283,12 @@ function FundData:onClaimFundRewards(list) end end end - self:initFundLevel() + self:initFundGrade() self:markDirty() end -function FundData:onBoughtFund() +function GrowthFundData:onBoughtFund() self:markDirty() end -return FundData \ No newline at end of file +return GrowthFundData \ No newline at end of file diff --git a/lua/app/userdata/fund/growth_fund_data.lua.meta b/lua/app/userdata/fund/growth_fund_data.lua.meta new file mode 100644 index 00000000..20975dae --- /dev/null +++ b/lua/app/userdata/fund/growth_fund_data.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b4b9202b724428843a59d421a713fe4b +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua index 36090e3c..9afcaec6 100644 --- a/lua/app/userdata/shop/shop_data.lua +++ b/lua/app/userdata/shop/shop_data.lua @@ -100,8 +100,8 @@ function ShopData:updateGiftInfo(gift) local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[giftType] if cfgName then local cfg = ConfigManager:getConfig(cfgName) - if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_FUND then - DataManager.FundData:onBoughtFund(giftId) + if cfg and cfg[giftId] and cfg[giftId].type == PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND then + DataManager.GrowthFundData:onBoughtFund(giftId) end end end