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_GOLD = "MallGold",
MALL_TREASURE = "MallTreasure", MALL_TREASURE = "MallTreasure",
MAIL = "Mail", MAIL = "Mail",
SUMMON_AD = "SummonAd",
} }
BIReport.FIGHT_OPT_TYPE = { BIReport.FIGHT_OPT_TYPE = {

View File

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

View File

@ -3,7 +3,9 @@ local ItemConst = {}
ItemConst.ITEM_ID_GOLD = 1 ItemConst.ITEM_ID_GOLD = 1
ItemConst.ITEM_ID_GEM = 2 ItemConst.ITEM_ID_GEM = 2
ItemConst.ITEM_ID_VIT = 3 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_1 = 8
ItemConst.ITEM_ID_BOX_LV_2 = 9 ItemConst.ITEM_ID_BOX_LV_2 = 9
ItemConst.ITEM_ID_BOX_LV_3 = 10 ItemConst.ITEM_ID_BOX_LV_3 = 10

View File

@ -32,10 +32,10 @@ end
-- end -- end
--@region 协议 --@region 协议
function SummonManager:onForceSummonReq(count, isFree, summonType) function SummonManager:onForceSummonReq(count, free, summonType)
local args = {} local args = {}
args.times = count args.times = count
args.free = isFree args.free = free
args.id = summonType args.id = summonType
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, args, {}, self.onForceSummonRsp, BIReport.ITEM_GET_TYPE.FORCE_SUMMON) self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, args, {}, self.onForceSummonRsp, BIReport.ITEM_GET_TYPE.FORCE_SUMMON)
end end
@ -44,24 +44,23 @@ function SummonManager:onForceSummonRsp(result)
if result.status ~= 0 then if result.status ~= 0 then
return return
end end
local time_at = nil DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, result.reqData.free)
if result.reqData.free then
time_at = Time:getServerTime()
end
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, time_at)
local newForce = {} local newForce = {}
-- for _, reward in pairs(result.rewards) do local guarantee1 = DataManager.SummonData:getSummonWishGuarantee1(result.reqData.id)
for _, reward in pairs(result.rewards) do
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id) -- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
-- if isNew then -- if isNew then
-- table.insert(newForce, reward.item.id) -- table.insert(newForce, reward.item.id)
-- DataManager.ForceData:setForceIsNew(reward.item.id, false) -- DataManager.ForceData:setForceIsNew(reward.item.id, false)
-- end -- end
-- if DataManager.ForceData:getForceQlt(reward.item.id) == 4 then if guarantee1 then
-- DataManager.SummonData:setSummonTrigger(true) if DataManager.HeroData:getHeroQlt(reward.item.id) == 4 then
-- else DataManager.SummonData:setSummonTrigger(result.reqData.id, true)
-- DataManager.SummonData:setSummonTrigger(false) else
-- end DataManager.SummonData:setSummonTrigger(result.reqData.id, false)
-- end end
end
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON, result, newForce) EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON, result, newForce)
-- BIReport:postForceSummon(result.reqData.free, result.reqData.times, result.rewards, result.costs) -- 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" return "assets/prefabs/ui/summon/summon_main_ui.prefab"
end end
function SummonMainUI:currencyParams() function SummonMainUI:getCurrencyParams()
local ItemConst = require "app/module/item/item_const" local ItemConst = require "app/module/item/item_const"
local params = {} local params = {}
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
@ -26,16 +26,16 @@ function SummonMainUI:currencyParams()
params.itemIds = { params.itemIds = {
ItemConst.ITEM_ID_GOLD, ItemConst.ITEM_ID_GOLD,
ItemConst.ITEM_ID_GEM, ItemConst.ITEM_ID_GEM,
ItemConst.ITEM_ID_QLT_5_FRAGMENT, ItemConst.ITEM_ID_SUMMON_1,
} }
else else
params.itemIds = { params.itemIds = {
ItemConst.ITEM_ID_GOLD, ItemConst.ITEM_ID_GOLD,
ItemConst.ITEM_ID_GEM, ItemConst.ITEM_ID_GEM,
ItemConst.SUMMON_ACT_STONE, ItemConst.ITEM_ID_SUMMON_2,
} }
end end
return params, true return params
end end
function SummonMainUI:onClose() function SummonMainUI:onClose()
@ -45,7 +45,7 @@ function SummonMainUI:onClose()
end end
self._bgVfxMap = nil self._bgVfxMap = nil
end end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP) -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
end end
function SummonMainUI:onLoadRootComplete() function SummonMainUI:onLoadRootComplete()
@ -54,6 +54,9 @@ function SummonMainUI:onLoadRootComplete()
self:closeUI() self:closeUI()
end) end)
self.btnSummonFree = uiMap["summon_main_ui.node.btn_summon_free"] 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.btnSummonOne = uiMap["summon_main_ui.node.btn_summon_one"]
self.txSummonOneName = uiMap["summon_main_ui.node.btn_summon_one.text"] 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.txFreeTime = uiMap["summon_main_ui.node.tx_free_time"]
self.btnWish = uiMap["summon_main_ui.node.btn_wish"] --心愿 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.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
-- self.isJumpTween = self.toggleJump.isOn -- self.isJumpTween = self.toggleJump.isOn
@ -93,9 +97,14 @@ function SummonMainUI:onLoadRootComplete()
self.btnSummonTen:addClickListener(function() self.btnSummonTen:addClickListener(function()
self:onSummon(10) self:onSummon(10)
end) 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() uiMap["summon_main_ui.node.btn_info"]:addClickListener(function()
ModuleManager.SummonManager:showSummonOddsUI() ModuleManager.SummonManager:showSummonOddsUI(self.page)
end) end)
self.txTitle = uiMap["summon_main_ui.node.tx_title"] 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_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_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.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)) 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.descBg = uiMap["summon_main_ui.node.desc_bg"]
self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"] self.descTx = uiMap["summon_main_ui.node.desc_bg.desc_tx"]
@ -166,7 +175,7 @@ function SummonMainUI:onLoadRootComplete()
self.btnWish:addClickListener(function() self.btnWish:addClickListener(function()
if self.isUnlock then if self.isUnlock then
local wishHeroId = DataManager.SummonData:getSummonWishHeroId(self.page) 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) local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
if wishCount >= wishGuarantee and wishHeroId ~= 0 then if wishCount >= wishGuarantee and wishHeroId ~= 0 then
--发送领取奖励的协议 --发送领取奖励的协议
@ -203,6 +212,8 @@ function SummonMainUI:updateTime()
if not self.isFree then if not self.isFree then
self.remain_time = Time:getTodaySurplusTime() self.remain_time = Time:getTodaySurplusTime()
self.txFreeTime:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FREE_TIME, Time:formatNumTime(self.remain_time))) self.txFreeTime:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FREE_TIME, Time:formatNumTime(self.remain_time)))
else
self.txFreeTime:setText("")
end end
end end
@ -212,6 +223,7 @@ function SummonMainUI:onRefresh()
self:refreshWishBtn() self:refreshWishBtn()
-- self:refreshBtnRedPoint() -- self:refreshBtnRedPoint()
self:refreshPageBtn() self:refreshPageBtn()
self:updateTime()
end end
function SummonMainUI:refreshPageBtn() function SummonMainUI:refreshPageBtn()
@ -254,61 +266,52 @@ end
--刷新抽奖按钮 --刷新抽奖按钮
function SummonMainUI:refreshSummonBtn() function SummonMainUI:refreshSummonBtn()
local isFree = DataManager.SummonData:hasSummonFree(self.page) local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
self.btnSummonFree:setActive(isFree) local adCount = DataManager.SummonData:getSummonAdCount(self.page)
self.btnSummonOne:setActive(not isFree) 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()) -- self.txFreeTime:setActive(not isFree and not DataManager.SummonData:getIsActivity())
local itemCost = DataManager.SummonData:getSummonItemCost(self.page) local itemCost = DataManager.SummonData:getSummonItemCost(self.page)
local costId = itemCost.id local costId = itemCost.id
local costNum = itemCost.num -- local costNum = itemCost.num
local hadNum = DataManager.BagData.ItemData:getItemNumById(costId) local hadNum = DataManager.BagData.ItemData:getItemNumById(costId)
local obj = DataManager.BagData.ItemData:getItemById(costId) -- local obj = DataManager.BagData.ItemData:getItemById(costId)
if freeCount <= 0 then
if hadNum >= 1 then if hadNum >= 1 then
self.txNumOne:setText(1) self.txNumOne:setText(1)
self.btnSummonOne:addRedPoint(124, 33, 1) self.btnSummonOne:addRedPoint(124, 32, 0.6)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId)) self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
else else
self.btnSummonOne:removeRedPoint() self.btnSummonOne:removeRedPoint()
-- if DataManager.SummonData:getIsActivity() then
-- --是活动
-- self.txNumOne:setText("<color=#EC3636>1</color>")
-- self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
-- else
local cost = DataManager.SummonData:getSummonGemCost(self.page) local cost = DataManager.SummonData:getSummonGemCost(self.page)
if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, false) then if cost and hadNum == 0 and GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, false) then
self.txNumOne:setText(cost.num) self.txNumOne:setText(cost.num)
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM)) 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 else
self.txNumOne:setText("<color=#EC3636>1</color>") self.txNumOne:setText("<color=#EC3636>1</color>")
self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId)) self.imgSummonOneIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
end end
-- end end
end end
obj = DataManager.BagData.ItemData:getItemById(costId)
if hadNum >= 10 then if hadNum >= 10 then
self.txNumTen:setText(10) self.txNumTen:setText(10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId)) self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
self.btnSummonTen:addRedPoint(124, 33, 1) self.btnSummonTen:addRedPoint(124, 32, 0.6)
else else
self.btnSummonTen:removeRedPoint() 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) 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 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.txNumTen:setText(cost.num * 10)
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(GConst.ItemConst.ITEM_ID_GEM)) self.imgSummonTenIcon: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 else
self.txNumTen:setText("<color=#EC3636>10</color>") self.txNumTen:setText("<color=#EC3636>10</color>")
self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId)) self.imgSummonTenIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
end end
-- end
end end
end end
@ -331,56 +334,10 @@ function SummonMainUI:refreshWishBtn()
local summonCount = DataManager.SummonData:getSummonCount(self.page) local summonCount = DataManager.SummonData:getSummonCount(self.page)
local unlockCount = DataManager.SummonData:getSummonWishUnlock(self.page) local unlockCount = DataManager.SummonData:getSummonWishUnlock(self.page)
self.isUnlock = summonCount >= unlockCount 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)) -- self.txUnlock:setText(summonCount .. "/" .. unlockCount .. I18N:getGlobalText(I18N.GlobalConst.MAGIC_BOOK_DESC_4))
-- end local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
-- if isAddRedPoint then local needCount = DataManager.SummonData:getSummonWishGuarantee2(self.page)
-- self.btnWish:addRedPoint(33, 33, 1) self.btnWishTx:setText(wishCount .. "/" .. needCount)
-- else
-- self.btnWish:removeRedPoint()
-- end
end end
--检查单抽红点 --检查单抽红点
@ -392,12 +349,16 @@ function SummonMainUI:refreshBtnRedPoint()
end end
end end
function SummonMainUI:onSummon(count) function SummonMainUI:onSummon(count, isAd)
local isFree = DataManager.SummonData:hasSummonFree(self.page) if isAd then
if isFree and count == 1 then
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START) AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, true) ModuleManager.SummonManager:onForceSummonReq(count, 1, self.page)
else 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 costs = DataManager.SummonData:getSummonCosts(self.page, count)
local hasGemCost = false local hasGemCost = false
for i, cost in ipairs(costs) do for i, cost in ipairs(costs) do
@ -422,7 +383,7 @@ function SummonMainUI:onSummon(count)
end end
end end
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START) AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, false, self.page) ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
end end
GFunc.showMessageBox(params) GFunc.showMessageBox(params)
return return
@ -434,7 +395,7 @@ function SummonMainUI:onSummon(count)
end end
end end
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START) AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
ModuleManager.SummonManager:onForceSummonReq(count, false, self.page) ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
end end
end end

