This commit is contained in:
puxuan 2025-08-13 15:38:02 +08:00
parent de7a7f3777
commit 027b50b152
9 changed files with 186 additions and 191 deletions

View File

@ -208,6 +208,7 @@ BIReport.ADS_CLICK_TYPE = {
MALL_GOLD = "MallGold",
MALL_TREASURE = "MallTreasure",
MAIL = "Mail",
SUMMON_AD = "SummonAd",
}
BIReport.FIGHT_OPT_TYPE = {

View File

@ -3,13 +3,15 @@ local summon = {
["item_cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=13,
["id_for_nothing"]="Vws=",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["ad_time"]=12,
["free_time"]=23,
["ad_num"]=1,
["free_num"]=1,
["ad_time"]=1,
["free_time"]=1,
["summon"]={
{
["id"]=13001,
@ -125,8 +127,8 @@ local summon = {
["item_cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=14,
["id_for_nothing"]="Vww=",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
},
@ -138,8 +140,10 @@ local summon = {
["num"]=200,
["num_for_nothing"]="VAhc"
},
["ad_time"]=23,
["free_time"]=47,
["ad_num"]=1,
["free_num"]=1,
["ad_time"]=1,
["free_time"]=1,
["summon"]={
{
["id"]=13001,
@ -312,8 +316,8 @@ local summon = {
["item_cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=15,
["id_for_nothing"]="Vw0=",
["id"]=7,
["id_for_nothing"]="UQ==",
["num"]=1,
["num_for_nothing"]="Vw=="
},

View File

@ -3,7 +3,9 @@ local ItemConst = {}
ItemConst.ITEM_ID_GOLD = 1
ItemConst.ITEM_ID_GEM = 2
ItemConst.ITEM_ID_VIT = 3
ItemConst.ITEM_ID_BOUNTY_EXP = 7
ItemConst.ITEM_ID_SUMMON_1 = 5
ItemConst.ITEM_ID_SUMMON_2 = 6
ItemConst.ITEM_ID_SUMMON_3 = 7
ItemConst.ITEM_ID_BOX_LV_1 = 8
ItemConst.ITEM_ID_BOX_LV_2 = 9
ItemConst.ITEM_ID_BOX_LV_3 = 10

View File

@ -32,10 +32,10 @@ end
-- end
--@region 协议
function SummonManager:onForceSummonReq(count, isFree, summonType)
function SummonManager:onForceSummonReq(count, free, summonType)
local args = {}
args.times = count
args.free = isFree
args.free = free
args.id = summonType
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, args, {}, self.onForceSummonRsp, BIReport.ITEM_GET_TYPE.FORCE_SUMMON)
end
@ -44,24 +44,23 @@ function SummonManager:onForceSummonRsp(result)
if result.status ~= 0 then
return
end
local time_at = nil
if result.reqData.free then
time_at = Time:getServerTime()
end
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, time_at)
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, result.reqData.free)
local newForce = {}
-- for _, reward in pairs(result.rewards) do
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
-- if isNew then
-- table.insert(newForce, reward.item.id)
-- DataManager.ForceData:setForceIsNew(reward.item.id, false)
-- end
-- if DataManager.ForceData:getForceQlt(reward.item.id) == 4 then
-- DataManager.SummonData:setSummonTrigger(true)
-- else
-- DataManager.SummonData:setSummonTrigger(false)
-- end
-- end
local guarantee1 = DataManager.SummonData:getSummonWishGuarantee1(result.reqData.id)
for _, reward in pairs(result.rewards) do
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
-- if isNew then
-- table.insert(newForce, reward.item.id)
-- DataManager.ForceData:setForceIsNew(reward.item.id, false)
-- end
if guarantee1 then
if DataManager.HeroData:getHeroQlt(reward.item.id) == 4 then
DataManager.SummonData:setSummonTrigger(result.reqData.id, true)
else
DataManager.SummonData:setSummonTrigger(result.reqData.id, false)
end
end
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON, result, newForce)
-- BIReport:postForceSummon(result.reqData.free, result.reqData.times, result.rewards, result.costs)

View File

@ -18,7 +18,7 @@ function SummonMainUI:getPrefabPath()
return "assets/prefabs/ui/summon/summon_main_ui.prefab"
end
function SummonMainUI:currencyParams()
function SummonMainUI:getCurrencyParams()
local ItemConst = require "app/module/item/item_const"
local params = {}
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
@ -26,16 +26,16 @@ function SummonMainUI:currencyParams()
params.itemIds = {
ItemConst.ITEM_ID_GOLD,
ItemConst.ITEM_ID_GEM,
ItemConst.ITEM_ID_QLT_5_FRAGMENT,
ItemConst.ITEM_ID_SUMMON_1,
}
else
params.itemIds = {
ItemConst.ITEM_ID_GOLD,
ItemConst.ITEM_ID_GEM,
ItemConst.SUMMON_ACT_STONE,
ItemConst.ITEM_ID_SUMMON_2,
}
end
return params, true
return params
end
function SummonMainUI:onClose()
@ -45,7 +45,7 @@ function SummonMainUI:onClose()
end
self._bgVfxMap = nil
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
end
function SummonMainUI:onLoadRootComplete()
@ -54,6 +54,9 @@ function SummonMainUI:onLoadRootComplete()
self:closeUI()
end)
self.btnSummonFree = uiMap["summon_main_ui.node.btn_summon_free"]
self.btnSummonFreeTx = uiMap["summon_main_ui.node.btn_summon_free.text_free"]
self.btnSummonAd = uiMap["summon_main_ui.node.btn_summon_ad"]
self.btnSummonAdTx = uiMap["summon_main_ui.node.btn_summon_ad.desc_tx"]
--两个抽奖按钮
self.btnSummonOne = uiMap["summon_main_ui.node.btn_summon_one"]
self.txSummonOneName = uiMap["summon_main_ui.node.btn_summon_one.text"]
@ -68,6 +71,7 @@ function SummonMainUI:onLoadRootComplete()
self.txFreeTime = uiMap["summon_main_ui.node.tx_free_time"]
self.btnWish = uiMap["summon_main_ui.node.btn_wish"] --心愿
self.btnWishTx = uiMap["summon_main_ui.node.btn_wish.unlock.tx_guarantee"] --心愿
-- self.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
-- self.isJumpTween = self.toggleJump.isOn
@ -93,9 +97,14 @@ function SummonMainUI:onLoadRootComplete()
self.btnSummonTen:addClickListener(function()
self:onSummon(10)
end)
self.btnSummonAd:addClickListener(function()
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.SUMMON_AD, function()
self:onSummon(1, true)
end)
end)
uiMap["summon_main_ui.node.btn_info"]:addClickListener(function()
ModuleManager.SummonManager:showSummonOddsUI()
ModuleManager.SummonManager:showSummonOddsUI(self.page)
end)
self.txTitle = uiMap["summon_main_ui.node.tx_title"]
@ -103,7 +112,7 @@ function SummonMainUI:onLoadRootComplete()
uiMap["summon_main_ui.node.btn_summon_one.text_one"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_ONE))
uiMap["summon_main_ui.node.btn_summon_ten.text_ten"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_TEN))
uiMap["summon_main_ui.node.btn_summon_free.text_free"]:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_THIS_TIME_DESC))
uiMap["summon_main_ui.node.btn_summon_free.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_22))
uiMap["summon_main_ui.node.btn_summon_ad.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_22))
uiMap["summon_main_ui.node.btn_info.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_3))
self.descBg = uiMap["summon_main_ui.node.desc_bg"]
self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]
@ -166,7 +175,7 @@ function SummonMainUI:onLoadRootComplete()
self.btnWish:addClickListener(function()
if self.isUnlock then
local wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page)
local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee(self.page)
local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee2(self.page)
local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
if wishCount >= wishGuarantee and wishHeroId ~= 0 then
--发送领取奖励的协议
@ -203,6 +212,8 @@ function SummonMainUI:updateTime()
if not self.isFree then
self.remain_time = Time:getTodaySurplusTime()
self.txFreeTime:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FREE_TIME, Time:formatNumTime(self.remain_time)))
else
self.txFreeTime:setText("")
end
end
@ -212,6 +223,7 @@ function SummonMainUI:onRefresh()
self:refreshWishBtn()
-- self:refreshBtnRedPoint()
self:refreshPageBtn()
self:updateTime()
end
function SummonMainUI:refreshPageBtn()
@ -254,61 +266,52 @@ end
--刷新抽奖按钮
function SummonMainUI:refreshSummonBtn()
local isFree = DataManager.SummonData:hasSummonFree(self.page)
self.btnSummonFree:setActive(isFree)
self.btnSummonOne:setActive(not isFree)
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
local adCount = DataManager.SummonData:getSummonAdCount(self.page)
self.btnSummonAd:setActive(adCount > 0)
self.btnSummonFree:setActive(freeCount > 0)
self.btnSummonOne:setActive(freeCount <= 0)
-- self.txFreeTime:setActive(not isFree and not DataManager.SummonData:getIsActivity())
local itemCost = DataManager.SummonData:getSummonItemCost(self.page)
local costId = itemCost.id
local costNum = itemCost.num
-- local costNum = itemCost.num
local hadNum = DataManager.BagData.ItemData:getItemNumById(costId)
local obj = DataManager.BagData.ItemData:getItemById(costId)
if hadNum >= 1 then
self.txNumOne:setText(1)
self.btnSummonOne:addRedPoint(124, 33, 1)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
else
self.btnSummonOne:removeRedPoint()
-- if DataManager.SummonData:getIsActivity() then
-- --是活动
-- self.txNumOne:setText("<color=#EC3636>1</color>")
-- self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
-- else
-- local obj = DataManager.BagData.ItemData:getItemById(costId)
if freeCount <= 0 then
if hadNum >= 1 then
self.txNumOne:setText(1)
self.btnSummonOne:addRedPoint(124, 32, 0.6)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
else
self.btnSummonOne:removeRedPoint()
local cost = DataManager.SummonData:getSummonGemCost(self.page)
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, false) then
self.txNumOne:setText(cost.num)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
obj = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
-- obj = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
else
self.txNumOne:setText("<color=#EC3636>1</color>")
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
end
-- end
end
end
obj = DataManager.BagData.ItemData:getItemById(costId)
if hadNum >= 10 then
self.txNumTen:setText(10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
self.btnSummonTen:addRedPoint(124, 33, 1)
self.btnSummonTen:addRedPoint(124, 32, 0.6)
else
self.btnSummonTen:removeRedPoint()
-- if DataManager.SummonData:getIsActivity() then
-- --是活动
-- self.txNumTen:setText("<color=#EC3636>10</color>")
-- self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
-- else
local cost = DataManager.SummonData:getSummonGemCost(self.page)
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num * 10, false) then
self.txNumTen:setText(cost.num * 10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
obj = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
else
self.txNumTen:setText("<color=#EC3636>10</color>")
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
end
-- end
local cost = DataManager.SummonData:getSummonGemCost(self.page)
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num * 10, false) then
self.txNumTen:setText(cost.num * 10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM))
-- obj = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
else
self.txNumTen:setText("<color=#EC3636>10</color>")
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
end
end
end
@ -331,56 +334,10 @@ function SummonMainUI:refreshWishBtn()
local summonCount = DataManager.SummonData:getSummonCount(self.page)
local unlockCount = DataManager.SummonData:getSummonWishUnlock(self.page)
self.isUnlock = summonCount >= unlockCount
-- self.wishUnlock:setActive(self.isUnlock)
-- self.wishLock:setActive(not self.isUnlock)
-- if self.isUnlock then
-- local wishHeroId = DataManager.SummonData:getSummonWishHeroId()
-- if wishHeroId ~= 0 then
-- local modelId = DataManager.ForceData:getForceModelId(wishHeroId)
-- local qlt = DataManager.ForceData:getForceQlt(wishHeroId)
-- self.wishQlt:setActive(true)
-- self.wishQlt:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceQltItem(qlt))
-- if self.wishModelId ~= modelId then
-- self.wishModelId = modelId
-- end
-- if self.wishModelId ~= nil then
-- self.imgWishIcon:setActive(true)
-- self.imgWishIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, DataManager.ForceData:getForceFightIcon(wishHeroId))
-- else
-- self.imgWishIcon:setActive(false)
-- end
-- isAddRedPoint = false
-- else
-- self.wishQlt:setActive(false)
-- self.imgWishIcon:setActive(false)
-- isAddRedPoint = true
-- end
-- local wishGuarantee = DataManager.SummonData:getSummonWishGuarantee()
-- local wishCount = DataManager.SummonData:getSummonWishCount()
-- if wishCount >= wishGuarantee then
-- self.btnWish:addRedPoint(124, 33, 1)
-- self.txGuarantee:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_GET))
-- isAddRedPoint = true
-- self.wishMask:setActive(false)
-- else
-- if wishHeroId ~= 0 then
-- self.wishMask:setActive(true)
-- else
-- self.wishMask:setActive(false)
-- end
-- self.txGuarantee:setText(wishCount .. "/" .. wishGuarantee)
-- self.wishMaskSlider.fillAmount = 1 - (wishCount / wishGuarantee)
-- end
-- else
-- isAddRedPoint = false
-- self.btnWish:removeRedPoint()
-- self.txUnlock:setText(summonCount .. "/" .. unlockCount .. I18N:getGlobalText(I18N.GlobalConst.MAGIC_BOOK_DESC_4))
-- end
-- if isAddRedPoint then
-- self.btnWish:addRedPoint(33, 33, 1)
-- else
-- self.btnWish:removeRedPoint()
-- end
-- self.txUnlock:setText(summonCount .. "/" .. unlockCount .. I18N:getGlobalText(I18N.GlobalConst.MAGIC_BOOK_DESC_4))
local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
local needCount = DataManager.SummonData:getSummonWishGuarantee2(self.page)
self.btnWishTx:setText(wishCount .. "/" .. needCount)
end
--检查单抽红点
@ -392,12 +349,16 @@ function SummonMainUI:refreshBtnRedPoint()
end
end
function SummonMainUI:onSummon(count)
local isFree = DataManager.SummonData:hasSummonFree(self.page)
if isFree and count == 1 then
function SummonMainUI:onSummon(count, isAd)
if isAd then
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, true)
ModuleManager.SummonManager:onForceSummonReq(count, 1, self.page)
else
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
if freeCount > 0 then
ModuleManager.SummonManager:onForceSummonReq(count, 2, self.page)
return
end
local costs = DataManager.SummonData:getSummonCosts(self.page, count)
local hasGemCost = false
for i, cost in ipairs(costs) do
@ -422,7 +383,7 @@ function SummonMainUI:onSummon(count)
end
end
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, false, self.page)
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
end
GFunc.showMessageBox(params)
return
@ -434,7 +395,7 @@ function SummonMainUI:onSummon(count)
end
end
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, false, self.page)
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
end
end

