抽卡
This commit is contained in:
parent
0a5cedcf76
commit
1e8c35c9a0
@ -27,9 +27,9 @@ function SummonManager:showSummonOddsUI(summonId)
|
|||||||
UIManager:showUI("app/ui/summon/summon_odds_ui", {summonId = summonId})
|
UIManager:showUI("app/ui/summon/summon_odds_ui", {summonId = summonId})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function SummonManager:showSummonResultUI(params)
|
function SummonManager:showSummonUnlockUI(params)
|
||||||
-- UIManager:showUI("app/ui/summon/summon_result_ui", params)
|
UIManager:showUI("app/ui/summon/summon_unlock_ui", params)
|
||||||
-- end
|
end
|
||||||
|
|
||||||
--@region 协议
|
--@region 协议
|
||||||
function SummonManager:onForceSummonReq(count, free, summonType)
|
function SummonManager:onForceSummonReq(count, free, summonType)
|
||||||
@ -45,14 +45,14 @@ function SummonManager:onForceSummonRsp(result)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, result.reqData.free)
|
DataManager.SummonData:updateSummonCount(result.reqData.id, result.reqData.times, result.reqData.free)
|
||||||
local newForce = {}
|
local newHero = {}
|
||||||
local guarantee1 = DataManager.SummonData:getSummonWishGuarantee1(result.reqData.id)
|
local guarantee1 = DataManager.SummonData:getSummonWishGuarantee1(result.reqData.id)
|
||||||
for _, reward in pairs(result.rewards) do
|
for _, reward in pairs(result.rewards) do
|
||||||
-- local isNew = DataManager.ForceData:getForceIsNew(reward.item.id)
|
local isNew = DataManager.HeroData:getHeroIsNew(reward.item.id)
|
||||||
-- if isNew then
|
isNew = true
|
||||||
-- table.insert(newForce, reward.item.id)
|
if isNew then
|
||||||
-- DataManager.ForceData:setForceIsNew(reward.item.id, false)
|
table.insert(newHero, reward.item.id)
|
||||||
-- end
|
end
|
||||||
if guarantee1 then
|
if guarantee1 then
|
||||||
if DataManager.HeroData:getHeroQlt(reward.item.id) == 5 then
|
if DataManager.HeroData:getHeroQlt(reward.item.id) == 5 then
|
||||||
DataManager.SummonData:setSummonTrigger(result.reqData.id, true)
|
DataManager.SummonData:setSummonTrigger(result.reqData.id, true)
|
||||||
@ -61,7 +61,7 @@ function SummonManager:onForceSummonRsp(result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON, result, newForce)
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.FORCE_SUMMON, result, newHero)
|
||||||
-- BIReport:postForceSummon(result.reqData.free, result.reqData.times, result.rewards, result.costs)
|
-- BIReport:postForceSummon(result.reqData.free, result.reqData.times, result.rewards, result.costs)
|
||||||
|
|
||||||
-- local params = {
|
-- local params = {
|
||||||
@ -75,10 +75,8 @@ function SummonManager:onForceSummonRsp(result)
|
|||||||
-- DataManager.GameSettingData:showRateUIByForceSummon()
|
-- DataManager.GameSettingData:showRateUIByForceSummon()
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|
||||||
function SummonManager:onSummonWishSetReq(summonType, heroId)
|
function SummonManager:onSummonWishSetReq(summonType, heroId)
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, {}, self.onSummonWishSetRsp,
|
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, {}, self.onSummonWishSetRsp,
|
||||||
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
|
||||||
|
|||||||
@ -11,7 +11,6 @@ local SummonMainUI = class("SummonMainUI", BaseUI)
|
|||||||
|
|
||||||
function SummonMainUI:ctor(params)
|
function SummonMainUI:ctor(params)
|
||||||
self.page = params.summonId or 1
|
self.page = params.summonId or 1
|
||||||
self._bgVfxMap = {}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonMainUI:getPrefabPath()
|
function SummonMainUI:getPrefabPath()
|
||||||
@ -39,12 +38,7 @@ function SummonMainUI:getCurrencyParams()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SummonMainUI:onClose()
|
function SummonMainUI:onClose()
|
||||||
if self._bgVfxMap then
|
self.heroNode:removeAllChildren()
|
||||||
for k, v in pairs(self._bgVfxMap) do
|
|
||||||
v:destroy()
|
|
||||||
end
|
|
||||||
self._bgVfxMap = nil
|
|
||||||
end
|
|
||||||
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
|
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -74,22 +68,10 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
self.btnWishTx = uiMap["summon_main_ui.node.btn_wish.unlock.tx_guarantee"] --心愿
|
self.btnWishTx = uiMap["summon_main_ui.node.btn_wish.unlock.tx_guarantee"] --心愿
|
||||||
self.btnWishIcon = uiMap["summon_main_ui.node.btn_wish.unlock.img_wish_icon"] --心愿
|
self.btnWishIcon = uiMap["summon_main_ui.node.btn_wish.unlock.img_wish_icon"] --心愿
|
||||||
self.btnWishAddImg = uiMap["summon_main_ui.node.btn_wish.add_img"]
|
self.btnWishAddImg = uiMap["summon_main_ui.node.btn_wish.add_img"]
|
||||||
|
self.heroNode = uiMap["summon_main_ui.node.hero_node"]
|
||||||
|
|
||||||
-- self.toggleJump = uiMap["summon_main_ui.jump_tween"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TOGGLE)
|
|
||||||
-- self.isJumpTween = self.toggleJump.isOn
|
|
||||||
-- self.toggleJump.onValueChanged:AddListener(function(isOn) self.isJumpTween = isOn end)
|
|
||||||
self.touchNode = uiMap["summon_main_ui.node.touch_node"]
|
self.touchNode = uiMap["summon_main_ui.node.touch_node"]
|
||||||
self.touchNode:setActive(false)
|
self.touchNode:setActive(false)
|
||||||
-- uiMap["summon_main_ui.jump_tween"]:setActive(false)
|
|
||||||
|
|
||||||
-- self.vfx_b13_ui_chouka_bg_b01 = uiMap["summon_main_ui.vfx_b13_ui_chouka_bg_b01"]
|
|
||||||
-- self.wishMask = uiMap["summon_main_ui.node.btn_wish.unlock.mask"]
|
|
||||||
-- self.wishQlt = uiMap["summon_main_ui.node.btn_wish.unlock.qlt"]
|
|
||||||
-- self.wishMaskSlider = uiMap["summon_main_ui.node.btn_wish.unlock.mask"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE)
|
|
||||||
|
|
||||||
-- self.descTx = uiMap["summon_main_ui.btn_wish.desc_tx"]
|
|
||||||
-- self.descTx = uiMap["summon_main_ui.btn_info.desc_tx"]
|
|
||||||
-- self.descTx = uiMap["summon_main_ui.jump_tween.desc_tx"]
|
|
||||||
self.btnSummonFree:addClickListener(function()
|
self.btnSummonFree:addClickListener(function()
|
||||||
self:onSummon(1)
|
self:onSummon(1)
|
||||||
end)
|
end)
|
||||||
@ -105,6 +87,15 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
self.vfxs = {}
|
||||||
|
self.vfx01s = {}
|
||||||
|
for i = 1, 4 do
|
||||||
|
self.vfxs[i] = uiMap["summon_main_ui.node.vfx_c1_chouka_0" .. i]
|
||||||
|
self.vfx01s[i] = uiMap["summon_main_ui.node.vfx_c1_chouka_0" .. i .. "_1"]
|
||||||
|
self.vfxs[i]:setActive(false)
|
||||||
|
self.vfx01s[i]:setActive(false)
|
||||||
|
end
|
||||||
|
|
||||||
uiMap["summon_main_ui.node.btn_info"]:addClickListener(function()
|
uiMap["summon_main_ui.node.btn_info"]:addClickListener(function()
|
||||||
ModuleManager.SummonManager:showSummonOddsUI(self.page)
|
ModuleManager.SummonManager:showSummonOddsUI(self.page)
|
||||||
end)
|
end)
|
||||||
@ -118,20 +109,6 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
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"]
|
||||||
-- self.spineHero = {}
|
|
||||||
-- for i = 1, 3 do
|
|
||||||
-- self.spineHero[i] = uiMap['summon_main_ui.ui_spine_obj_'..i]
|
|
||||||
-- if i ~= 1 then
|
|
||||||
-- self.spineHero[i]:setDefaultMix(0)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- self.heroTips = {}
|
|
||||||
-- for i = 1, 2 do
|
|
||||||
-- self.heroTips[i] = {}
|
|
||||||
-- self.heroTips[i].tips = uiMap['summon_main_ui.node.hero_'..i]
|
|
||||||
-- self.heroTips[i].txName = uiMap['summon_main_ui.node.hero_'..i..'.tx_hero_name']
|
|
||||||
-- self.heroTips[i].txDesc = uiMap['summon_main_ui.node.hero_'..i..'.tx_hero_desc']
|
|
||||||
-- end
|
|
||||||
self.btnTxs = {
|
self.btnTxs = {
|
||||||
I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_6),
|
I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_6),
|
||||||
I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_7),
|
I18N:getGlobalText(I18N.GlobalConst.SUMMON_DESC_7),
|
||||||
@ -153,16 +130,16 @@ function SummonMainUI:onLoadRootComplete()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-------------抽奖相关---------
|
-------------抽奖相关---------
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON, function(result, newForce)
|
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON, function(result, newHero)
|
||||||
self:refreshWishBtn()
|
self:refreshWishBtn()
|
||||||
self:onSummonRsp(result, newForce)
|
self:onSummonRsp(result, newHero)
|
||||||
end)
|
end)
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, function(result, newForce)
|
self:addEventListener(EventManager.CUSTOM_EVENT.FORCE_SUMMON_WISH_CLAIM, function(result, newHero)
|
||||||
self:refreshWishBtn()
|
self:refreshWishBtn()
|
||||||
ModuleManager.SummonManager:showSummonRewardUI({
|
ModuleManager.SummonManager:showSummonRewardUI({
|
||||||
rewards = result.rewards,
|
rewards = result.rewards,
|
||||||
isWish = true,
|
isWish = true,
|
||||||
newForce = newForce,
|
newHero = newHero,
|
||||||
page = self.page
|
page = self.page
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
@ -232,38 +209,10 @@ function SummonMainUI:refreshPageBtn()
|
|||||||
for i = 1, 2 do
|
for i = 1, 2 do
|
||||||
if self.page == i then
|
if self.page == i then
|
||||||
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.ACT_COMMON, "act_common_btn_" .. i .."_1")
|
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.ACT_COMMON, "act_common_btn_" .. i .."_1")
|
||||||
-- self.pageBtnTxs[i]:setText(self.btnTxs[i])
|
|
||||||
else
|
else
|
||||||
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.ACT_COMMON, "act_common_btn_" .. i .."_2")
|
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.ACT_COMMON, "act_common_btn_" .. i .."_2")
|
||||||
-- self.pageBtnTxs[i]:setText("<color=#72778C>" .. self.btnTxs[i] .. "</color>")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- for i, v in ipairs(self.pageBtns) do
|
|
||||||
-- if i <= table.nums(summonList) then
|
|
||||||
-- local isRedPoint = false
|
|
||||||
-- if i == 1 then
|
|
||||||
-- if DataManager.SummonData:hasSummonFree(1) or GFunc.checkCost(GConst.ItemConst.ITEM_ID_QLT_5_FRAGMENT, 1, false) then
|
|
||||||
-- isRedPoint = true
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- local itemCost = DataManager.SummonData:getSummonItemCost(summonList[i])
|
|
||||||
-- if itemCost then
|
|
||||||
-- local costId = GFunc.getRewardId(itemCost)
|
|
||||||
-- local costNum = GFunc.getRewardNum(itemCost)
|
|
||||||
-- if GFunc.checkCost(costId, costNum, false) then
|
|
||||||
-- isRedPoint = true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- if isRedPoint then
|
|
||||||
-- v.btn:addRedPoint(33, 33, 1)
|
|
||||||
-- else
|
|
||||||
-- v.btn:removeRedPoint()
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- v.btn:setActive(false)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--刷新抽奖按钮
|
--刷新抽奖按钮
|
||||||
@ -273,13 +222,10 @@ function SummonMainUI:refreshSummonBtn()
|
|||||||
self.btnSummonAd:setActive(adCount > 0)
|
self.btnSummonAd:setActive(adCount > 0)
|
||||||
self.btnSummonFree:setActive(freeCount > 0)
|
self.btnSummonFree:setActive(freeCount > 0)
|
||||||
self.btnSummonOne: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 itemCost = DataManager.SummonData:getSummonItemCost(self.page)
|
||||||
local costId = itemCost.id
|
local costId = itemCost.id
|
||||||
-- 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)
|
|
||||||
if freeCount <= 0 then
|
if freeCount <= 0 then
|
||||||
if hadNum >= 1 then
|
if hadNum >= 1 then
|
||||||
self.txNumOne:setText(1)
|
self.txNumOne:setText(1)
|
||||||
@ -336,7 +282,6 @@ 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.txUnlock:setText(summonCount .. "/" .. unlockCount .. I18N:getGlobalText(I18N.GlobalConst.MAGIC_BOOK_DESC_4))
|
|
||||||
local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
|
local wishCount = DataManager.SummonData:getSummonWishCount(self.page)
|
||||||
local needCount = DataManager.SummonData:getSummonWishGuarantee2(self.page)
|
local needCount = DataManager.SummonData:getSummonWishGuarantee2(self.page)
|
||||||
self.btnWishTx:setText(wishCount .. "/" .. needCount)
|
self.btnWishTx:setText(wishCount .. "/" .. needCount)
|
||||||
@ -349,7 +294,6 @@ function SummonMainUI:refreshWishBtn()
|
|||||||
self.btnWishAddImg:setActive(false)
|
self.btnWishAddImg:setActive(false)
|
||||||
else
|
else
|
||||||
self.btnWishIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
|
self.btnWishIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha")
|
||||||
-- self.btnWish:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_1")
|
|
||||||
self.btnWishAddImg:setActive(true)
|
self.btnWishAddImg:setActive(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -364,12 +308,15 @@ function SummonMainUI:refreshBtnRedPoint()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SummonMainUI:onSummon(count, isAd)
|
function SummonMainUI:onSummon(count, isAd)
|
||||||
|
self.heroNode:removeAllChildren()
|
||||||
if isAd then
|
if isAd then
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
||||||
|
self:disableTouch()
|
||||||
ModuleManager.SummonManager:onForceSummonReq(count, 1, self.page)
|
ModuleManager.SummonManager:onForceSummonReq(count, 1, self.page)
|
||||||
else
|
else
|
||||||
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
|
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
|
||||||
if freeCount > 0 and count == 1 then
|
if freeCount > 0 and count == 1 then
|
||||||
|
self:disableTouch()
|
||||||
ModuleManager.SummonManager:onForceSummonReq(count, 2, self.page)
|
ModuleManager.SummonManager:onForceSummonReq(count, 2, self.page)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -397,6 +344,7 @@ function SummonMainUI:onSummon(count, isAd)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
||||||
|
self:disableTouch()
|
||||||
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
|
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
|
||||||
end
|
end
|
||||||
GFunc.showMessageBox(params)
|
GFunc.showMessageBox(params)
|
||||||
@ -409,41 +357,77 @@ function SummonMainUI:onSummon(count, isAd)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_SUMMON_START)
|
||||||
|
self:disableTouch()
|
||||||
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
|
ModuleManager.SummonManager:onForceSummonReq(count, 0, self.page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonMainUI:onSummonRsp(result, newForce)
|
function SummonMainUI:onSummonRsp(result, newHero)
|
||||||
self:refreshSummonBtn()
|
self:refreshSummonBtn()
|
||||||
self.summonResult = result
|
if not result.rewards or not result.rewards[1] then
|
||||||
if self.isJumpTween or self.selectSpineId ~= 1 then
|
self:enableTouch()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.aniSeq then
|
||||||
|
self.aniSeq:Kill()
|
||||||
|
self.aniSeq = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, 4 do
|
||||||
|
self.vfxs[i]:setActive(false)
|
||||||
|
self.vfx01s[i]:setActive(false)
|
||||||
|
end
|
||||||
|
local id = result.rewards[1].item.id
|
||||||
|
local qlt = DataManager.HeroData:getHeroQlt(id) - 2
|
||||||
|
self.summonResult = result.rewards
|
||||||
|
self.aniSeq = self.root:createBindTweenSequence()
|
||||||
|
if self.vfxs[qlt] then
|
||||||
|
self.vfxs[qlt]:setActive(true)
|
||||||
|
end
|
||||||
|
self.aniSeq:AppendInterval(2)
|
||||||
|
self.aniSeq:AppendCallback(function()
|
||||||
|
self:showHero(1, newHero)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonMainUI:showHero(idx, newHero)
|
||||||
|
if not self.summonResult[idx] then
|
||||||
|
self:enableTouch()
|
||||||
|
for i = 1, 4 do
|
||||||
|
self.vfxs[i]:setActive(false)
|
||||||
|
self.vfx01s[i]:setActive(false)
|
||||||
|
end
|
||||||
ModuleManager.SummonManager:showSummonRewardUI({
|
ModuleManager.SummonManager:showSummonRewardUI({
|
||||||
rewards = self.summonResult.rewards,
|
rewards = self.summonResult,
|
||||||
callback = function(count, isAd)
|
callback = function(count)
|
||||||
self:onSummon(count, isAd)
|
self:onSummon(count)
|
||||||
end,
|
end,
|
||||||
newForce = newForce,
|
newHero = newHero,
|
||||||
page = self.page
|
page = self.page
|
||||||
})
|
})
|
||||||
else
|
return
|
||||||
self:disableTouch()
|
|
||||||
self.selectSpine:playAnimComplete("open01", false, true, function()
|
|
||||||
self.selectSpine:playAnim("idle02", true, false)
|
|
||||||
end, false, 0.4, function()
|
|
||||||
ModuleManager.SummonManager:showSummonRewardUI({
|
|
||||||
rewards = self.summonResult.rewards,
|
|
||||||
callback = function(count)
|
|
||||||
self:onSummon(count)
|
|
||||||
end,
|
|
||||||
tweenEnd = function()
|
|
||||||
self:enableTouch()
|
|
||||||
self.selectSpine:playAnim("idle01", true, false)
|
|
||||||
end,
|
|
||||||
newForce = newForce,
|
|
||||||
page = self.page
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
for i = 1, 4 do
|
||||||
|
self.vfx01s[i]:setActive(false)
|
||||||
|
end
|
||||||
|
local id = self.summonResult[idx].item.id
|
||||||
|
local cfg = DataManager.HeroData:getHeroConfig(id)
|
||||||
|
local qlt = cfg.qlt - 2
|
||||||
|
self.heroNode:removeAllChildren()
|
||||||
|
SpineManager:loadHeroAsync(cfg.model_id, self.heroNode, function(spineObject)
|
||||||
|
spineObject:setActive(false)
|
||||||
|
spineObject:playAnimation("idle", true)
|
||||||
|
spineObject:setLocalScale(0.7, 0.7, 0.7)
|
||||||
|
if self.vfx01s[qlt] then
|
||||||
|
self.vfx01s[qlt]:setActive(true)
|
||||||
|
end
|
||||||
|
self:performWithDelayGlobal(function()
|
||||||
|
spineObject:setActive(true)
|
||||||
|
end, 0.25)
|
||||||
|
self:performWithDelayGlobal(function()
|
||||||
|
self:showHero(idx + 1, newHero)
|
||||||
|
end, 1)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonMainUI:disableTouch()
|
function SummonMainUI:disableTouch()
|
||||||
|
|||||||
@ -13,8 +13,7 @@ function SummonRewardUI:ctor(params)
|
|||||||
self.rewards = params.rewards or {}
|
self.rewards = params.rewards or {}
|
||||||
self.isWish = params.isWish or false
|
self.isWish = params.isWish or false
|
||||||
self.callback = params.callback
|
self.callback = params.callback
|
||||||
self.tweenEnd = params.tweenEnd
|
self.unlockList = params.newHero or {}
|
||||||
self.unlockList = params.newForce
|
|
||||||
self.page = params.page
|
self.page = params.page
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -96,11 +95,6 @@ function SummonRewardUI:setCellEffectOrder(cell)
|
|||||||
effect:setSortingOrder(self:getUIOrder(), 10)
|
effect:setSortingOrder(self:getUIOrder(), 10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SummonRewardUI:onClose()
|
|
||||||
if self.tweenEnd ~= nil then
|
|
||||||
self.tweenEnd()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SummonRewardUI:refreshSummonBtn()
|
function SummonRewardUI:refreshSummonBtn()
|
||||||
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
|
local freeCount = DataManager.SummonData:getSummonFreeCount(self.page)
|
||||||
@ -173,10 +167,10 @@ function SummonRewardUI:onRefresh()
|
|||||||
|
|
||||||
self.rewardOneCell:refresh(self.rewards[1], 0, self)
|
self.rewardOneCell:refresh(self.rewards[1], 0, self)
|
||||||
local qlt = DataManager.HeroData:getHeroQlt(self.rewards[1].item.id)
|
local qlt = DataManager.HeroData:getHeroQlt(self.rewards[1].item.id)
|
||||||
if qlt == 4 or qlt == 5 then
|
-- if qlt == 4 or qlt == 5 then
|
||||||
offsetTime = offsetTime + 0.5
|
-- offsetTime = offsetTime + 0.5
|
||||||
self:doUITweenShake(0.7)
|
-- self:doUITweenShake(0.7)
|
||||||
end
|
-- end
|
||||||
CS.DG.Tweening.DOVirtual.DelayedCall(0.3 + offsetTime, function()
|
CS.DG.Tweening.DOVirtual.DelayedCall(0.3 + offsetTime, function()
|
||||||
self:checkUnlockMap()
|
self:checkUnlockMap()
|
||||||
self.btnGet:setActive(true)
|
self.btnGet:setActive(true)
|
||||||
@ -198,15 +192,15 @@ function SummonRewardUI:onRefresh()
|
|||||||
if self.rewards[i] then
|
if self.rewards[i] then
|
||||||
local delayTime = (i - 1) * 0.06 + offsetTime
|
local delayTime = (i - 1) * 0.06 + offsetTime
|
||||||
local qlt = DataManager.HeroData:getHeroQlt(self.rewards[i].item.id)
|
local qlt = DataManager.HeroData:getHeroQlt(self.rewards[i].item.id)
|
||||||
if qlt == 4 or qlt == 5 then
|
-- if qlt == 4 or qlt == 5 then
|
||||||
offsetTime = offsetTime + 1
|
-- offsetTime = offsetTime + 1
|
||||||
end
|
-- end
|
||||||
self.rewardTenCells[i]:getBaseObject():setActive(false)
|
self.rewardTenCells[i]:getBaseObject():setActive(false)
|
||||||
self:performWithDelayGlobal(function()
|
self:performWithDelayGlobal(function()
|
||||||
self.rewardTenCells[i]:refresh(self.rewards[i], i == 3 or i == 7, self)
|
self.rewardTenCells[i]:refresh(self.rewards[i], i == 3 or i == 7, self)
|
||||||
if qlt == 4 or qlt == 5 then
|
-- if qlt == 4 or qlt == 5 then
|
||||||
self:doUITweenShake(0.3)
|
-- self:doUITweenShake(0.3)
|
||||||
end
|
-- end
|
||||||
end, delayTime)
|
end, delayTime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -237,6 +231,7 @@ function SummonRewardUI:doUITweenShake(delayTime)
|
|||||||
self.shakeSeq:AppendInterval(delayTime)
|
self.shakeSeq:AppendInterval(delayTime)
|
||||||
self.shakeSeq:Append(self.tranBg:getTransform():DOShakeAnchorPos(duration, strength,vibrato, randomness, fadeOut))
|
self.shakeSeq:Append(self.tranBg:getTransform():DOShakeAnchorPos(duration, strength,vibrato, randomness, fadeOut))
|
||||||
end
|
end
|
||||||
|
|
||||||
function SummonRewardUI:checkUnlockMap()
|
function SummonRewardUI:checkUnlockMap()
|
||||||
if self.unlockList == nil then
|
if self.unlockList == nil then
|
||||||
return
|
return
|
||||||
@ -245,7 +240,9 @@ function SummonRewardUI:checkUnlockMap()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if #self.unlockList > 0 then
|
if #self.unlockList > 0 then
|
||||||
ModuleManager.ForceManager:showForceUnlockUI(self.unlockList)
|
local params = {}
|
||||||
|
params.unlockList = self.unlockList
|
||||||
|
ModuleManager.SummonManager:showSummonUnlockUI(params)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
74
lua/app/ui/summon/summon_unlock_ui.lua
Executable file
74
lua/app/ui/summon/summon_unlock_ui.lua
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
local SummonUnlockUI = class("SummonUnlockUI", BaseUI)
|
||||||
|
|
||||||
|
local CELL_HEIGHT = 230
|
||||||
|
local CELL_HEIGHT_1 = 120
|
||||||
|
local NOT_OWN_NODE_HEIGHT = 56
|
||||||
|
local DIFF_HEIGHT = 20
|
||||||
|
local ForceCell = "app/ui/summon/cell/summon_force_cell"
|
||||||
|
|
||||||
|
function SummonUnlockUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:ctor(params)
|
||||||
|
params = params or {}
|
||||||
|
self.unlockList = params.unlockList or {}
|
||||||
|
self.idx = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/summon/summon_unlock_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:onClose()
|
||||||
|
self.heroNode:removeAllChildren()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.root:addClickListener(function()
|
||||||
|
self:checkUnlockMap()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self.heroNode = uiMap["summon_unlock_ui.hero_node"]
|
||||||
|
self.nameTx = uiMap["summon_unlock_ui.name_tx"]
|
||||||
|
self.matchTx = uiMap["summon_unlock_ui.match_tx"]
|
||||||
|
self.matchImg = uiMap["summon_unlock_ui.match_tx.match_img"]
|
||||||
|
self.qltBg = uiMap["summon_unlock_ui.qlt_bg"]
|
||||||
|
self.qltBgTx = uiMap["summon_unlock_ui.qlt_bg.qlt_tx"]
|
||||||
|
|
||||||
|
uiMap["summon_unlock_ui.title_bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACTIVITY_MOON_DESC_3))
|
||||||
|
uiMap["summon_unlock_ui.continue_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:onRefresh()
|
||||||
|
self.heroNode:removeAllChildren()
|
||||||
|
self.heroId = table.remove(self.unlockList, 1)
|
||||||
|
local heroEntity = DataManager.HeroData:getHeroById(self.heroId)
|
||||||
|
local matchType = heroEntity:getMatchType()
|
||||||
|
local qlt = heroEntity:getQlt()
|
||||||
|
self.matchTx:setText(ModuleManager.HeroManager:getMatchTypeName(matchType))
|
||||||
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, ModuleManager.HeroManager:getMatchTypeIcon(matchType))
|
||||||
|
self.qltBg:setSprite(GFunc.getHeroQltImg(qlt))
|
||||||
|
self.qltBgTx:setText(GFunc.getHeroQltStr(qlt))
|
||||||
|
|
||||||
|
self:loadHero()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:loadHero()
|
||||||
|
local cfg = DataManager.HeroData:getHeroConfig(self.heroId)
|
||||||
|
SpineManager:loadHeroAsync(cfg.model_id, self.heroNode, function(spineObject)
|
||||||
|
spineObject:playAnimation("idle", true)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SummonUnlockUI:checkUnlockMap()
|
||||||
|
if #self.unlockList <= 0 then
|
||||||
|
self:closeUI()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.idx = self.idx + 1
|
||||||
|
self:onRefresh()
|
||||||
|
end
|
||||||
|
|
||||||
|
return SummonUnlockUI
|
||||||
10
lua/app/ui/summon/summon_unlock_ui.lua.meta
Normal file
10
lua/app/ui/summon/summon_unlock_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3de32bc1e0064d78ba113bdfbf65cc3
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -145,6 +145,11 @@ function HeroData:setHeroLv(id, lv)
|
|||||||
BIReport:postFirstDayHeroLevel(id)
|
BIReport:postFirstDayHeroLevel(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroData:getHeroIsNew(id)
|
||||||
|
local entity = self:getHeroById(id)
|
||||||
|
return entity and entity:getIsNew() or false
|
||||||
|
end
|
||||||
|
|
||||||
function HeroData:getMatchActiveHeroMap()
|
function HeroData:getMatchActiveHeroMap()
|
||||||
return self.matchActiveHeroMap
|
return self.matchActiveHeroMap
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,6 +9,7 @@ function HeroEntity:ctor(cfgId, lv, skin, star)
|
|||||||
self.data.star = star or 0
|
self.data.star = star or 0
|
||||||
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
self.config = ConfigManager:getConfig("hero")[self.cfgId]
|
||||||
self.beginLv = 1 -- 激活等级
|
self.beginLv = 1 -- 激活等级
|
||||||
|
self.isNew = false
|
||||||
|
|
||||||
self.baseAttrOriginal = {}
|
self.baseAttrOriginal = {}
|
||||||
self.starAttr = {}
|
self.starAttr = {}
|
||||||
@ -282,6 +283,7 @@ function HeroEntity:setLv(lv, onlyChangeLv)
|
|||||||
if self.data.lv == lv then
|
if self.data.lv == lv then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
self.isNew = lv == 1
|
||||||
self.oldLv = self.data.lv
|
self.oldLv = self.data.lv
|
||||||
self.data.lv = lv
|
self.data.lv = lv
|
||||||
self:_updateAllBaseAttr()
|
self:_updateAllBaseAttr()
|
||||||
@ -294,6 +296,12 @@ function HeroEntity:setLv(lv, onlyChangeLv)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function HeroEntity:getIsNew()
|
||||||
|
local isNew = self.isNew
|
||||||
|
self.isNew = false
|
||||||
|
return isNew
|
||||||
|
end
|
||||||
|
|
||||||
function HeroEntity:getLv()
|
function HeroEntity:getLv()
|
||||||
return self.data.lv
|
return self.data.lv
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user