View File

@ -61,11 +61,11 @@ function SummonOddsUI:onRefresh()
-- local txName = uiMap["title.bg.tx_name"] -- local txName = uiMap["title.bg.tx_name"]
-- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1]) -- bg:setSprite(GConst.ATLAS_PATH.UI_SUMMON, "summon_bg_" .. data[1])
if i == 1 then 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 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 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 end
-- descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3, data[2] / 100)) -- descTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_GET_DESC_3, data[2] / 100))
local layoutObj = CS.UnityEngine.Object.Instantiate(self.layout:getGameObject()) 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) local cost = DataManager.SummonData:getSummonGemCost(self.page)
if count >= 1 then if count >= 1 then
self.txNumOne:setText(1) self.txNumOne:setText(1)
self.btnSummonOne:addRedPoint(124, 33, 1) self.btnSummonOne:addRedPoint(100, 30, 0.6)
else else
self.btnSummonOne:removeRedPoint() self.btnSummonOne:removeRedPoint()
if cost then if cost then
@ -116,7 +116,7 @@ function SummonRewardUI:refreshSummonBtn()
obj = DataManager.BagData.ItemData:getItemById(costId) obj = DataManager.BagData.ItemData:getItemById(costId)
if count >= 10 then if count >= 10 then
self.txNumTen:setText(10) self.txNumTen:setText(10)
self.btnSummonTen:addRedPoint(124, 33, 1) self.btnSummonTen:addRedPoint(100, 30, 0.6)
else else
self.btnSummonTen:removeRedPoint() self.btnSummonTen:removeRedPoint()
if cost then if cost then

View File

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

View File

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