View File

@ -61,11 +61,11 @@ function SummonOddsUI:onRefresh()
-- local txName = uiMap["title.bg.tx_name"]
-- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
if i == 1 then
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_3))
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_3) .. data[2] / 100 .. "%")
elseif i == 2 then
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_4))
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_4) .. data[2] / 100 .. "%")
else
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_5))
descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_CARD_DESC_QLT_5) .. data[2] / 100 .. "%")
end
-- descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3, data[2] / 100))
local layoutObj = CS.UnityEngine.Object.Instantiate(self.layout:getGameObject())

View File

@ -95,7 +95,7 @@ function SummonRewardUI:refreshSummonBtn()
local cost = DataManager.SummonData:getSummonGemCost(self.page)
if count >= 1 then
self.txNumOne:setText(1)
self.btnSummonOne:addRedPoint(124, 33, 1)
self.btnSummonOne:addRedPoint(100, 30, 0.6)
else
self.btnSummonOne:removeRedPoint()
if cost then
@ -116,7 +116,7 @@ function SummonRewardUI:refreshSummonBtn()
obj = DataManager.BagData.ItemData:getItemById(costId)
if count >= 10 then
self.txNumTen:setText(10)
self.btnSummonTen:addRedPoint(124, 33, 1)
self.btnSummonTen:addRedPoint(100, 30, 0.6)
else
self.btnSummonTen:removeRedPoint()
if cost then

