竞技场
This commit is contained in:
parent
4725d4ac06
commit
f47437d866
@ -1,5 +1,9 @@
|
|||||||
local ArenaManager = class("ArenaManager", BaseModule)
|
local ArenaManager = class("ArenaManager", BaseModule)
|
||||||
|
|
||||||
|
function ArenaManager:showArenaUI()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_ui")
|
||||||
|
end
|
||||||
|
|
||||||
function ArenaManager:checkSeasonChange()
|
function ArenaManager:checkSeasonChange()
|
||||||
if not DataManager.ArenaData:isInSeasonTime() then
|
if not DataManager.ArenaData:isInSeasonTime() then
|
||||||
-- 不在赛季时间段,赛季改变
|
-- 不在赛季时间段,赛季改变
|
||||||
@ -205,18 +209,21 @@ function ArenaManager:rspLastSeasonReward(result)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 更新赛季信息
|
-- 更新赛季信息
|
||||||
function ArenaManager:reqArenaInfo()
|
function ArenaManager:reqArenaInfo(showUI)
|
||||||
if not DataManager.ArenaData:isOpen() then
|
if not DataManager.ArenaData:isOpen() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.isResetting = true
|
self.isResetting = true
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPInfoReq, {}, {}, self.rspArenaInfo, nil)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPInfoReq, {showUI = showUI}, {}, self.rspArenaInfo, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ArenaManager:rspArenaInfo(result)
|
function ArenaManager:rspArenaInfo(result)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
self.isResetting = false
|
self.isResetting = false
|
||||||
DataManager.ArenaData:init(result.arena_info)
|
DataManager.ArenaData:init(result.arena_info)
|
||||||
|
if result.reqData.showUI then
|
||||||
|
self:showArenaUI()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ function DailyChallengeManager:init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeManager:showDailyChallengeUI()
|
function DailyChallengeManager:showDailyChallengeUI()
|
||||||
UIManager:showUI("app/ui/battle/daily_challenge_ui")
|
UIManager:showUI("app/ui/daily_challenge/daily_challenge_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeManager:showBattleBuffUI()
|
function DailyChallengeManager:showBattleBuffUI()
|
||||||
|
|||||||
268
lua/app/ui/arena/arena_ui.lua
Normal file
268
lua/app/ui/arena/arena_ui.lua
Normal file
@ -0,0 +1,268 @@
|
|||||||
|
local ArenaUI = class("ArenaUI", BaseUI)
|
||||||
|
|
||||||
|
local GIFT_CELL = "app/ui/main_city/cell/side_bar_arena_gift_cell"
|
||||||
|
function ArenaUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/arena/arena_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:getShowEntranceRedPoint()
|
||||||
|
return DataManager.ArenaData:hasEntranceRedDot()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:ctor()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:onClose()
|
||||||
|
if self.spineGrading then
|
||||||
|
self.spineGrading:destroy()
|
||||||
|
self.spineGrading = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
|
||||||
|
uiMap["arena_ui.close_btn"]:addClickListener(function ()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self.txSeason = uiMap["arena_ui.tx_season"]
|
||||||
|
self.txTitle = uiMap["arena_ui.tx_title"]
|
||||||
|
self.txCountdown = uiMap["arena_ui.countdown.tx_time"]
|
||||||
|
self.txGarding = uiMap["arena_ui.tx_garding"]
|
||||||
|
self.spineRoot = uiMap["arena_ui.spine_root"]
|
||||||
|
self.imgProg = uiMap["arena_ui.prog.img_prog"]
|
||||||
|
self.txProg = uiMap["arena_ui.prog.tx_prog"]
|
||||||
|
self.btnHelp = uiMap["arena_ui.tx_season.btn_help"]
|
||||||
|
self.btnRecord = uiMap["arena_ui.btn_record"]
|
||||||
|
self.txRecord = uiMap["arena_ui.btn_record.tx_record"]
|
||||||
|
self.btnFormation = uiMap["arena_ui.btn_formation"]
|
||||||
|
self.txFormation = uiMap["arena_ui.btn_formation.tx_formation"]
|
||||||
|
self.btnReward = uiMap["arena_ui.btn_reward"]
|
||||||
|
self.txReward = uiMap["arena_ui.btn_reward.tx_reward"]
|
||||||
|
self.btnRank = uiMap["arena_ui.btn_rank"]
|
||||||
|
self.txRank = uiMap["arena_ui.btn_rank.tx_rank"]
|
||||||
|
self.btnGradingReward = uiMap["arena_ui.btn_grading_reward"]
|
||||||
|
self.txGradingReward = uiMap["arena_ui.btn_grading_reward.tx_grading_reward"]
|
||||||
|
|
||||||
|
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_4))
|
||||||
|
self.txRecord:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_7))
|
||||||
|
self.txFormation:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
|
||||||
|
self.txReward:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_41))
|
||||||
|
self.txRank:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_5))
|
||||||
|
self.txGradingReward:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_40))
|
||||||
|
|
||||||
|
self.btnHelp:addClickListener(function()
|
||||||
|
local params = {
|
||||||
|
type = GConst.TipsConst.HELP_TIPS_TYPE.ARENA,
|
||||||
|
title = I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_4),
|
||||||
|
desc = I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_HELP),
|
||||||
|
}
|
||||||
|
ModuleManager.TipsManager:showHelpTips(params)
|
||||||
|
end)
|
||||||
|
self.btnRecord:addClickListener(function()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_recent_battle_ui")
|
||||||
|
end)
|
||||||
|
self.btnFormation:addClickListener(function()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_formation_ui", {type = GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND})
|
||||||
|
end)
|
||||||
|
self.btnReward:addClickListener(function()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_season_reward_ui")
|
||||||
|
end)
|
||||||
|
self.btnRank:addClickListener(function()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_rank_ui")
|
||||||
|
end)
|
||||||
|
self.btnGradingReward:addClickListener(function()
|
||||||
|
UIManager:showUI("app/ui/arena/arena_grading_reward_ui")
|
||||||
|
end)
|
||||||
|
self.bountyNode = uiMap["arena_ui.bounty_node"]
|
||||||
|
self.bountyBanner = uiMap["arena_ui.bounty_node.banner"]
|
||||||
|
self.bountyBanner:addClickListener(function()
|
||||||
|
ModuleManager.ArenaBountyManager:showBountyMainUI()
|
||||||
|
end)
|
||||||
|
self.bountyRewardSpine = uiMap["arena_ui.bounty_node.banner.spine"]
|
||||||
|
self.bountyBannerInfo = uiMap["arena_ui.bounty_node.banner.info"]
|
||||||
|
self.bountyBannerDescTx = uiMap["arena_ui.bounty_node.banner.desc"]
|
||||||
|
self.bountyBannerSlider = uiMap["arena_ui.bounty_node.banner.info.progress_bg.slider"]
|
||||||
|
self.bountyBannerSliderTx = uiMap["arena_ui.bounty_node.banner.info.progress_bg.slider_tx"]
|
||||||
|
self.bountyBannerLvTx = uiMap["arena_ui.bounty_node.banner.info.progress_bg.lv_tx"]
|
||||||
|
uiMap["arena_ui.bounty_node.banner.info.name"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLEPASS_1))
|
||||||
|
|
||||||
|
self.rightArrow = uiMap["arena_ui.right_node.arrow_node"]
|
||||||
|
self.rightArrow:setVisible(false)
|
||||||
|
self.rightNode = uiMap["arena_ui.right_node"]
|
||||||
|
self.rightBtnCells = {}
|
||||||
|
self.rightBtnCells.giftCell = CellManager:addCellComp(uiMap["arena_ui.right_node.side_bar.side_bar_cell"], GIFT_CELL)
|
||||||
|
|
||||||
|
self.fightBtn = uiMap["arena_ui.fight_btn"]
|
||||||
|
-- 体力消耗
|
||||||
|
self.fightCost = uiMap["arena_ui.fight_btn.cost"]
|
||||||
|
self.costTxDesc = uiMap["arena_ui.fight_btn.cost.tx_desc"]
|
||||||
|
self.costTxCost = uiMap["arena_ui.fight_btn.cost.tx_cost"]
|
||||||
|
-- 剩余次数
|
||||||
|
self.countTxNum = uiMap["arena_ui.fight_btn.tx_count"]
|
||||||
|
-- 按钮文本
|
||||||
|
self.txFight = uiMap["arena_ui.fight_btn.tx_desc"]
|
||||||
|
self.txFight:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_2))
|
||||||
|
self.fightBtn:addClickListener(function ()
|
||||||
|
-- 赛季结算
|
||||||
|
if DataManager.ArenaData:isInSeasonSettlementTime() then
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_29))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
UIManager:showUI("app/ui/arena/arena_match_ui")
|
||||||
|
end)
|
||||||
|
|
||||||
|
self:updateTime()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:updateTime()
|
||||||
|
if self.seasonSettlementSid then
|
||||||
|
self:unscheduleGlobal(self.seasonSettlementSid)
|
||||||
|
self.seasonSettlementSid = nil
|
||||||
|
end
|
||||||
|
if self.seasonEndSid then
|
||||||
|
self:unscheduleGlobal(self.seasonEndSid)
|
||||||
|
self.seasonEndSid = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if not DataManager.ArenaData:isInSeasonSettlementTime() then
|
||||||
|
-- 结算计时器
|
||||||
|
if EDITOR_MODE then
|
||||||
|
Logger.logHighlight("赛季锁定倒计时:"..DataManager.ArenaData:getRemainSeasonSettlementTime())
|
||||||
|
end
|
||||||
|
self.seasonSettlementSid = self:performWithDelayGlobal(function()
|
||||||
|
ModuleManager.ArenaManager:onSeasonSettlement()
|
||||||
|
end, DataManager.ArenaData:getRemainSeasonSettlementTime())
|
||||||
|
else
|
||||||
|
-- 结束计时器
|
||||||
|
if EDITOR_MODE then
|
||||||
|
Logger.logHighlight("赛季结束倒计时:"..DataManager.ArenaData:getRemainSeasonTime())
|
||||||
|
end
|
||||||
|
self.seasonEndSid = self:performWithDelayGlobal(function()
|
||||||
|
ModuleManager.ArenaManager:onSeasonChanged()
|
||||||
|
end, DataManager.ArenaData:getRemainSeasonTime())
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 显示倒计时
|
||||||
|
if self.seasonChangeSid then
|
||||||
|
self:unscheduleGlobal(self.seasonChangeSid)
|
||||||
|
end
|
||||||
|
self.txCountdown:setText(Time:formatNumTimeStr(DataManager.ArenaData:getRemainSeasonTime()))
|
||||||
|
self.seasonChangeSid = self:scheduleGlobal(function()
|
||||||
|
self.txCountdown:setText(Time:formatNumTimeStr(DataManager.ArenaData:getRemainSeasonTime()))
|
||||||
|
end, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:onRefresh()
|
||||||
|
self:refreshInfo()
|
||||||
|
self:refreshBounty()
|
||||||
|
self:refreshRightBtns()
|
||||||
|
self:refreshFightBtn()
|
||||||
|
self:refreshRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:refreshBounty()
|
||||||
|
if GFunc.isShenhe() then
|
||||||
|
self.bountyNode:setVisible(false)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.bountyNode:setVisible(true)
|
||||||
|
if DataManager.ArenaBountyData:getIfCanClaimReward() then
|
||||||
|
self.bountyRewardSpine:setVisible(true)
|
||||||
|
self.bountyRewardSpine:playAnim("idle", true)
|
||||||
|
self.bountyRewardSpine:getSkeletonGraphic().enabled = true
|
||||||
|
self.bountyBannerInfo:setVisible(false)
|
||||||
|
self.bountyBannerDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.COLLET_REWARDS))
|
||||||
|
else
|
||||||
|
self.bountyRewardSpine:setVisible(false)
|
||||||
|
self.bountyRewardSpine:getSkeletonGraphic().enabled = false
|
||||||
|
local bannerName = DataManager.ArenaBountyData:getBannerName()
|
||||||
|
self.bountyBanner:setSprite(GConst.ATLAS_PATH.BOUNTY, bannerName)
|
||||||
|
self.bountyBannerInfo:setVisible(true)
|
||||||
|
self.bountyBannerDescTx:setText(GConst.EMPTY_STRING)
|
||||||
|
local exp = DataManager.ArenaBountyData:getExp()
|
||||||
|
local lvUpExp = DataManager.ArenaBountyData:getLvUpExp()
|
||||||
|
local level = DataManager.ArenaBountyData:getLevel()
|
||||||
|
local maxLevel = DataManager.ArenaBountyData:getMaxLevel()
|
||||||
|
self.bountyBannerSliderTx:setText(exp .. "/" .. lvUpExp)
|
||||||
|
self.bountyBannerSlider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = exp / lvUpExp
|
||||||
|
if level >= maxLevel then
|
||||||
|
self.bountyBannerLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
|
||||||
|
else
|
||||||
|
self.bountyBannerLvTx:setText(tostring(level))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:refreshInfo()
|
||||||
|
local gradingId = DataManager.ArenaData:getGradingId()
|
||||||
|
local totalScore = DataManager.ArenaData:getScore()
|
||||||
|
local maxScore = DataManager.ArenaData:getGradingScoreTotal(totalScore)
|
||||||
|
local curScore = DataManager.ArenaData:getGradingScore(totalScore)
|
||||||
|
local gradingIconName = DataManager.ArenaData:getGradingIconName(gradingId)
|
||||||
|
local gradingNumName = DataManager.ArenaData:getGradingNumName(gradingId)
|
||||||
|
self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_3, DataManager.ArenaData:getSeason()))
|
||||||
|
self.txGarding:setText(DataManager.ArenaData:getGradingName(gradingId))
|
||||||
|
if maxScore then
|
||||||
|
self.txProg:setText(curScore.."/"..maxScore)
|
||||||
|
self.imgProg:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curScore/maxScore
|
||||||
|
else
|
||||||
|
self.txProg:setText(curScore)
|
||||||
|
self.imgProg:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if DataManager.ArenaData:hasSeasonReward() then
|
||||||
|
self.btnReward:addRedPoint(30, 25, 0.6)
|
||||||
|
else
|
||||||
|
self.btnReward:removeRedPoint()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.spineRoot:removeAllChildren()
|
||||||
|
-- SpineManager:loadUISpineWidgetAsync(gradingIconName.."_spine", self.spineRoot, function(spineObject)
|
||||||
|
-- self.spineGrading = spineObject
|
||||||
|
-- self.spineGrading:setSkin(gradingNumName)
|
||||||
|
-- self.spineGrading:playAnim("idle", true)
|
||||||
|
-- end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:refreshRightBtns()
|
||||||
|
local y = 0
|
||||||
|
if self.rightBtnCells.giftCell:checkIsOpen() then
|
||||||
|
y = y - 60
|
||||||
|
self.rightBtnCells.giftCell:setActive(true)
|
||||||
|
self.rightBtnCells.giftCell:setVisible(true)
|
||||||
|
self.rightBtnCells.giftCell:getBaseObject():setAnchoredPositionY(y)
|
||||||
|
self.rightBtnCells.giftCell:refresh()
|
||||||
|
else
|
||||||
|
self.rightBtnCells.giftCell:setVisible(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 暂不处理箭头的问题
|
||||||
|
self.rightNode:setVisible(y < 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 刷新段位奖励红点
|
||||||
|
function ArenaUI:refreshRedPoint()
|
||||||
|
if DataManager.ArenaData:hasGradingRewardRedDot() then
|
||||||
|
self.btnGradingReward:addRedPoint(50, 50, 0.6)
|
||||||
|
else
|
||||||
|
self.btnGradingReward:removeRedPoint()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaUI:refreshFightBtn()
|
||||||
|
local isShowFight = false
|
||||||
|
|
||||||
|
-- 体力消耗
|
||||||
|
self.fightCost:setActive(false)
|
||||||
|
self.countTxNum:setActive(false)
|
||||||
|
self.fightBtn:setActive(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
return ArenaUI
|
||||||
10
lua/app/ui/arena/arena_ui.lua.meta
Normal file
10
lua/app/ui/arena/arena_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1d2877c73be00634aa62655ced77efc5
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -1,19 +1,23 @@
|
|||||||
local DailyChallengeUI = class("DailyChallengeUI", BaseUI)
|
local DailyChallengeUI = class("DailyChallengeUI", BaseUI)
|
||||||
|
|
||||||
function DailyChallengeUI:getIsOpen()
|
-- function DailyChallengeUI:getIsOpen()
|
||||||
return DataManager.DailyChallengeData:isOpen()
|
-- return DataManager.DailyChallengeData:isOpen()
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- function DailyChallengeUI:getEntranceName()
|
||||||
|
-- return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- function DailyChallengeUI:getShowEntranceRedPoint()
|
||||||
|
-- return DataManager.DailyChallengeData:isMeetChallenge()
|
||||||
|
-- end
|
||||||
|
|
||||||
|
function DailyChallengeUI:isFullScreen()
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeUI:getEntranceName()
|
function DailyChallengeUI:getPrefabPath()
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)
|
return "assets/prefabs/ui/daily_challenge/daily_challenge_ui.prefab"
|
||||||
end
|
|
||||||
|
|
||||||
function DailyChallengeUI:getShowEntranceRedPoint()
|
|
||||||
return DataManager.DailyChallengeData:isMeetChallenge()
|
|
||||||
end
|
|
||||||
|
|
||||||
function DailyChallengeUI:onClickFight()
|
|
||||||
ModuleManager.DailyChallengeManager:startChallenge()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeUI:ctor()
|
function DailyChallengeUI:ctor()
|
||||||
@ -23,8 +27,11 @@ end
|
|||||||
function DailyChallengeUI:onLoadRootComplete()
|
function DailyChallengeUI:onLoadRootComplete()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
|
|
||||||
uiMap["daily_challenge_ui.title.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE))
|
uiMap["daily_challenge_ui.close_btn"]:addClickListener(function ()
|
||||||
uiMap["daily_challenge_ui.record_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.DailyChallengeData:getMaxWave()))
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
uiMap["daily_challenge_ui.challenge.info.title.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE))
|
||||||
|
uiMap["daily_challenge_ui.challenge.info.record_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.DailyChallengeData:getMaxWave()))
|
||||||
|
|
||||||
self.tasks = GFunc.getTable()
|
self.tasks = GFunc.getTable()
|
||||||
table.insert(self.tasks, uiMap["daily_challenge_ui.challenge.task.icon_task1"])
|
table.insert(self.tasks, uiMap["daily_challenge_ui.challenge.task.icon_task1"])
|
||||||
@ -45,9 +52,11 @@ function DailyChallengeUI:onLoadRootComplete()
|
|||||||
self.countTxNum = uiMap["daily_challenge_ui.fight_btn.tx_count"]
|
self.countTxNum = uiMap["daily_challenge_ui.fight_btn.tx_count"]
|
||||||
-- 按钮文本
|
-- 按钮文本
|
||||||
self.txFight = uiMap["daily_challenge_ui.fight_btn.tx_desc"]
|
self.txFight = uiMap["daily_challenge_ui.fight_btn.tx_desc"]
|
||||||
|
self.fightBtn:addClickListener(function ()
|
||||||
|
ModuleManager.DailyChallengeManager:startChallenge()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function DailyChallengeUI:updateTime()
|
function DailyChallengeUI:updateTime()
|
||||||
ModuleManager.DailyChallengeManager:checkDayChange()
|
ModuleManager.DailyChallengeManager:checkDayChange()
|
||||||
local remainTime = Time:getTodaySurplusTime()
|
local remainTime = Time:getTodaySurplusTime()
|
||||||
@ -124,7 +133,7 @@ function DailyChallengeUI:refreshBoss()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refreshFightBtn()
|
function DailyChallengeUI:refreshFightBtn()
|
||||||
local isShowFight = false
|
local isShowFight = false
|
||||||
|
|
||||||
-- 体力消耗
|
-- 体力消耗
|
||||||
@ -150,7 +159,6 @@ function MainComp:refreshFightBtn()
|
|||||||
|
|
||||||
if isShowFight then
|
if isShowFight then
|
||||||
self.fightBtn:setActive(true)
|
self.fightBtn:setActive(true)
|
||||||
self.fightBtn:addClickListener(moduleCell.onClickFight)
|
|
||||||
else
|
else
|
||||||
self.fightBtn:setActive(false)
|
self.fightBtn:setActive(false)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
local ChapterComp = class("ChapterComp", LuaComponent)
|
local MainComp = class("MainComp", LuaComponent)
|
||||||
|
|
||||||
local UISpineObject = require "app/bf/unity/ui_spine_object"
|
local UISpineObject = require "app/bf/unity/ui_spine_object"
|
||||||
|
|
||||||
@ -11,23 +11,7 @@ local BOX_ICON = {
|
|||||||
"common_chest_4"
|
"common_chest_4"
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChapterComp:getIsOpen()
|
function MainComp:init()
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterComp:getEntranceName()
|
|
||||||
return I18N:getGlobalText(I18N.GlobalConst.MAIN_CHAPTER)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterComp:getFightHpCost()
|
|
||||||
return DataManager.ChapterData:getFightCost()
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterComp:onClickFight()
|
|
||||||
ModuleManager.ChapterManager:startFight()
|
|
||||||
end
|
|
||||||
|
|
||||||
function ChapterComp:init()
|
|
||||||
self.uiMap = self:getBaseObject():genAllChildren()
|
self.uiMap = self:getBaseObject():genAllChildren()
|
||||||
|
|
||||||
self.chapterImg = self.uiMap["main_comp.img"]
|
self.chapterImg = self.uiMap["main_comp.img"]
|
||||||
@ -83,13 +67,20 @@ function ChapterComp:init()
|
|||||||
self.fightBtn:addClickListener(function ()
|
self.fightBtn:addClickListener(function ()
|
||||||
ModuleManager.ChapterManager:startFight()
|
ModuleManager.ChapterManager:startFight()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
self.uiMap["main_comp.arena_btn"]:addClickListener(function()
|
||||||
|
ModuleManager.ArenaManager:reqArenaInfo(true)
|
||||||
|
end)
|
||||||
|
self.uiMap["main_comp.daily_challenge_btn"]:addClickListener(function()
|
||||||
|
ModuleManager.DailyChallengeManager:showDailyChallengeUI()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:refresh()
|
function MainComp:refresh()
|
||||||
self:refreshChapter()
|
self:refreshChapter()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:refreshChapter(force)
|
function MainComp:refreshChapter(force)
|
||||||
local chapterId = DataManager.ChapterData:getChapterId()
|
local chapterId = DataManager.ChapterData:getChapterId()
|
||||||
if self.currChapterId ~= chapterId or force then
|
if self.currChapterId ~= chapterId or force then
|
||||||
if DataManager.ChapterData:getIsFirstChapter(chapterId) then -- 第一章不需要左箭头
|
if DataManager.ChapterData:getIsFirstChapter(chapterId) then -- 第一章不需要左箭头
|
||||||
@ -224,7 +215,7 @@ function ChapterComp:refreshChapter(force)
|
|||||||
self:doMonsterAction()
|
self:doMonsterAction()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:onOpen()
|
function MainComp:onOpen()
|
||||||
self.startMonsterAction = true
|
self.startMonsterAction = true
|
||||||
if self.bossNode then
|
if self.bossNode then
|
||||||
self.bossNode:setAnchoredPositionX(0)
|
self.bossNode:setAnchoredPositionX(0)
|
||||||
@ -237,7 +228,7 @@ function ChapterComp:onOpen()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:onClose()
|
function MainComp:onClose()
|
||||||
if self.chapterMoveSeq then
|
if self.chapterMoveSeq then
|
||||||
self.chapterMoveSeq:Kill()
|
self.chapterMoveSeq:Kill()
|
||||||
self.chapterMoveSeq = nil
|
self.chapterMoveSeq = nil
|
||||||
@ -263,7 +254,7 @@ function ChapterComp:onClose()
|
|||||||
self.smokeNodeDown:removeAllChildren()
|
self.smokeNodeDown:removeAllChildren()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:refreshFightBtn()
|
function MainComp:refreshFightBtn()
|
||||||
-- 体力消耗
|
-- 体力消耗
|
||||||
local cost = DataManager.ChapterData:getFightCost()
|
local cost = DataManager.ChapterData:getFightCost()
|
||||||
self.fightCost:setActive(true)
|
self.fightCost:setActive(true)
|
||||||
@ -272,7 +263,7 @@ function ChapterComp:refreshFightBtn()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- region 动画
|
-- region 动画
|
||||||
function ChapterComp:doChapterMove()
|
function MainComp:doChapterMove()
|
||||||
if self.chapterMoveSeq then
|
if self.chapterMoveSeq then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -286,7 +277,7 @@ function ChapterComp:doChapterMove()
|
|||||||
self.chapterMoveSeq:SetLoops(-1)
|
self.chapterMoveSeq:SetLoops(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:doBossAction()
|
function MainComp:doBossAction()
|
||||||
if self.currChapterId == nil then
|
if self.currChapterId == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -339,7 +330,7 @@ function ChapterComp:doBossAction()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 切换boss
|
-- 切换boss
|
||||||
function ChapterComp:doChangeBossAction()
|
function MainComp:doChangeBossAction()
|
||||||
local chapterBossId = self.chapterBossId
|
local chapterBossId = self.chapterBossId
|
||||||
local monsterCfg = ConfigManager:getConfig("monster_base")
|
local monsterCfg = ConfigManager:getConfig("monster_base")
|
||||||
local monsterInfo = monsterCfg[self.chapterBossId]
|
local monsterInfo = monsterCfg[self.chapterBossId]
|
||||||
@ -369,7 +360,7 @@ function ChapterComp:doChangeBossAction()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:doMonsterAction()
|
function MainComp:doMonsterAction()
|
||||||
if self.chapterMonsterGenerateSeq then
|
if self.chapterMonsterGenerateSeq then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -383,7 +374,7 @@ function ChapterComp:doMonsterAction()
|
|||||||
self.chapterMonsterGenerateSeq:SetLoops(-1)
|
self.chapterMonsterGenerateSeq:SetLoops(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:generateChapterMonsters()
|
function MainComp:generateChapterMonsters()
|
||||||
local monsterId
|
local monsterId
|
||||||
if #self.chapterMonsterShowList <= 2 then
|
if #self.chapterMonsterShowList <= 2 then
|
||||||
monsterId = self.chapterMonsterShowList[2]
|
monsterId = self.chapterMonsterShowList[2]
|
||||||
@ -437,7 +428,7 @@ function ChapterComp:generateChapterMonsters()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:doMonsterMove(modelId, spine, posY, monsterInfo, isTopTurn)
|
function MainComp:doMonsterMove(modelId, spine, posY, monsterInfo, isTopTurn)
|
||||||
spine:playAnim("move", true, true, true)
|
spine:playAnim("move", true, true, true)
|
||||||
local posX = GConst.UI_SCREEN_WIDTH / 2 + 100
|
local posX = GConst.UI_SCREEN_WIDTH / 2 + 100
|
||||||
local targetPosX = -GConst.UI_SCREEN_WIDTH / 2 - 300
|
local targetPosX = -GConst.UI_SCREEN_WIDTH / 2 - 300
|
||||||
@ -504,7 +495,7 @@ function ChapterComp:doMonsterMove(modelId, spine, posY, monsterInfo, isTopTurn)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:enterChapterBattle()
|
function MainComp:enterChapterBattle()
|
||||||
-- boss等一会再跑
|
-- boss等一会再跑
|
||||||
local bossWaitTime = GFunc.getConstValue("chapter_fight_bosswait") / 1000
|
local bossWaitTime = GFunc.getConstValue("chapter_fight_bosswait") / 1000
|
||||||
local bossSeq = DOTweenManager:createSeqWithIntId(GConst.DOTWEEN_IDS.CHAPTER_MONSTER)
|
local bossSeq = DOTweenManager:createSeqWithIntId(GConst.DOTWEEN_IDS.CHAPTER_MONSTER)
|
||||||
@ -543,7 +534,7 @@ function ChapterComp:enterChapterBattle()
|
|||||||
return GFunc.getConstValue("chapter_fight_wait") / 1000
|
return GFunc.getConstValue("chapter_fight_wait") / 1000
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:generateChapterFightMonsters()
|
function MainComp:generateChapterFightMonsters()
|
||||||
local monsterId
|
local monsterId
|
||||||
if #self.chapterMonsterShowList <= 2 then
|
if #self.chapterMonsterShowList <= 2 then
|
||||||
monsterId = self.chapterMonsterShowList[2]
|
monsterId = self.chapterMonsterShowList[2]
|
||||||
@ -594,7 +585,7 @@ function ChapterComp:generateChapterFightMonsters()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:doMonsterFightMove(modelId, spine, posY, monsterInfo, isTopTurn)
|
function MainComp:doMonsterFightMove(modelId, spine, posY, monsterInfo, isTopTurn)
|
||||||
spine:playAnim("move", true, true, true)
|
spine:playAnim("move", true, true, true)
|
||||||
local posX = GConst.UI_SCREEN_WIDTH / 2 + math.random(100, math.floor(GConst.UI_SCREEN_WIDTH*2/3))
|
local posX = GConst.UI_SCREEN_WIDTH / 2 + math.random(100, math.floor(GConst.UI_SCREEN_WIDTH*2/3))
|
||||||
spine:setAnchoredPosition(posX, posY)
|
spine:setAnchoredPosition(posX, posY)
|
||||||
@ -671,14 +662,14 @@ function ChapterComp:doMonsterFightMove(modelId, spine, posY, monsterInfo, isTop
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:sortChapterFightMonstersOrder()
|
function MainComp:sortChapterFightMonstersOrder()
|
||||||
self:sortChildrenOrder(self.monsterNodeTop)
|
self:sortChildrenOrder(self.monsterNodeTop)
|
||||||
self:sortChildrenOrder(self.monsterNodeDown)
|
self:sortChildrenOrder(self.monsterNodeDown)
|
||||||
self:sortChildrenOrder(self.smokeNodeTop)
|
self:sortChildrenOrder(self.smokeNodeTop)
|
||||||
self:sortChildrenOrder(self.smokeNodeDown)
|
self:sortChildrenOrder(self.smokeNodeDown)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:sortChildrenOrder(parent)
|
function MainComp:sortChildrenOrder(parent)
|
||||||
local children = parent:getChildList()
|
local children = parent:getChildList()
|
||||||
if children and #children > 0 then
|
if children and #children > 0 then
|
||||||
table.sort(children, function(a, b)
|
table.sort(children, function(a, b)
|
||||||
@ -691,7 +682,7 @@ function ChapterComp:sortChildrenOrder(parent)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChapterComp:getMonsterSmoke(isTop)
|
function MainComp:getMonsterSmoke(isTop)
|
||||||
local monsterSmoke
|
local monsterSmoke
|
||||||
if #self.monsterSmokePool > 0 then
|
if #self.monsterSmokePool > 0 then
|
||||||
monsterSmoke = table.remove(self.monsterSmokePool)
|
monsterSmoke = table.remove(self.monsterSmokePool)
|
||||||
@ -707,4 +698,4 @@ function ChapterComp:getMonsterSmoke(isTop)
|
|||||||
end
|
end
|
||||||
-- endregion
|
-- endregion
|
||||||
|
|
||||||
return ChapterComp
|
return MainComp
|
||||||
@ -198,11 +198,6 @@ function MainCityUI:_bind()
|
|||||||
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
|
self:bind(DataManager.PlayerData, "dirty", function(binder, value)
|
||||||
self:refreshPlayerInfo()
|
self:refreshPlayerInfo()
|
||||||
end, true)
|
end, true)
|
||||||
self:bind(DataManager.FormationData, "dirty", function(binder, value)
|
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
|
||||||
self.subComps[self.selectedIndex]:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.HeroData, "isDirty", function(binder, value)
|
self:bind(DataManager.HeroData, "isDirty", function(binder, value)
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
||||||
@ -217,14 +212,6 @@ function MainCityUI:_bind()
|
|||||||
self:refreshBottomRp()
|
self:refreshBottomRp()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self:bind(DataManager.BagData.ItemData, "dirty", function(binder, value)
|
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN and self.subComps[self.selectedIndex] then
|
|
||||||
if self.subComps[self.selectedIndex] then
|
|
||||||
self.subComps[self.selectedIndex]:refreshBtns()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.DailyTaskData, "redPointFlag", function()
|
self:bind(DataManager.DailyTaskData, "redPointFlag", function()
|
||||||
self:refreshTask()
|
self:refreshTask()
|
||||||
end)
|
end)
|
||||||
@ -232,9 +219,6 @@ function MainCityUI:_bind()
|
|||||||
self:bind(DataManager.BountyData, "dirty", function()
|
self:bind(DataManager.BountyData, "dirty", function()
|
||||||
self:refreshBounty()
|
self:refreshBounty()
|
||||||
end)
|
end)
|
||||||
self:bind(DataManager.ArenaBountyData, "dirty", function()
|
|
||||||
self:refreshArenaBounty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.MailData, "redPoint", function()
|
self:bind(DataManager.MailData, "redPoint", function()
|
||||||
self:refreshSettingBtn()
|
self:refreshSettingBtn()
|
||||||
@ -256,30 +240,6 @@ function MainCityUI:_bind()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self:bind(DataManager.DailyChallengeData, "isDirty", function()
|
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
|
||||||
if self.subComps[self.selectedIndex] then
|
|
||||||
self.subComps[self.selectedIndex]:refreshChallenge()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.DungeonData, "isDirty", function()
|
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
|
||||||
if self.subComps[self.selectedIndex] then
|
|
||||||
self.subComps[self.selectedIndex]:refreshDungeon()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.ArenaData, "isDirty", function()
|
|
||||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
|
||||||
if self.subComps[self.selectedIndex] then
|
|
||||||
self.subComps[self.selectedIndex]:refreshArena()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
self:bind(DataManager.AIHelperData, "isDirty", function()
|
self:bind(DataManager.AIHelperData, "isDirty", function()
|
||||||
self:refreshSettingBtn()
|
self:refreshSettingBtn()
|
||||||
end)
|
end)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user