fix bug
This commit is contained in:
parent
a5f597c2cc
commit
e6afcd0ccd
@ -222,12 +222,17 @@ BIReport.ITEM_GET_TYPE = {
|
||||
PRIVILEGE_CARD = "privilege_card",
|
||||
-- 七日乐
|
||||
SEVEN_DAY_GIFT = "seven_day_gift",
|
||||
|
||||
BATTLE_REVIVE = "battle_revive",
|
||||
CHAPTER_DOUBLE_REWARD = "chapter_double_reward",
|
||||
}
|
||||
|
||||
BIReport.ADS_CLICK_TYPE = {
|
||||
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
||||
BATTLE_SKILL_ALL = "BattleSkillAll",
|
||||
BATTLE_SKILL_DEITY = "BattleSkillDeity",
|
||||
BATTLE_DOUBLE_BOX = "BattleDoubleBox",
|
||||
BATTLE_REVIVE = "BattleRevive",
|
||||
AD_ENERGY = "AdEnergy",
|
||||
TASK_DAILY_REFRESH = "TaskDailyRefresh",
|
||||
TASK_DAILY_TASK = "TaskDailyTask",
|
||||
|
||||
@ -84,6 +84,9 @@ EventManager.CUSTOM_EVENT = {
|
||||
|
||||
-- 活动
|
||||
CHANGE_ACTIVITY_PAGE = "CHANGE_ACTIVITY_PAGE",
|
||||
BATTLE_REVIVE = "BATTLE_REVIVE",
|
||||
BATTLE_REVIVE_FAILED = "BATTLE_REVIVE_FAILED",
|
||||
|
||||
|
||||
CROSS_DAY = "CROSS_DAY",-- 跨天
|
||||
}
|
||||
|
||||
@ -911,6 +911,22 @@ local LocalizationGlobalConst =
|
||||
SEVEN_DAY_DESC_3 = "SEVEN_DAY_DESC_3",
|
||||
SEVEN_DAY_DESC_4 = "SEVEN_DAY_DESC_4",
|
||||
BATTLE_DESC_19 = "BATTLE_DESC_19",
|
||||
BATTLE_DESC_20 = "BATTLE_DESC_20",
|
||||
ADS_DESC_1 = "ADS_DESC_1",
|
||||
ADS_DESC_2 = "ADS_DESC_2",
|
||||
ADS_DESC_3 = "ADS_DESC_3",
|
||||
ADS_DESC_4 = "ADS_DESC_4",
|
||||
ADS_DESC_5 = "ADS_DESC_5",
|
||||
ADS_DESC_6 = "ADS_DESC_6",
|
||||
ADS_DESC_7 = "ADS_DESC_7",
|
||||
ADS_DESC_9 = "ADS_DESC_9",
|
||||
ADS_DESC_10 = "ADS_DESC_10",
|
||||
ADS_DESC_11 = "ADS_DESC_11",
|
||||
ADS_DESC_12 = "ADS_DESC_12",
|
||||
ADS_DESC_13 = "ADS_DESC_13",
|
||||
ADS_DESC_14 = "ADS_DESC_14",
|
||||
ADS_DESC_15 = "ADS_DESC_15",
|
||||
ADS_DESC_16 = "ADS_DESC_16",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
@ -911,6 +911,22 @@ local localization_global =
|
||||
["SEVEN_DAY_DESC_3"] = "每日解锁",
|
||||
["SEVEN_DAY_DESC_4"] = "超值礼包!",
|
||||
["BATTLE_DESC_19"] = "全都要",
|
||||
["BATTLE_DESC_20"] = "双倍",
|
||||
["ADS_DESC_1"] = "换一批",
|
||||
["ADS_DESC_2"] = "全都要",
|
||||
["ADS_DESC_3"] = "是否观看广告,获得{0}水晶?",
|
||||
["ADS_DESC_4"] = "必出2级齿轮",
|
||||
["ADS_DESC_5"] = "额外2级齿轮",
|
||||
["ADS_DESC_6"] = "是否观看广告,获得额外2级齿轮",
|
||||
["ADS_DESC_7"] = "时光回溯",
|
||||
["ADS_DESC_9"] = "可回到本波开始前并获得{0}水晶",
|
||||
["ADS_DESC_10"] = "放弃复活",
|
||||
["ADS_DESC_11"] = "刷新齿轮",
|
||||
["ADS_DESC_12"] = "是否观看广告,免费刷新齿轮?",
|
||||
["ADS_DESC_13"] = "是否观看广告?",
|
||||
["ADS_DESC_14"] = "双倍奖励",
|
||||
["ADS_DESC_15"] = "免广告卡",
|
||||
["ADS_DESC_16"] = "免广告永久有效",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -8,6 +8,14 @@ local summon = {
|
||||
["num"]=1,
|
||||
["num_for_nothing"]="Vw=="
|
||||
},
|
||||
["cost"]={
|
||||
["type"]=1,
|
||||
["type_for_nothing"]="Vw==",
|
||||
["id"]=2,
|
||||
["id_for_nothing"]="VA==",
|
||||
["num"]=200,
|
||||
["num_for_nothing"]="VAhc"
|
||||
},
|
||||
["ad_num"]=1,
|
||||
["free_num"]=1,
|
||||
["ad_time"]=1,
|
||||
|
||||
@ -96,7 +96,11 @@ function BattleManager:showBoxOpenUI(rewards, callback)
|
||||
UIManager:showUI("app/ui/battle/battle_box_open_ui", {rewards = rewards, callback = callback})
|
||||
end
|
||||
|
||||
function BattleManager:reqSkillRefresh(isAll, deitySkillIdx)
|
||||
function BattleManager:showBattleReviveUI(callback)
|
||||
UIManager:showUI("app/ui/battle/battle_revive_ui", {callback = callback})
|
||||
end
|
||||
|
||||
function BattleManager:reqSkillRefresh(isAll, deitySkillIdx, isDoubleBox)
|
||||
-- if not isAd then
|
||||
-- local cost = GFunc.getConstReward("refresh_skill_cost")
|
||||
-- if not GFunc.checkCost(GFunc.getRewardId(cost), GFunc.getRewardNum(cost), true) then
|
||||
@ -104,7 +108,7 @@ function BattleManager:reqSkillRefresh(isAll, deitySkillIdx)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.WatchADReq, {isAll = isAll, deitySkillIdx = deitySkillIdx}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true)
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.WatchADReq, {isAll = isAll, deitySkillIdx = deitySkillIdx, isDoubleBox = isDoubleBox}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true)
|
||||
end
|
||||
|
||||
function BattleManager:rspSkillRefresh(result)
|
||||
@ -112,14 +116,50 @@ function BattleManager:rspSkillRefresh(result)
|
||||
if self.battleController and result.reqData then
|
||||
if result.reqData.isAll then
|
||||
self.battleController.battleData:addGetAllSkillCount()
|
||||
elseif result.reqData.isDoubleBox then
|
||||
self.battleController.battleData:addGetDoubleBoxCount()
|
||||
else
|
||||
self.battleController.battleData:addRefreshSkillCount(true)
|
||||
end
|
||||
end
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC, {isAll = result.reqData.isAll, deitySkillIdx = result.reqData.deitySkillIdx})
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC, {isAll = result.reqData.isAll, deitySkillIdx = result.reqData.deitySkillIdx, isDoubleBox = result.reqData.isDoubleBox})
|
||||
end
|
||||
end
|
||||
|
||||
-- 复活通信
|
||||
function BattleManager:reqFightRevive(isAd)
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterReviveReq, {ad = isAd}, self.rspFightRevive, BIReport.ITEM_GET_TYPE.BATTLE_REVIVE)
|
||||
end
|
||||
|
||||
function BattleManager:rspFightRevive(result)
|
||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BATTLE_REVIVE_FAILED)
|
||||
return
|
||||
end
|
||||
|
||||
-- 更新次数
|
||||
if result.reqData.ad then
|
||||
DataManager.ChapterData:addReviveCount()
|
||||
end
|
||||
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BATTLE_REVIVE)
|
||||
end
|
||||
|
||||
-- 双倍奖励
|
||||
function BattleManager:reqChapterDoubleReward()
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDoubleRewardReq, {}, self.rspChapterDoubleReward, BIReport.ITEM_GET_TYPE.CHAPTER_DOUBLE_REWARD)
|
||||
end
|
||||
|
||||
function BattleManager:rspChapterDoubleReward(result)
|
||||
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||
return
|
||||
end
|
||||
if result.rewards then
|
||||
GFunc.showRewardBox(result.rewards)
|
||||
end
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BATTLE_DOUBLE_REWARD)
|
||||
end
|
||||
|
||||
function BattleManager:isInBattle()
|
||||
return self.battleController ~= nil
|
||||
end
|
||||
|
||||
@ -497,8 +497,8 @@ function BattleUnitComp:removeShield(buffEffect)
|
||||
self.team:removeShield(buffEffect)
|
||||
end
|
||||
|
||||
function BattleUnitComp:changeState(state)
|
||||
if self.currState == UNIT_STATE.DEAD then -- 死亡后只能去死亡状态
|
||||
function BattleUnitComp:changeState(state, force)
|
||||
if self.currState == UNIT_STATE.DEAD and not force then -- 死亡后只能去死亡状态
|
||||
if state ~= UNIT_STATE.DEAD then
|
||||
return false
|
||||
end
|
||||
@ -649,7 +649,7 @@ end
|
||||
function BattleUnitComp:updateDead(dt)
|
||||
self.deadTime = self.deadTime - dt
|
||||
if self.deadTime <= 0 then
|
||||
self:clear()
|
||||
-- self:clear()
|
||||
if self.deadOverCallback then
|
||||
local callback = self.deadOverCallback
|
||||
self.deadOverCallback = nil
|
||||
@ -1656,6 +1656,15 @@ function BattleUnitComp:removeEffect(buff, target)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUnitComp:onRevive()
|
||||
local maxHp = self.unitEntity:getMaxHp()
|
||||
self.unitEntity:onRevive(maxHp)
|
||||
self:changeState(BattleConst.UNIT_STATE.IDLE, true)
|
||||
self.battleController:refreshHp(self.side, maxHp, 1)
|
||||
local x, y = self.team:getMainUnitLocalPosition(self)
|
||||
self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. maxHp, x, y, 0)
|
||||
end
|
||||
|
||||
function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, damageOrCureType)
|
||||
if self:getIsClear() then
|
||||
return 0
|
||||
@ -2257,6 +2266,10 @@ function BattleUnitComp:getIsClear()
|
||||
return self.isClear
|
||||
end
|
||||
|
||||
function BattleUnitComp:onRealDead()
|
||||
self:clear()
|
||||
end
|
||||
|
||||
function BattleUnitComp:clear()
|
||||
if self.unitEntity:getCanRebirth() then
|
||||
return
|
||||
|
||||
@ -508,7 +508,6 @@ end
|
||||
|
||||
function BattleBaseController:ctor()
|
||||
self.battleData = DataManager.BattleData
|
||||
self.talentSelectCount = DataManager.TalentData:getSelectSkillBegin()
|
||||
end
|
||||
|
||||
function BattleBaseController:init(params, snapshot)
|
||||
@ -522,6 +521,7 @@ function BattleBaseController:init(params, snapshot)
|
||||
self.eliminateTotalCount = 0
|
||||
self.maxLinkCount = 0
|
||||
self.realTime = 0
|
||||
self.doubleMystery = 0
|
||||
self.taskProgress = {}
|
||||
self.waveRoundCount = {}
|
||||
self.lastRoundBreakedGridType = {}
|
||||
@ -552,6 +552,7 @@ function BattleBaseController:init(params, snapshot)
|
||||
else
|
||||
self.battleData:init(params)
|
||||
end
|
||||
self.talentSelectCount = self.battleData:getTalentSelect()
|
||||
BattleScheduler:init()
|
||||
BattlePool:init()
|
||||
BattleHelper:init()
|
||||
@ -1152,6 +1153,7 @@ function BattleBaseController:enterElimination(needDelay)
|
||||
|
||||
if self.talentSelectCount > 0 then
|
||||
self.talentSelectCount = self.talentSelectCount - 1
|
||||
self.battleData:setTalentSelect(self.talentSelectCount)
|
||||
self:tryShowSelectSkillComp(needDelay)
|
||||
return
|
||||
end
|
||||
@ -3247,7 +3249,39 @@ function BattleBaseController:_tick(dt, originDt)
|
||||
BattleBoardTouchHelper:tick(dt)
|
||||
end
|
||||
|
||||
function BattleBaseController:battleEnd()
|
||||
function BattleBaseController:adRevive(revive)
|
||||
if not revive then -- 不复活
|
||||
self.battleData:getAtkTeam():onRealDead()
|
||||
self.atkTeam:onRealDead()
|
||||
self:onBattleEnd(not revive)
|
||||
else
|
||||
self.atkTeam:revive()
|
||||
-- local unitEntity = self.defTeam:getMainUnit().unitEntity
|
||||
-- self:refreshBossSkill(unitEntity)
|
||||
-- self:enterNextTeamAction()
|
||||
self:enterRoundEnd()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:checkRevive()
|
||||
if self.battleData:getIsRevive() then
|
||||
return false
|
||||
end
|
||||
self.battleData:setIsRevive(true)
|
||||
ModuleManager.BattleManager:showBattleReviveUI(function(revive)
|
||||
self:adRevive(revive)
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
function BattleBaseController:battleEnd(isQuit)
|
||||
if not isQuit and not self.victory and self:checkRevive() then
|
||||
else
|
||||
self:onBattleEnd()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:onBattleEnd(noRevive)
|
||||
if self.battleEndSid then
|
||||
ModuleManager.BattleManager:unscheduleGlobal(self.battleEndSid)
|
||||
self.battleEndSid = nil
|
||||
@ -3256,6 +3290,12 @@ function BattleBaseController:battleEnd()
|
||||
if self.victory then
|
||||
self.atkTeam:playWinAction()
|
||||
end
|
||||
local time = 1
|
||||
if noRevive then
|
||||
time = 0
|
||||
elseif self.victory then
|
||||
time = 2
|
||||
end
|
||||
self.battleEndSid = ModuleManager.BattleManager:performWithDelayGlobal(function()
|
||||
if self.battleUI then
|
||||
self.battleUI:enableUITouch()
|
||||
@ -3288,7 +3328,7 @@ function BattleBaseController:battleEnd()
|
||||
if self.victory then
|
||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_BATTLE_VICTORY)
|
||||
end
|
||||
end, 2)
|
||||
end, time)
|
||||
end
|
||||
|
||||
function BattleBaseController:clear()
|
||||
|
||||
@ -83,7 +83,7 @@ function BattleControllerStage:controllBattleEnd()
|
||||
self.combatReport.wave = self.combatReport.wave - 1
|
||||
end
|
||||
BIReport:postFightHeroReport(self.combatReport.battleType, atkReport)
|
||||
ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport, self.gotMysteryBoxIndexs, self.taskProgress)
|
||||
ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport, self.gotMysteryBoxIndexs, self.taskProgress, self.doubleMystery)
|
||||
end
|
||||
|
||||
function BattleControllerStage:postWaveOver(atkDead, isQuit)
|
||||
|
||||
@ -204,6 +204,14 @@ function BattleTeam:onRoundEnd()
|
||||
self:getMainUnit():changeState(BattleConst.UNIT_STATE.IDLE)
|
||||
end
|
||||
|
||||
function BattleTeam:revive()
|
||||
self.mainUnit:onRevive()
|
||||
end
|
||||
|
||||
function BattleTeam:onRealDead()
|
||||
self.mainUnit:onRealDead()
|
||||
end
|
||||
|
||||
function BattleTeam:doTalentHpRestore()
|
||||
local hp = DataManager.TalentData:getHpRestore()
|
||||
if hp > 0 then
|
||||
|
||||
@ -71,7 +71,7 @@ function ChapterManager:startFightFinish(result)
|
||||
end
|
||||
end
|
||||
|
||||
function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs, taskProgress)
|
||||
function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs, taskProgress, doubleMystery)
|
||||
local cfg = ConfigManager:getConfig("chapter")[id]
|
||||
local mystery_box_idx = {}
|
||||
if gotMysteryBoxIndexs and cfg.mystery_box then
|
||||
@ -94,6 +94,7 @@ function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs, taskProg
|
||||
mystery_box_idx = mystery_box_idx,
|
||||
task_stat = taskProgress,
|
||||
combatReport = combatReport,
|
||||
double_mystery = doubleMystery,
|
||||
}
|
||||
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterSettlementReq, parmas, self.endFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_END)
|
||||
|
||||
@ -16,9 +16,17 @@ end
|
||||
function BattleBoxOpenUI:onLoadRootComplete()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
if not self.rewardCell then
|
||||
self.rewardCell = CellManager:addCellComp(uiMap["battle_box_open_ui.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCell = CellManager:addCellComp(uiMap["battle_box_open_ui.title_bg.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
end
|
||||
|
||||
self.adBtn = uiMap["battle_box_open_ui.ad_btn"]
|
||||
self.adBtnImg = uiMap["battle_box_open_ui.ad_btn.ad"]
|
||||
self.adBtnTx = uiMap["battle_box_open_ui.ad_btn.tx"]
|
||||
self.okBtn = uiMap["battle_box_open_ui.ok_btn"]
|
||||
self.okBtnTx = uiMap["battle_box_open_ui.ok_btn.tx"]
|
||||
self.adBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_20))
|
||||
self.okBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK))
|
||||
|
||||
local reward = self.rewards
|
||||
if reward then
|
||||
self.rewardCell:refreshByConfig(reward)
|
||||
@ -34,6 +42,12 @@ function BattleBoxOpenUI:onLoadRootComplete()
|
||||
self.callback()
|
||||
end
|
||||
end)
|
||||
self.okBtn:addClickListener(function()
|
||||
self:closeUI()
|
||||
if self.callback then
|
||||
self.callback()
|
||||
end
|
||||
end)
|
||||
|
||||
if self.seqAni then
|
||||
self.seqAni:Kill()
|
||||
@ -50,6 +64,46 @@ function BattleBoxOpenUI:onLoadRootComplete()
|
||||
self.seqAni:AppendCallback(function()
|
||||
self.aniOver = true
|
||||
end)
|
||||
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC, function(parmas)
|
||||
if parmas and parmas.isDoubleBox then
|
||||
self:getDouble()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleBoxOpenUI:onRefresh()
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
if battleController and battleController.battleData then
|
||||
local count = battleController.battleData:getDoubleBoxCount()
|
||||
local cfgAdCount = GFunc.getConstIntValue("ads_mystery_box_limit")
|
||||
if cfgAdCount > count then
|
||||
self.adBtn:setActive(true)
|
||||
self.okBtn:setActive(false)
|
||||
GFunc.setAdsSprite(self.adBtnImg)
|
||||
self.adBtn:addClickListener(function()
|
||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_DOUBLE_BOX, function()
|
||||
ModuleManager.BattleManager:reqSkillRefresh(nil, nil, true)
|
||||
end)
|
||||
end)
|
||||
else
|
||||
self.okBtn:setActive(true)
|
||||
self.adBtn:setActive(false)
|
||||
end
|
||||
else
|
||||
self.okBtn:setActive(true)
|
||||
self.adBtn:setActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBoxOpenUI:getDouble()
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
if battleController then
|
||||
battleController.doubleMystery = true
|
||||
end
|
||||
self.rewardCell:setNumTx(self.rewards.num * 2)
|
||||
self.okBtn:setActive(true)
|
||||
self.adBtn:setActive(false)
|
||||
end
|
||||
|
||||
return BattleBoxOpenUI
|
||||
@ -61,7 +61,7 @@ function BattlePauseUI:_addListeners()
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
|
||||
okFunc = function()
|
||||
self.battleController:battleEnd()
|
||||
self.battleController:battleEnd(true)
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
|
||||
143
lua/app/ui/battle/battle_revive_ui.lua
Normal file
143
lua/app/ui/battle/battle_revive_ui.lua
Normal file
@ -0,0 +1,143 @@
|
||||
local BattleReviveUI = class("BattleReviveUI", BaseUI)
|
||||
|
||||
function BattleReviveUI:isFullScreen()
|
||||
return false
|
||||
end
|
||||
|
||||
function BattleReviveUI:ctor(params)
|
||||
params = params or {}
|
||||
self.callback = params.callback
|
||||
end
|
||||
|
||||
function BattleReviveUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/battle/battle_revive_ui.prefab"
|
||||
end
|
||||
|
||||
function BattleReviveUI:onLoadRootComplete()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
end
|
||||
|
||||
function BattleReviveUI:_display()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.title1Tx = uiMap["battle_revive_ui.bg.tx_1"]
|
||||
-- self.title2Tx = uiMap["battle_revive_ui.bg.tx_2"]
|
||||
self.descTx = uiMap["battle_revive_ui.bg.tx_desc"]
|
||||
|
||||
self.costBtn = uiMap["battle_revive_ui.bg.cost_btn"]
|
||||
self.costTx = uiMap["battle_revive_ui.bg.cost_btn.tx"]
|
||||
self.adBtn = uiMap["battle_revive_ui.bg.ad_btn"]
|
||||
self.adIcon = uiMap["battle_revive_ui.bg.ad_btn.icon"]
|
||||
self.adTx = uiMap["battle_revive_ui.bg.ad_btn.tx"]
|
||||
self.cancelBtn = uiMap["battle_revive_ui.bg.cancel_btn"]
|
||||
self.cancelTx = uiMap["battle_revive_ui.bg.cancel_btn.tx"]
|
||||
|
||||
self.title1Tx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_7))
|
||||
-- self.title2Tx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_8))
|
||||
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_9, GFunc.getConstIntValue("ads_revive_limit")))
|
||||
self.adTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
|
||||
self.cancelTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_10))
|
||||
|
||||
GFunc.setAdsSprite(self.adIcon)
|
||||
local cost = GFunc.getConstReward("cost_revive")
|
||||
local costNum = cost.num
|
||||
local costEnough = GFunc.checkCost(cost.id, costNum, false)
|
||||
self.costTx:setText(costEnough and costNum or ("<color=#FF0000>".. costNum.. "</color>"))
|
||||
|
||||
-- self.spineObj = uiMap["battle_revive_ui.ui_spine_obj"]
|
||||
-- self.spineObj:playAnimComplete("born", false, true, function()
|
||||
-- self.spineObj:playAnim("idle", true, true)
|
||||
-- end)
|
||||
|
||||
-- self.fx = uiMap["battle_revive_ui.vfx_b13_ui_revive_b01"]
|
||||
-- self.fx:setActive(false)
|
||||
|
||||
-- 根据复活次数更新按钮位置
|
||||
local canAdRevive = DataManager.ChapterData:canAdRevive()
|
||||
if not canAdRevive then
|
||||
self.costBtn:setActive(true)
|
||||
self.adBtn:setActive(false)
|
||||
self.costBtn:setAnchoredPositionX(0)
|
||||
else
|
||||
self.costBtn:setActive(true)
|
||||
self.adBtn:setActive(true)
|
||||
self.costBtn:setAnchoredPositionX(-144)
|
||||
end
|
||||
|
||||
-- 免广告卡模块
|
||||
local noAdNode = uiMap["battle_revive_ui.no_ad_node"]
|
||||
local noAdTitleTx = uiMap["battle_revive_ui.no_ad_node.tx_ad"]
|
||||
local noAdDescTx = uiMap["battle_revive_ui.no_ad_node.tx_desc"]
|
||||
local noAdBuyBtn = uiMap["battle_revive_ui.no_ad_node.btn_buy"]
|
||||
local noAdBuyTx = uiMap["battle_revive_ui.no_ad_node.btn_buy.tx_desc"]
|
||||
|
||||
-- if DataManager.PlayerData:getNoAdFuncOpen() and not DataManager.PlayerData:getNoAdActive() then
|
||||
-- noAdNode:setActive(true)
|
||||
-- noAdTitleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_15))
|
||||
-- noAdDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.ADS_DESC_16))
|
||||
-- noAdBuyBtn:addClickListener(function()
|
||||
-- ModuleManager.PrivilegeCardManager:buyAdCard()
|
||||
-- end)
|
||||
-- noAdBuyTx:setText(DataManager.PlayerData:getNoAdPrice())
|
||||
-- else
|
||||
-- noAdNode:setActive(false)
|
||||
-- end
|
||||
end
|
||||
|
||||
function BattleReviveUI:_addListeners()
|
||||
self.costBtn:addClickListener(function()
|
||||
local cost = GFunc.getConstReward("cost_revive")
|
||||
if GFunc.checkCost(GConst.ItemConst.ITEM_ID_GEM, cost.num, true) then
|
||||
self:doRevive(false)
|
||||
end
|
||||
end)
|
||||
self.adBtn:addClickListener(function()
|
||||
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.BATTLE_REVIVE, function()
|
||||
self:doRevive(true)
|
||||
end)
|
||||
end)
|
||||
self.cancelBtn:addClickListener(function()
|
||||
self:cancelRevive()
|
||||
end)
|
||||
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.BATTLE_REVIVE, function()
|
||||
self:onRevive()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.BATTLE_REVIVE_FAILED, function()
|
||||
self:onReviveFailed()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.NO_AD_ACTIVE, function()
|
||||
self:_display()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleReviveUI:doRevive(isAd)
|
||||
ModuleManager.BattleManager:reqFightRevive(isAd)
|
||||
end
|
||||
|
||||
function BattleReviveUI:onRevive()
|
||||
-- self.fx:setActive(true)
|
||||
-- self.fx:play()
|
||||
-- self.spineObj:playAnimComplete("open", false, true, function()
|
||||
-- self:closeUI()
|
||||
self:closeUI()
|
||||
if self.callback then
|
||||
self.callback(true)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleReviveUI:onReviveFailed()
|
||||
self:closeUI()
|
||||
if self.callback then
|
||||
self.callback(false)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleReviveUI:cancelRevive()
|
||||
self:closeUI()
|
||||
if self.callback then
|
||||
self.callback(false)
|
||||
end
|
||||
end
|
||||
|
||||
return BattleReviveUI
|
||||
10
lua/app/ui/battle/battle_revive_ui.lua.meta
Normal file
10
lua/app/ui/battle/battle_revive_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1889050e86804b79b6c03dc80356646
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -21,6 +21,18 @@ function ActSprintSummonData:clearActInfo(actId)
|
||||
end
|
||||
end
|
||||
|
||||
function ActSprintSummonData:getActConfig(id)
|
||||
if id then
|
||||
return ConfigManager:getConfig("activity")[id]
|
||||
else
|
||||
return ConfigManager:getConfig("activity")
|
||||
end
|
||||
end
|
||||
|
||||
function ActSprintSummonData:getActType(id)
|
||||
return self:getActConfig(id).act_type
|
||||
end
|
||||
|
||||
function ActSprintSummonData:setActivityInfo(data)
|
||||
if self.actId ~= data.actId then
|
||||
self:clear()
|
||||
|
||||
@ -53,6 +53,9 @@ function BattleBaseData:init(params, snapInfo)
|
||||
self.refreshSkillCount = snapInfo and snapInfo.refreshSkillCount or 0
|
||||
self.adGetAllSkillCount = snapInfo and snapInfo.adGetAllSkillCount or 0
|
||||
self.adDeityCount = snapInfo and snapInfo.adDeityCount or 0
|
||||
self.adGetDoubleBoxCount = snapInfo and snapInfo.adGetDoubleBoxCount or 0
|
||||
self.isRevive = snapInfo and snapInfo.isRevive or false
|
||||
self.talentSelectCount = snapInfo and snapInfo.talentSelectCount or DataManager.TalentData:getSelectSkillBegin()
|
||||
BattleSkillEntity.sid = 0
|
||||
self.atkTeam = self:initTeam(SIDE_ATK, params.atkFormation)
|
||||
self.defTeam = self:initTeam(SIDE_DEF, params.defFormation)
|
||||
@ -79,7 +82,10 @@ function BattleBaseData:getSnapshoptInfo()
|
||||
adRefreshSkillCount = self.adRefreshSkillCount,
|
||||
adGetAllSkillCount = self.adGetAllSkillCount,
|
||||
adDeityCount = self.adDeityCount,
|
||||
adGetDoubleBoxCount = self.adGetDoubleBoxCount,
|
||||
refreshSkillCount = self.refreshSkillCount,
|
||||
isRevive = self.isRevive,
|
||||
talentSelectCount = self.talentSelectCount,
|
||||
cacheSkillList = self.cacheSkillList,
|
||||
}
|
||||
end
|
||||
@ -791,6 +797,30 @@ function BattleBaseData:getAdDeityCount()
|
||||
return self.adDeityCount
|
||||
end
|
||||
|
||||
function BattleBaseData:addGetDoubleBoxCount()
|
||||
self.adGetDoubleBoxCount = self.adGetDoubleBoxCount + 1
|
||||
end
|
||||
|
||||
function BattleBaseData:getDoubleBoxCount()
|
||||
return self.adGetDoubleBoxCount
|
||||
end
|
||||
|
||||
function BattleBaseData:setIsRevive(revive)
|
||||
self.isRevive = revive
|
||||
end
|
||||
|
||||
function BattleBaseData:getIsRevive()
|
||||
return self.isRevive
|
||||
end
|
||||
|
||||
function BattleBaseData:setTalentSelect(talentSelectCount)
|
||||
self.talentSelectCount = talentSelectCount
|
||||
end
|
||||
|
||||
function BattleBaseData:getTalentSelect()
|
||||
return self.talentSelectCount
|
||||
end
|
||||
|
||||
function BattleBaseData:initTeam(side, formation)
|
||||
local data = nil
|
||||
data = self:initHeroData(formation)
|
||||
|
||||
@ -368,6 +368,15 @@ function BattleTeamEntity:getCanRebirth()
|
||||
return self:getAttrValue(ATTR_NAME.REBIRTH) > 0
|
||||
end
|
||||
|
||||
function BattleTeamEntity:onRealDead()
|
||||
self:clearRecordData()
|
||||
end
|
||||
|
||||
function BattleTeamEntity:onRevive(maxHp)
|
||||
self.isDead = false
|
||||
self:setAttrValue(ATTR_NAME.HP, maxHp)
|
||||
end
|
||||
|
||||
function BattleTeamEntity:takeDamageOrCure(num, unitComp)
|
||||
if self.isDead then
|
||||
return 0
|
||||
@ -464,7 +473,7 @@ function BattleTeamEntity:die()
|
||||
return
|
||||
end
|
||||
self.isDead = true
|
||||
self:clearRecordData()
|
||||
-- self:clearRecordData()
|
||||
end
|
||||
|
||||
function BattleTeamEntity:setIsRebirth()
|
||||
|
||||
@ -316,6 +316,10 @@ function BattleUnitEntity:takeDamageOrCure(num, unitComp)
|
||||
return self.team:takeDamageOrCure(num, unitComp)
|
||||
end
|
||||
|
||||
function BattleUnitEntity:onRevive(maxHp)
|
||||
self.team:onRevive(maxHp)
|
||||
end
|
||||
|
||||
function BattleUnitEntity:getHp()
|
||||
return self.team:getHp()
|
||||
end
|
||||
|
||||
@ -43,6 +43,8 @@ function ChapterData:init(data, notChangeChapterId)
|
||||
else
|
||||
self.data.maxChapterId = data.max_chapter_id - 1
|
||||
end
|
||||
self.revive = data.revive or 0
|
||||
self.todayRevive = data.today_revive or 0
|
||||
|
||||
if not notChangeChapterId then
|
||||
self.data.chapterId = data.max_chapter_id
|
||||
@ -583,5 +585,24 @@ function ChapterData:showRedPoint(chapterId)
|
||||
end
|
||||
return false
|
||||
end
|
||||
--@endregion
|
||||
|
||||
--@region 复活
|
||||
-- self.revive = data.revive or 0
|
||||
-- self.todayRevive = data.today_revive or 0
|
||||
function ChapterData:addReviveCount()
|
||||
self.revive = self.revive + 1
|
||||
self.todayRevive = self.todayRevive + 1
|
||||
end
|
||||
|
||||
function ChapterData:getReviveCount()
|
||||
return self.todayRevive
|
||||
end
|
||||
|
||||
function ChapterData:canAdRevive()
|
||||
local cfgAdCount = GFunc.getConstIntValue("ads_revive_limit")
|
||||
return self.todayRevive < cfgAdCount
|
||||
end
|
||||
|
||||
--@endregion
|
||||
return ChapterData
|
||||
Loading…
x
Reference in New Issue
Block a user