View File

@ -221,8 +221,8 @@ function ItemData:_addItemNumById(id, num)
self:resetItemRecoveryTime(ItemConst.ITEM_ID_VIT)
end
end
elseif id == ItemConst.ITEM_ID_BOUNTY_EXP then
DataManager.BountyData:addExp(num)
-- elseif id == ItemConst.ITEM_ID_BOUNTY_EXP then
-- DataManager.BountyData:addExp(num)
elseif id == ItemConst.ITEM_ID_ARENA_BOUNTY_EXP then
DataManager.ArenaBountyData:addExp(num)
elseif id == ItemConst.ITEM_ID_EXP then

View File

@ -38,17 +38,19 @@ function SummonData:initData(data)
self.summonDataMap = {}
for k,v in pairs(data) do
self.summonDataMap[k] = {}
self.summonDataMap[k].freeAt = v.free_at
self.summonDataMap[k].freeCount = v.free_count
self.summonDataMap[k].adCount = v.ad_count
self.summonDataMap[k].statCount = v.stat_count
self.summonDataMap[k].triggerCount = v.trigger_count
self.summonDataMap[k].wishId = v.wish_id
self.summonDataMap[k].wishCount = v.wish_count
end
-- int64 free_at = 1; // 上次免费抽取时间
-- int64 stat_count = 2; // 总抽取次数
-- int64 trigger_count = 3; // 保底累计次数
-- int32 wish_id = 4; // 心愿英雄 ID
-- int64 wish_count = 5; // 心愿累计次数
-- int64 free_count = 1; // 今日免费次数
-- int64 ad_count = 2; // 今日广告免费次数
-- int64 stat_count = 3; // 总抽取次数
-- int64 trigger_count = 4; // 保底累计次数
-- int32 wish_id = 5; // 心愿英雄 ID
-- int64 wish_count = 6; // 心愿累计次数
end
function SummonData:getIsOpen(showToast)
@ -61,16 +63,15 @@ end
--@region 抽奖数据
--是否有免费抽奖
function SummonData:hasSummonFree(summonType)
local freeCd = self:getSummonFreeCd(summonType)
if freeCd == nil then
return false
end
local freeTime = self:getSummonFreeAT(summonType)
if freeTime == nil then
local freeCount = self:getSummonFreeCount(summonType)
if freeCount > 0 then
return true
end
local nowTime = Time:getServerTime()
return nowTime > freeTime + freeCd * 3600
local adCount = self:getSummonAdCount(summonType)
if adCount > 0 then
return true
end
return false
end
-- 心愿次数
@ -86,13 +87,27 @@ function SummonData:getSummonWishHeroId(summonType)
if self.summonDataMap[summonType] then
return self.summonDataMap[summonType].wishId
end
return 0
end
-- 获取上一次抽奖的时间
function SummonData:getSummonFreeAT(summonType)
-- 获取免费抽取次数
function SummonData:getSummonFreeCount(summonType)
local freeCount = self:getSummonFreeNum(summonType)
local useCount = 0
if self.summonDataMap[summonType] then
return self.summonDataMap[summonType].freeAt
useCount = self.summonDataMap[summonType].freeCount or 0
end
return freeCount - useCount
end
-- 获取免费广告抽取次数
function SummonData:getSummonAdCount(summonType)
local freeCount = self:getSummonAdNum(summonType)
local useCount = 0
if self.summonDataMap[summonType] then
useCount = self.summonDataMap[summonType].adCount or 0
end
return freeCount - useCount
end
-- 保底累计次数
@ -130,11 +145,8 @@ function SummonData:summonWishClaim(summonType)
end
-- 刷新抽奖次数
function SummonData:updateSummonCount(summonType, times, at)
function SummonData:updateSummonCount(summonType, times, free)
if self.summonDataMap[summonType] then
if at ~= nil then
self.summonDataMap[summonType].freeAt = at
end
local unlockTimes = self:getSummonWishUnlock(summonType)
if unlockTimes and self.summonDataMap[summonType].statCount + times >= unlockTimes then
if self.summonDataMap[summonType].statCount < unlockTimes then
@ -145,7 +157,13 @@ function SummonData:updateSummonCount(summonType, times, at)
end
end
self.summonDataMap[summonType].statCount = self.summonDataMap[summonType].statCount + times
if free and free == 1 then
self.summonDataMap[summonType].adCount = self.summonDataMap[summonType].adCount + 1
elseif free and free == 2 then
self.summonDataMap[summonType].freeCount = self.summonDataMap[summonType].freeCount + 1
end
end
self:setDirty()
end
function SummonData:setSummonTrigger(summonType, isReset)
@ -163,37 +181,38 @@ end
--@region 红点
function SummonData:hasSummonCostRedPoint(count)
if count then
local itemCost = self:getSummonItemCost()
local costId = GFunc.getRewardId(itemCost)
local costNum = GFunc.getRewardNum(itemCost)
if GFunc.checkCost(costId, costNum * count, false) then
return true
end
local actId = self:getSummonOpenActivityId()
if actId then
local itemCost = self:getSummonItemCost(actId)
if itemCost then
local costId = GFunc.getRewardId(itemCost)
local costNum = GFunc.getRewardNum(itemCost)
if GFunc.checkCost(costId, costNum * count, false) then
return true
end
end
end
return false
else
if self:hasSummonCostRedPoint(1) then
return true
end
if self:hasSummonCostRedPoint(10) then
return true
end
if self:hasSummonFree() then
return true
end
end
return false
-- if count then
-- local itemCost = self:getSummonItemCost()
-- local costId = GFunc.getRewardId(itemCost)
-- local costNum = GFunc.getRewardNum(itemCost)
-- if GFunc.checkCost(costId, costNum * count, false) then
-- return true
-- end
-- local actId = self:getSummonOpenActivityId()
-- if actId then
-- local itemCost = self:getSummonItemCost(actId)
-- if itemCost then
-- local costId = GFunc.getRewardId(itemCost)
-- local costNum = GFunc.getRewardNum(itemCost)
-- if GFunc.checkCost(costId, costNum * count, false) then
-- return true
-- end
-- end
-- end
-- return false
-- else
-- if self:hasSummonCostRedPoint(1) then
-- return true
-- end
-- if self:hasSummonCostRedPoint(10) then
-- return true
-- end
-- if self:hasSummonFree() then
-- return true
-- end
-- end
-- return false
return self:hasSummonFree()
end
--@endregion
@ -270,12 +289,13 @@ function SummonData:getSummonWishConfig(summonType)
end
-- 心愿保底次数
function SummonData:getSummonWishGuarantee(summonType)
function SummonData:getSummonWishGuarantee2(summonType)
return SummonCfg[summonType].guarantee2
end
function SummonData:getSummonFreeCd(summonType)
return SummonCfg[summonType].ad_time
-- 小保底次数
function SummonData:getSummonWishGuarantee1(summonType)
return SummonCfg[summonType].guarantee1
end
function SummonData:getSummonFreeCd(summonType)
@ -285,6 +305,14 @@ end
function SummonData:getSummonWeight(summonType)
return SummonCfg[summonType].summon
end
function SummonData:getSummonAdNum(summonType)
return SummonCfg[summonType].ad_num
end
function SummonData:getSummonFreeNum(summonType)
return SummonCfg[summonType].free_num
end
--@endregion
return SummonData