diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index a01aabc0..7a2fdeba 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -20,6 +20,7 @@ function DataManager:init() self:initManager("DailyTaskData", "app/userdata/task/daily_task_data") self:initManager("IdleData", "app/userdata/idle/idle_data") -- self:initManager("SevenDayData", "app/userdata/activity/seven_day/seven_day_data") + self:initManager("ShopData", "app/userdata/idle/shop_data") end function DataManager:initManager(name, path) @@ -89,7 +90,8 @@ function DataManager:clear() self.DailyTaskData:clear() self.IdleData:clear() -- self.SevenDayData:clear() - + self.ShopData:clear() + ModuleManager.TaskManager:clear() end @@ -120,7 +122,12 @@ function DataManager:initWithServerData(data) self.DailyTaskData:init(data.task_daily) self.IdleData:init(data.idle) -- self.SevenDayData:init(data.SevenDayData) - + self.ShopData:initActGift(data.act) -- 礼包购买信息 + self.ShopData:initMallDaily(data.mall_daily) -- 每日特惠 + self.ShopData:initCommonDailyGoldGift(data.mall_idle) -- 常驻金币礼包 + self.ShopData:initGrowUpGift(data.act_grow_up_gift) -- 成长礼包 + self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力礼包 + self:scheduleGlobal() self:checkDataBind() end diff --git a/lua/app/module/shop/shop_const.lua b/lua/app/module/shop/shop_const.lua index 1e63ddb2..1cb2aa31 100644 --- a/lua/app/module/shop/shop_const.lua +++ b/lua/app/module/shop/shop_const.lua @@ -1,10 +1,19 @@ local ShopConst = class("ShopConst", BaseModule) -ShopConst.ACT_GIFT_TYPE = { - FIRST_RECHARGE_GIFT = 1, -- 首冲 - COIN_GIFT = 2, -- 金币不足礼包 - BEGINNER_GIFT = 4, - LEVEL_GIFT = 5, -- 助力礼包 +-- ShopConst.ACT_GIFT_TYPE = { +-- FIRST_RECHARGE_GIFT = 1, -- 首冲 +-- COIN_GIFT = 2, -- 金币不足礼包 +-- BEGINNER_GIFT = 4, +-- LEVEL_GIFT = 5, -- 助力礼包 +-- } + +-- 服务器pb对应的类型 +ShopConst.GIFT_TYPE = { + ACT_GIFT = 1, + GOLD_PIG = 2, + CHAPTER_GIFT = 3, + GROW_UP_GIFT = 4, + MALL_TREASURE = 5, } ShopConst.ACT_GIFT_ID = { diff --git a/lua/app/module/shop/shop_manager.lua b/lua/app/module/shop/shop_manager.lua index 70bd827e..6aab12bc 100644 --- a/lua/app/module/shop/shop_manager.lua +++ b/lua/app/module/shop/shop_manager.lua @@ -4,4 +4,34 @@ function ShopManager:showBoxHeroUI() UIManager:showUI("app/ui/shop/box_hero_ui") end +-- 购买每日特惠商品 +function ShopManager:buyMallDailyGift(id) + -- TODOJ + -- if not DataManager.SevenDayData:getIsOpen() then + -- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACTIVITY_OVER_DESC)) + -- return + -- end + + -- if DataManager.SevenDayData:getStepCollected(id) then + -- return + -- end + + -- if not DataManager.SevenDayData:canClaimStepTask(id) then + -- return + -- end + + -- local params = {id = id} + -- local responseData = { + -- rewards = {GFunc.getRewardTableByReward(DataManager.SevenDayData:getStepReward(id))}, + -- Claimed = { + -- [id] = true + -- } + -- } + -- self:sendMessage(ProtoMsgType.FromMsgEnum.SevenDayRewardReq, params, responseData, self.claimStepRewardFinish, BIReport.ITEM_GET_TYPE.SEVEN_DAY_STEP_REWARD) +end + +function ShopManager:buyMallDailyGiftFinish(result) + -- TODOJ +end + return ShopManager \ No newline at end of file diff --git a/lua/app/ui/shop/cell/coin_sell_cell.lua b/lua/app/ui/shop/cell/coin_sell_cell.lua index 26739d9d..6ac5f361 100644 --- a/lua/app/ui/shop/cell/coin_sell_cell.lua +++ b/lua/app/ui/shop/cell/coin_sell_cell.lua @@ -43,7 +43,7 @@ function CoinSellCell:refresh() local actGiftId = 20102 local cfgInfo = ConfigManager:getConfig("act_gift")[actGiftId] -- 超值 - self.offText:setText(tostring(cfgInfo.value * 100) .. "%") + self.offText:setText(tostring(cfgInfo.value) .. "%") -- 限购 self.limitText:setText("限购" .. tostring(cfgInfo.limit) .. "次TD") -- TODOJ -- 标题 diff --git a/lua/app/ui/shop/cell/gem_cell.lua b/lua/app/ui/shop/cell/gem_cell.lua index e77b69ef..901c49d3 100644 --- a/lua/app/ui/shop/cell/gem_cell.lua +++ b/lua/app/ui/shop/cell/gem_cell.lua @@ -1,10 +1,79 @@ local GemCell = class("GemCell", BaseCell) function GemCell:init() - local uiMap = self:getUIMap() + local uiMap = self.baseObject:genAllChildren() + self.bg = uiMap["gem_cell.bg"] + self.icon = uiMap["gem_cell.icon"] + self.nameText = uiMap["gem_cell.num"] + self.priceText = uiMap["gem_cell.price"] + self.doubleNode = uiMap["gem_cell.double_bg"] + self.doubleDesc = uiMap["gem_cell.double_bg.desc"] + self.doubleText = uiMap["gem_cell.double_bg.num"] + self.doubleImg = uiMap["gem_cell.double_bg.icon"] + self.doubleOriginText = uiMap["gem_cell.double_bg.origin_num"] + self.doubleOriginLine = uiMap["gem_cell.double_bg.line"] + self.adNode = uiMap["gem_cell.ad"] + self.adImg = uiMap["gem_cell.ad.image"] + self.adText = uiMap["gem_cell.ad.desc"] + self.sellOutText = uiMap["gem_cell.sell_out"] + + self.sellOutText:setText("已购买TD") -- TODOJ end -function GemCell:refresh(index, info) +function GemCell:refresh(id, cfgInfo, bought, clickCallback) + local rechargeId = cfgInfo.recharge_id + local reward = cfgInfo.reward[1] + local limit = cfgInfo.limit or 0 + local adMaxTimes = cfgInfo.daily or 0 + + local isFree = rechargeId == nil + local hasDoubleTimes = bought < limit + local leftDoubleTimes = limit - bought + + if isFree then -- 免费广告 + self.adNode:setVisible(true) + self.price:setVisible(false) + + GFunc.setAdsSprite(self.adImg) + local adLeftCount = adMaxTimes - bought + if adLeftCount > 0 then + self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ + GFunc.centerImgAndTx(self.adImg, self.adText, 20) + self.sellOutText:setVisible(false) + + self:getBaseObject():addRedPoint(95, 130, 0.5) + else + self.adNode:setVisible(false) + self.sellOutText:setVisible(true) + + self:getBaseObject():removeRedPoint() + end + else -- 付费 + self.adNode:setVisible(false) + self.price:setVisible(true) + + if hasDoubleTimes then -- 有双倍效果 + self.doubleNode:setVisible(true) + self.doubleDesc:setText("剩余次数:" .. tostring(leftDoubleTimes) .. "TD") -- TODOJ + self.doubleText:setText("+" .. tostring(reward.num * 2)) + GFunc.centerImgAndTx(self.doubleImg, self.doubleText, 20) + self.doubleOriginText:setText(reward.num) + else + self.doubleNode:setVisible(false) + end + end + self.nameText:setText(reward.num) + self.priceText:setText(GFunc.getFormatPrice(rechargeId)) + + if clickCallback then + self:addClickListener(function() + clickCallback(cfgInfo.id) + end) + end +end + +function GemCell:setVisible(visible) + self.baseObject:setVisible(visible) end return GemCell \ No newline at end of file diff --git a/lua/app/ui/shop/cell/gem_sell_cell.lua b/lua/app/ui/shop/cell/gem_sell_cell.lua index c6f72828..847a9ed8 100644 --- a/lua/app/ui/shop/cell/gem_sell_cell.lua +++ b/lua/app/ui/shop/cell/gem_sell_cell.lua @@ -9,7 +9,7 @@ function GemSellCell:init() self.cellHeight = 0 local cellHeight = nil local cfg = ConfigManager:getConfig("mall_treasure") - for i = 1, 12 do + for i = 1, 9 do local cell = uiMap["gem_sell_cell.cell_" .. i] if cellHeight == nil then local w, h = cell:fastGetSizeDelta() @@ -32,7 +32,11 @@ end function GemSellCell:refresh() local cfg = ConfigManager:getConfig("mall_treasure") for k, v in ipairs(self.cells) do - v:refresh(k, cfg[k]) + local id = k -- 目前配置表结构如此 + local buyCount = DataManager.ShopData:getActGiftBuyCount(GConst.ShopConst.GIFT_TYPE.MALL_TREASURE, id) + v:refresh(id, cfg[id], buyCount, function(id) + self:onClickGift(id) + end) end end @@ -48,4 +52,8 @@ function GemSellCell:setVisible(visible) self.baseObject:setVisible(visible) end +function GemSellCell:onClickGift(id) + Logger.logHighlight("Click id:%s", id) -- TODOJ +end + return GemSellCell \ No newline at end of file diff --git a/lua/app/ui/shop/cell/gold_cell.lua b/lua/app/ui/shop/cell/gold_cell.lua index 43ed9785..47ed1467 100644 --- a/lua/app/ui/shop/cell/gold_cell.lua +++ b/lua/app/ui/shop/cell/gold_cell.lua @@ -1,10 +1,71 @@ local GoldCell = class("GoldCell", BaseCell) function GoldCell:init() - local uiMap = self:getUIMap() + local uiMap = self.baseObject:genAllChildren() + self.bg = uiMap["gold_cell.bg"] + self.icon = uiMap["gold_cell.icon"] + self.nameText = uiMap["gold_cell.num"] + self.costNode = uiMap["gold_cell.cost"] + self.costImg = uiMap["gold_cell.cost.icon"] + self.costText = uiMap["gold_cell.cost.num"] + self.adNode = uiMap["gold_cell.ad"] + self.adImg = uiMap["gold_cell.ad.image"] + self.adText = uiMap["gold_cell.ad.desc"] + self.descText = uiMap["gold_cell.desc"] + self.sellOutText = uiMap["gold_cell.sell_out"] + + self.sellOutText:setText("已购买TD") -- TODOJ end -function GoldCell:refresh(index, info) +function GoldCell:refresh(id, cfgInfo) + local idleTime = cfgInfo.idel_time + local cost = cfgInfo.cost + local adMaxTimes = cfgInfo.daily or 0 + local goldNum = DataManager.ShopData:getCommonDailyCoinNum(idleTime) + + local isFree = adMaxTimes > 0 + + if isFree then -- 免费广告 + self.adNode:setVisible(true) + self.costNode:setVisible(false) + + GFunc.setAdsSprite(self.adImg) + local bought = DataManager.ShopData:getCommonDailyCoinAdBuyCount() -- 金币礼包购买次数 + local adLeftCount = adMaxTimes - bought + if adLeftCount > 0 then + self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ + GFunc.centerImgAndTx(self.adImg, self.adText, 20) + self.sellOutText:setVisible(false) + + self:getBaseObject():addRedPoint(95, 130, 0.5) + else + self.adNode:setVisible(false) + self.sellOutText:setVisible(true) + + self:getBaseObject():removeRedPoint() + end + else -- 付费 + self.adNode:setVisible(false) + self.costNode:setVisible(true) + + self.costText:setText(tostring(cost.num)) + GFunc.centerImgAndTx(self.costImg, self.costText, 20) + end + self.nameText:setText(GFunc.num2Str(goldNum)) + + self.descText:setText("金币礼包:" .. tostring(id) .. "TD") -- TODOJ + + self:addClickListener(function() + self:onClickGift(cfgInfo.id) + end) +end + +function GoldCell:setVisible(visible) + self.baseObject:setVisible(visible) +end + +function GoldCell:onClickGift(id) + Logger.logHighlight("onClick:%s", id) end return GoldCell \ No newline at end of file diff --git a/lua/app/ui/shop/cell/hot_cell.lua b/lua/app/ui/shop/cell/hot_cell.lua new file mode 100644 index 00000000..fb519205 --- /dev/null +++ b/lua/app/ui/shop/cell/hot_cell.lua @@ -0,0 +1,93 @@ +local HotCell = class("HotCell", BaseCell) + +function HotCell:init() + local uiMap = self.baseObject:genAllChildren() + self.bg = uiMap["hot_cell.bg"] + self.icon = uiMap["hot_cell.icon"] + self.nameText = uiMap["hot_cell.num"] + self.adNode = uiMap["hot_cell.ad"] + self.adImg = uiMap["hot_cell.ad.image"] + self.adText = uiMap["hot_cell.ad.desc"] + self.costNode = uiMap["hot_cell.ad.cost"] + self.costImg = uiMap["hot_cell.ad.cost.icon"] + self.costText = uiMap["hot_cell.ad.cost.num"] + self.heroNode = uiMap["hot_cell.hero"] + self.heroCell = CellManager:addCellComp(uiMap["hot_cell.hero.hero_cell"], GConst.TYPEOF_LUA_CLASS.HERO_CELL) + self.heroNumText = uiMap["hot_cell.hero.num_tx"] + self.sellOutText = uiMap["hot_cell.sell_out"] + + self.sellOutText:setText("已购买TD") -- TODOJ +end + +function HotCell:refresh(data, clickCallback) + local id = data.id + local index = data.good_index + local bought = data.bought + + local cfgInfo = ConfigManager:getConfig("mall_daily")[id] + local reward = cfgInfo.good[index] + local cost = cfgInfo.cost[index] + + local isHeroReward = ConfigManager:getConfig("hero")[reward.id] ~= nil + local isAdCost = cost ~= nil + + if isHeroReward then + self.icon:setVisible(false) + self.heroNode:setVisible(true) + + self.heroCell:refreshWithCfgId(reward.id) + self.heroNumText:setText(reward.num) + self.nameText:setText(ModuleManager.ItemManager:getItemName(reward.id)) + else + self.icon:setVisible(false) + self.heroNode:setVisible(true) + + self.icon:setSprite(GFunc.getIconRes(cost.id)) + self.nameText:setText(cost.num) + end + if isAdCost then -- 广告商品 + self.adNode:setVisible(true) + self.costNode:setVisible(false) + + GFunc.setAdsSprite(self.adImg) + local adLeftCount = DataManager.ShopData:getMallDailyFirstItemAdMaxCount() - bought + if adLeftCount > 0 then + self.adText:setText("免费(" .. tostring(adLeftCount) .. ")TD") -- TODOJ + GFunc.centerImgAndTx(self.adImg, self.adText, 20) + self.sellOutText:setVisible(false) + + self:getBaseObject():addRedPoint(95, 130, 0.5) + else + self.adNode:setVisible(false) + self.sellOutText:setVisible(true) + + self:getBaseObject():removeRedPoint() + end + else -- (2,3)金币(4,5,6)钻石商品 + self.adNode:setVisible(false) + self.costNode:setVisible(true) + + local leftCount = DataManager.ShopData:getMallDailyGoodsMaxCount() - bought + if leftCount > 0 then + self.costImg:setSprite(GFunc.getIconRes(cost.id)) + self.costText:setText(cost.num) + GFunc.centerImgAndTx(self.costImg, self.costText, 20) + self.sellOutText:setVisible(false) + else + self.costNode:setVisible(false) + self.sellOutText:setVisible(true) + end + end + + if clickCallback then + self:addClickListener(function() + clickCallback(cfgInfo.id) + end) + end +end + +function HotCell:setVisible(visible) + self.baseObject:setVisible(visible) +end + +return HotCell \ No newline at end of file diff --git a/lua/app/ui/shop/cell/hot_cell.lua.meta b/lua/app/ui/shop/cell/hot_cell.lua.meta new file mode 100644 index 00000000..59d1e0a5 --- /dev/null +++ b/lua/app/ui/shop/cell/hot_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f0d28230c07310f42b57246a5307c8f1 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/shop/cell/hot_sell_cell.lua b/lua/app/ui/shop/cell/hot_sell_cell.lua index 1f0c560c..09d03792 100644 --- a/lua/app/ui/shop/cell/hot_sell_cell.lua +++ b/lua/app/ui/shop/cell/hot_sell_cell.lua @@ -1,4 +1,6 @@ local HotSellCell = class("HotSellCell", BaseCell) +local HOT_CELL = "app/ui/shop/cell/hot_cell" +local CELL_COUNT = 6 function HotSellCell:init() local uiMap = self.baseObject:genAllChildren() @@ -9,17 +11,55 @@ function HotSellCell:init() end) self.timeTx = uiMap["hot_sell_cell.time_tx"] - self.cells = { - uiMap["hot_sell_cell.cell_1"], - uiMap["hot_sell_cell.cell_2"], - uiMap["hot_sell_cell.cell_3"], - uiMap["hot_sell_cell.cell_4"], - uiMap["hot_sell_cell.cell_5"], - uiMap["hot_sell_cell.cell_6"], - } + self.cells = {} + for i = 1, CELL_COUNT do + local cellObj = uiMap["hot_sell_cell.cell_" .. i] + local cell = cellObj:addLuaComponent(HOT_CELL) + table.insert(self.cells, cell) + end + + self.refreshBtn = uiMap["hot_sell_cell.refresh_btn"] + self.refreshAdImg = uiMap["hot_sell_cell.refresh_btn.ad_img"] + self.refreshGemImg = uiMap["hot_sell_cell.refresh_btn.gem_img"] + self.refreshText = uiMap["hot_sell_cell.refresh_btn.desc"] + + self.refreshBtn:addClickListener(function() + self:onClickRefresh() + end) end function HotSellCell:refresh() + local goods = DataManager.ShopData:getMallDailyGoods() + local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 免费刷新次数 + local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 钻石刷新次数 + local gemRefreshCost = DataManager.ShopData:getMallDailyDiamondResetCost() -- 钻石刷新消耗 + + if freeRefreshCount > 0 then + self.refreshBtn:setVisible(true) + self.refreshAdImg:setVisible(true) + GFunc.setAdsSprite(self.refreshAdImg) + self.refreshGemImg:setVisible(false) + self.refreshText:setText("刷新TD") -- TODOJ + elseif gemRefreshCount > 0 then + self.refreshBtn:setVisible(true) + self.refreshAdImg:setVisible(false) + self.refreshGemImg:setVisible(true) + self.refreshText:setText(gemRefreshCost) + else + self.refreshBtn:setVisible(false) + end + + local goodsCount = goods and #goods or 0 + for i = 1, CELL_COUNT do + if i <= goodsCount then + self.cells[i]:setVisible(true) + self.cells[i]:refresh(goods[i], function(id) + self:onClickGift(id) + end) + else + self.cells[i]:setVisible(false) + end + end end function HotSellCell:getCellHeight() @@ -34,4 +74,22 @@ function HotSellCell:setVisible(visible) self.baseObject:setVisible(visible) end +function HotSellCell:onClickGift(id) + Logger.logHighlight("Click id:%s", id) -- TODOJ +end + +function HotSellCell:onClickRefresh() + local freeRefreshCount = DataManager.ShopData:getMallDailyAdLeftCount() -- 免费刷新次数 + local gemRefreshCount = DataManager.ShopData:getMallDailyDiamondLeftCount() -- 钻石刷新次数 + local gemRefreshCost = DataManager.ShopData:getMallDailyDiamondResetCost() -- 钻石刷新消耗 + + if freeRefreshCount > 0 then + -- TODOJ + elseif gemRefreshCount > 0 then + if GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, gemRefreshCost, true) then + -- TODOJ + end + end +end + return HotSellCell \ No newline at end of file diff --git a/lua/app/userdata/shop.meta b/lua/app/userdata/shop.meta new file mode 100644 index 00000000..6877137c --- /dev/null +++ b/lua/app/userdata/shop.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 563addd520dbcd0449b37156cd903f9d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua new file mode 100644 index 00000000..295e24a4 --- /dev/null +++ b/lua/app/userdata/shop/shop_data.lua @@ -0,0 +1,146 @@ +local ShopData = class("ShopData", BaseData) + +function ShopData:ctor() + self.data.isDirty = false +end + +function ShopData:clear() +end + +-- 通用礼包部分 ********************************************************************************************** + +-- 初始化购买的礼包 +function ShopData:initActGift(act) + act = act or {} + self.gifts = act.gifts or {} + -- 转为map结构 + for _, gift in ipairs(self.gifts) do + local giftType = gift.act_type + local giftId = gift.id + local buyCount = gift.buy_count + local latestBuyTime = gift.latest_buy_at -- 最后一次购买时间 + local latestOrderUuid = gift.latest_order_uuid -- 正在支付的订单ID + if not self.giftMap then + self.giftMap = {} + end + if not self.giftMap[giftType] then + self.giftMap[giftType] = {} + end + self.giftMap[giftType][giftId] = gift + end +end + +-- 已购买的礼包 +function ShopData:getActGifts() + return self.gifts +end + +function ShopData:getActGiftMap() + return self.giftMap +end + +function ShopData:getActGiftMapByType(actType) + return self.giftMap and self.giftMap[actType] +end + +function ShopData:getActGiftDetailData(actType, actId) + if self.giftMap then + if self.giftMap[actType] then + return self.giftMap[actType][actId] + end + end + return nil +end + +-- 获得一个礼包的已购次数 +function ShopData:getActGiftBuyCount(actType, actId) + local data = self:getActGiftDetailData(actType, actId) + if data then + return data.latest_buy_at + end + return 0 +end + +-- 通用礼包结束 ---------------------------------------------------------------------------------------------- + +-- 每日特惠部分 ********************************************************************************************** + +-- 初始化每日特惠 +function ShopData:initMallDaily(mallDaily) + mallDaily = mallDaily or {} + self.mallDailyAdResetCount = mallDaily.ad_reset_Count or 0 + self.mallDailyDiamondResetCount = mallDaily.diamond_reset_Count or 0 + self.mallDailyGoods = mallDaily.goods or {} -- {id,good_index,bought} +end + +function ShopData:getMallDailyAdResetCount() + return self.mallDailyAdResetCount +end + +function ShopData:getMallDailyAdLeftCount() + return 1 - self.mallDailyAdResetCount -- TODOJ 目前无配置表 +end + +function ShopData:getMallDailyDiamondResetCount() + return self.mallDailyDiamondResetCount +end + +function ShopData:getMallDailyDiamondLeftCount() + return 1 - self.mallDailyDiamondResetCount -- TODOJ 目前无配置表 +end + +function ShopData:getMallDailyGoods() + return self.mallDailyGoods +end + +function ShopData:getMallDailyDiamondResetCost() + return 30 -- TODOJ 目前无配置表 +end + +-- 每日特惠 广告商品最大购买次数 +function ShopData:getMallDailyFirstItemAdMaxCount() + return 5 -- TODOJ 目前无配置表 +end + +-- 每日特惠 常规商品最大购买次数 +function ShopData:getMallDailyGoodsMaxCount() + return 1 -- TODOJ 目前无配置表 +end + +-- 每日特惠结束 ---------------------------------------------------------------------------------------------- + +-- 常驻金币礼包 ********************************************************************************************** + +function ShopData:initCommonDailyGoldGift(mallIdle) + mallIdle = mallIdle or {} + self.commonDailyGoldBuyCount = mallIdle[1] or 0 -- 已购的金币广告礼包次数 +end + +function ShopData:getCommonDailyCoinAdBuyCount() + return self.commonDailyGoldBuyCount +end + +-- 金币礼包当前每小时挂机奖励 +function ShopData:getCommonDailyCoinNum(time) + local constCfg = ConfigManager:getConfig("const") + local coinPerTime = constCfg.idle_gold_drop_time.value + local chapterId = DataManager.ChapterData:getMaxChapterId() + local cfg = ConfigManager:getConfig("chapter")[chapterId] + if cfg then + return math.floor(cfg.idle_gold * (time // coinPerTime)) + else + return 0 + end +end + +-- 常驻金币礼包结束 ---------------------------------------------------------------------------------------------- + +-- 初始化成长礼包 +function ShopData:initGrowUpGift(growUpGift) +end + +-- 初始化助力礼包 +function ShopData:initLevelUpGift(levelUpGift) +end + +return ShopData \ No newline at end of file diff --git a/lua/app/userdata/shop/shop_data.lua.meta b/lua/app/userdata/shop/shop_data.lua.meta new file mode 100644 index 00000000..75f8de4f --- /dev/null +++ b/lua/app/userdata/shop/shop_data.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: fa421edcddf5a9644af17695224e8a5f +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}