From 52a1631ad4ae0814b9fe264a002020214a008eca Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 29 Jun 2023 16:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 3 + lua/app/module/arena/arena_manager.lua | 6 +- lua/app/module/tips/tips_manager.lua | 4 +- lua/app/ui/arena/arena_buy_ticket_ui.lua | 4 +- lua/app/ui/arena/arena_formation_ui.lua | 16 +++- lua/app/ui/arena/arena_match_ui.lua | 74 ++++++++++++++----- lua/app/ui/arena/arena_rank_ui.lua | 23 +++++- lua/app/ui/arena/arena_season_reward_ui.lua | 10 ++- lua/app/ui/arena/cell/arena_rank_cell.lua | 26 ++++++- lua/app/ui/battle/battle_result_ui.lua | 16 ++++ lua/app/ui/bounty/bounty_main_ui.lua | 1 + lua/app/ui/common/cell/hero_cell.lua | 2 - lua/app/ui/common/cell/player_head_cell.lua | 3 +- .../common/component/hero_formation_comp.lua | 2 +- lua/app/ui/dungeon/dungeon_board_cell.lua | 4 +- lua/app/ui/main_city/component/arena_comp.lua | 4 +- .../component/daily_challenge_comp.lua | 2 +- lua/app/ui/main_city/main_city_ui.lua | 12 ++- lua/app/ui/tips/formation_tips.lua | 19 ++--- lua/app/userdata/arena/arena_data.lua | 16 +++- lua/app/userdata/hero/hero_data.lua | 13 +++- 21 files changed, 198 insertions(+), 62 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 5045df9e..cdc7f3a3 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -110,6 +110,9 @@ BIReport.ITEM_GET_TYPE = { DUNGEON_SHARDS_CHALLENGE = "DungeonShardsChallenge", -- 碎片副本挑战 DUNGEON_SHARDS_END = "DungeonShardsEnd", -- 碎片副本结算 DUNGEON_SHARDS_SWEEP = "DungeonShardsSweep", -- 碎片副本扫荡 + ARENA_REMATCH_CD = "ArenaRematchCd", + ARENA_REWARD = "ArenaReward", + ARENA_SETTLEMENT = "ArenaSettlement", CHANGE_NAME = "ChangeName", -- 重命名 CHANGE_AVATAR = "ChangeAvatar", -- 修改头像 CHANGE_FRAME = "ChangeFrame", -- 修改头像框 diff --git a/lua/app/module/arena/arena_manager.lua b/lua/app/module/arena/arena_manager.lua index 5722ca80..ed9a7b51 100644 --- a/lua/app/module/arena/arena_manager.lua +++ b/lua/app/module/arena/arena_manager.lua @@ -87,6 +87,7 @@ function ArenaManager:rspSettlement(result) -- 总共输的次数result.total_lose_count -- 展示结算界面 + ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.ARENA, result.rewards, result.reqData.combatReport) end end @@ -125,7 +126,7 @@ end -- 领取上赛季奖励 function ArenaManager:reqLastSeasonReward() - self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSeasonRewardReq, {}, {}, self.rspLastSeasonReward, nil) + self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSeasonRewardReq, {}, {}, self.rspLastSeasonReward, BIReport.ITEM_GET_TYPE.ARENA_REWARD) end function ArenaManager:rspLastSeasonReward(result) @@ -150,12 +151,13 @@ end -- 结束匹配cd function ArenaManager:reqOverCD(isAd) - self:sendMessage(ProtoMsgType.FromMsgEnum.PVPOverCDReq, {ad = isAd}, {}, self.rspOverCD, nil) + self:sendMessage(ProtoMsgType.FromMsgEnum.PVPOverCDReq, {ad = isAd}, {}, self.rspOverCD, BIReport.ITEM_GET_TYPE.ARENA_REMATCH_CD) end function ArenaManager:rspOverCD(result) if result.err_code == GConst.ERROR_STR.SUCCESS then DataManager.ArenaData:onOverFreeRematchCD(result.reqData.ad) + self:reqMatch() end end diff --git a/lua/app/module/tips/tips_manager.lua b/lua/app/module/tips/tips_manager.lua index 9604aed2..573afe2b 100644 --- a/lua/app/module/tips/tips_manager.lua +++ b/lua/app/module/tips/tips_manager.lua @@ -106,8 +106,10 @@ end -- formation = {{id = 000, level = 000}, {id = 000, level = 000}, ...} function TipsManager:showHeroFormation(targetObj, formation) + local tarCornerScreenPos, location = self:getCornerScreenPosition(targetObj, TipsManager.ALIGN_TYPE.BOTTOM_CENTER) local params = { - targetObj = targetObj, + tarCornerScreenPos = tarCornerScreenPos, + location = location, formation = formation, } UIManager:showUI("app/ui/tips/formation_tips", params) diff --git a/lua/app/ui/arena/arena_buy_ticket_ui.lua b/lua/app/ui/arena/arena_buy_ticket_ui.lua index e49c59a4..7aecaf5c 100644 --- a/lua/app/ui/arena/arena_buy_ticket_ui.lua +++ b/lua/app/ui/arena/arena_buy_ticket_ui.lua @@ -19,11 +19,11 @@ end function ArenaBuyTicketUI:onLoadRootComplete() local uiMap = self.root:genAllChildren() - uiMap["arena_buy_ticket_ui.bg.close_btn"]:addClickListener(function() + uiMap["arena_buy_ticket_ui.bg.btn_close"]:addClickListener(function() self:closeUI() end) - uiMap["arena_buy_ticket_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_ENERGY)) + uiMap["arena_buy_ticket_ui.bg.tx_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_ENERGY)) local constCfg = ConfigManager:getConfig("const") local diamondReward = constCfg["arena_notes_diamond_buy"].reward local adReward = constCfg["arena_notes_ad_buy"].reward diff --git a/lua/app/ui/arena/arena_formation_ui.lua b/lua/app/ui/arena/arena_formation_ui.lua index 23f8c31d..f014ba92 100644 --- a/lua/app/ui/arena/arena_formation_ui.lua +++ b/lua/app/ui/arena/arena_formation_ui.lua @@ -2,7 +2,7 @@ local ArenaFormationUI = class("ArenaFormationUI", BaseUI) function ArenaFormationUI:isFullScreen() - return false + return true end function ArenaFormationUI:showCommonBG() @@ -17,6 +17,20 @@ function ArenaFormationUI:onPressBackspace() self:closeUI() end +function ArenaFormationUI:getCurrencyParams() + if self.currencyParams == nil then + self.currencyParams = { + itemIds = { + GConst.ItemConst.ITEM_ID_GEM, + GConst.ItemConst.ITEM_ID_ARENA_TICKET + }, + showType = GConst.CURRENCY_TYPE.HORIZONTAL + } + end + + return self.currencyParams +end + function ArenaFormationUI:ctor(params) self.formationType = params end diff --git a/lua/app/ui/arena/arena_match_ui.lua b/lua/app/ui/arena/arena_match_ui.lua index f9f3493b..349f67fb 100644 --- a/lua/app/ui/arena/arena_match_ui.lua +++ b/lua/app/ui/arena/arena_match_ui.lua @@ -17,6 +17,24 @@ function ArenaMatchUI:onPressBackspace() self:closeUI() end +function ArenaMatchUI:getCurrencyParams() + if not self.showResult then + return nil + end + + if self.currencyParams == nil then + self.currencyParams = { + itemIds = { + GConst.ItemConst.ITEM_ID_GEM, + GConst.ItemConst.ITEM_ID_ARENA_TICKET + }, + showType = GConst.CURRENCY_TYPE.HORIZONTAL + } + end + + return self.currencyParams +end + function ArenaMatchUI:ctor(isBack) self.isBack = isBack-- 是否是返回到匹配结果界面 end @@ -29,10 +47,16 @@ end function ArenaMatchUI:onClose() if self.waitSid then - ModuleManager.BattleManager:unscheduleGlobal(self.waitSid) + self:unscheduleGlobal(self.waitSid) + self.waitSid = nil end if self.countdownSid then - ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid) + self:unscheduleGlobal(self.countdownSid) + self.countdownSid = nil + end + if self.existSid then + self:unscheduleGlobal(self.existSid) + self.existSid = nil end end @@ -90,9 +114,6 @@ function ArenaMatchUI:onLoadRootComplete() UIManager:showUI("app/ui/arena/arena_formation_ui", GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK) self:closeUI() end) - self:bind(DataManager.ArenaData, "isDirty", function() - self:showMatchResult() - end) end function ArenaMatchUI:onRefresh() @@ -111,6 +132,7 @@ end function ArenaMatchUI:showMatchLoading() self.matchLoading:setActive(true) self.matchResult:setActive(false) + self.showResult = false self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_21, DataManager.ArenaData:getSeason())) self.txLoading:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_22)) @@ -118,34 +140,33 @@ function ArenaMatchUI:showMatchLoading() -- 等待 if self.waitSid then - ModuleManager.BattleManager:unscheduleGlobal(self.waitSid) + self:unscheduleGlobal(self.waitSid) end - self.waitSid = self.matchLoading:performWithDelayGlobal(function() + self.waitSid = self:performWithDelayGlobal(function() self:showMatchResult() end, 1.5) + UIManager:updateBarsState(self) end -- 展示匹配结果页 function ArenaMatchUI:showMatchResult() local matchInfo = DataManager.ArenaData:getMatchInfo() if not matchInfo then - -- 基本不会走到这 Logger.logError("没有匹配对象却进入了匹配结果页,检查是否是网络慢了等情况") return end self.matchLoading:setActive(false) self.matchResult:setActive(true) - self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd() + self.showResult = true - Logger.printTable(matchInfo) - Logger.printTable(self.freeRematchCD) + self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd() self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_CHALLENGE)) self.txConst:setText(DataManager.ArenaData:getFightCostNum()) self.txRematch:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_23)) self.txFormation:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10)) - self.imgAd:setActive(self.freeRematchCD > 0 and DataManager.ArenaData:canAdRematch()) + self.imgAd:setActive(DataManager.ArenaData:canAdRematch()) self.matchAvatar:refresh(matchInfo.avatar, matchInfo.avatar_frame) self.matchTxName:setText(matchInfo.name) @@ -172,13 +193,29 @@ function ArenaMatchUI:showMatchResult() end self.selfHeroFormationComp:refreshBriefInfo(formation) - if self.countdownSid then - ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid) + -- 对手存在倒计时 + self.matchExistCd = DataManager.ArenaData:getMatchExistRemainTime() + if self.existSid then + self:unscheduleGlobal(self.existSid) end - self.countdownSid = self.txFreeCountdown:scheduleGlobal(function() + self.existSid = self:scheduleGlobal(function() + self.matchExistCd = self.matchExistCd - 1 + if self.matchExistCd <= 0 then + self:unscheduleGlobal(self.existSid) + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8)) + self:closeUI() + end + end, 1) + + -- 免费匹配cd倒计时 + if self.countdownSid then + self:unscheduleGlobal(self.countdownSid) + end + self.countdownSid = self:scheduleGlobal(function() self:refreshCountdown() end, 1) self:refreshCountdown() + UIManager:updateBarsState(self) end function ArenaMatchUI:refreshCountdown() @@ -187,7 +224,7 @@ function ArenaMatchUI:refreshCountdown() -- 冷却已好 self.txFreeCountdown:setActive(false) - ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid) + self:unscheduleGlobal(self.countdownSid) else -- 冷却未好 self.txFreeCountdown:setActive(true) @@ -199,21 +236,22 @@ end function ArenaMatchUI:onClickRematch() if self.freeRematchCD > 0 then -- 在cd时间内 - if DataManager.ArenaData:canAdRematch() then -- 看视频 SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_REMATCH, function () ModuleManager.ArenaManager:reqOverCD(true) + self:showMatchLoading() end) else -- 钻石 local params ={ content = I18N:getGlobalText(I18N.GlobalConst.BOUNTY_BUY_LEVEL_COUNTENT), boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL, - costId = ItemConst.ITEM_ID_GEM, + costId = GConst.ItemConst.ITEM_ID_GEM, costNum = DataManager.ArenaData:getRematchConstGem(), okFunc = function() ModuleManager.ArenaManager:reqOverCD(false) + self:showMatchLoading() end, } GFunc.showMessageBox(params) diff --git a/lua/app/ui/arena/arena_rank_ui.lua b/lua/app/ui/arena/arena_rank_ui.lua index 80048a23..f6b39e73 100644 --- a/lua/app/ui/arena/arena_rank_ui.lua +++ b/lua/app/ui/arena/arena_rank_ui.lua @@ -35,14 +35,14 @@ function ArenaRankUI:onLoadRootComplete() self.txTitle = uiMap["arena_rank_ui.bg.title.tx_title"] self.closeBtn = uiMap["arena_rank_ui.bg.close_btn"] + self.imgRank = uiMap["arena_rank_ui.bg.my_rank.img_rank"] self.txRank = uiMap["arena_rank_ui.bg.my_rank.tx_rank"] self.playerHeadCell = CellManager:addCellComp(uiMap["arena_rank_ui.bg.my_rank.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL) self.txName = uiMap["arena_rank_ui.bg.my_rank.tx_name"] self.cellGrading = uiMap["arena_rank_ui.bg.my_rank.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL) self.scrollRectComp = uiMap["arena_rank_ui.bg.list_rank"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) - self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5)) - self.txRank:setText(DataManager.ArenaData:getRank()) + self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_5)) self.txName:setText(DataManager.PlayerData:getNickname()) self.cellGrading:refresh(DataManager.ArenaData:getGradingId()) self.playerHeadCell:refresh(nil, nil, false) @@ -65,6 +65,25 @@ end function ArenaRankUI:onRefresh() self.scrollRectComp:clearCells() self.scrollRectComp:refillCells(DataManager.ArenaData:getRankCount()) + + local rank = DataManager.ArenaData:getRank() + if rank == 1 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_1") + elseif rank == 2 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_2") + elseif rank == 3 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_3") + else + self.imgRank:setActive(false) + self.txRank:setActive(true) + self.txRank:setText(rank) + end end return ArenaRankUI \ No newline at end of file diff --git a/lua/app/ui/arena/arena_season_reward_ui.lua b/lua/app/ui/arena/arena_season_reward_ui.lua index 846f0bc1..a7bb1222 100644 --- a/lua/app/ui/arena/arena_season_reward_ui.lua +++ b/lua/app/ui/arena/arena_season_reward_ui.lua @@ -27,6 +27,10 @@ function ArenaSeasonRewardUI:onReshow() end function ArenaSeasonRewardUI:onClose() + if self.seasonChangeSid then + self:unscheduleGlobal(self.seasonChangeSid) + self.seasonChangeSid = nil + end end function ArenaSeasonRewardUI:onLoadRootComplete() @@ -77,9 +81,9 @@ function ArenaSeasonRewardUI:showSeasonReward() self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_12, DataManager.ArenaData:getSeason())) if self.seasonChangeSid then - ModuleManager.BattleManager:unscheduleGlobal(self.seasonChangeSid) + self:unscheduleGlobal(self.seasonChangeSid) end - self.seasonChangeSid = self.txTime:scheduleGlobal(function() + self.seasonChangeSid = self:scheduleGlobal(function() self:refreshCountdown() end, 1) @@ -110,7 +114,7 @@ function ArenaSeasonRewardUI:showGetReward() self.txGrading:setText(DataManager.ArenaData:getGradingName(lastId)) self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM)) - self.btnGet:addRedPoint(65, 35, 0.6) + self.btnGet:addRedPoint(110, 35, 0.6) self.getRewardComp:addInitCallback(function() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL diff --git a/lua/app/ui/arena/cell/arena_rank_cell.lua b/lua/app/ui/arena/cell/arena_rank_cell.lua index f11a46ec..96bb332d 100644 --- a/lua/app/ui/arena/cell/arena_rank_cell.lua +++ b/lua/app/ui/arena/cell/arena_rank_cell.lua @@ -4,6 +4,7 @@ function ArenaRankCell:init() local uiMap = self:getUIMap() self.txRank = uiMap["arena_rank_cell.tx_rank"] + self.imgRank = uiMap["arena_rank_cell.img_rank"] self.playerHeadCell = CellManager:addCellComp(uiMap["arena_rank_cell.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL) self.txName = uiMap["arena_rank_cell.tx_name"] self.cellGrading = uiMap["arena_rank_cell.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL) @@ -25,13 +26,34 @@ function ArenaRankCell:init() end function ArenaRankCell:refresh(rank) - self.clickFormation = false self.rankInfo = DataManager.ArenaData:getRankData(rank) self.playerHeadCell:refresh(self.rankInfo.avatar, self.rankInfo.avatar_frame) self.txRank:setText(self.rankInfo.rank) - self.txName:setText(rank) + self.txName:setText(self.rankInfo.name) self.cellGrading:refresh(DataManager.ArenaData:getGradingIdFromScore(self.rankInfo.score)) + + if rank == 1 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_1") + self.baseObject:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_bg_1") + elseif rank == 2 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_2") + self.baseObject:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_bg_2") + elseif rank == 3 then + self.txRank:setActive(false) + self.imgRank:setActive(true) + self.imgRank:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_3") + self.baseObject:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_bg_3") + else + self.imgRank:setActive(false) + self.txRank:setActive(true) + self.txRank:setText(rank) + self.baseObject:setSprite(GConst.ATLAS_PATH.ARENA, "arena_ranking_bg_4") + end end function ArenaRankCell:showHeroFormationTips() diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 1a5f6027..4bb061b0 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -151,6 +151,12 @@ end function BattleResultUI:refreshUnitNodeAnim(parent) local uiMap = self.root:genAllChildren() + if not parent then + uiMap["battle_result_ui.unit_node"]:setActive(false) + return + else + uiMap["battle_result_ui.unit_node"]:setActive(true) + end uiMap["battle_result_ui.unit_node"]:setParent(parent, false) uiMap["battle_result_ui.unit_node"]:setAnchoredPosition(0, 0) local canvasNodeUnit = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) @@ -167,6 +173,16 @@ function BattleResultUI:refreshUnitNodeAnim(parent) end) end +function BattleResultUI:refreshArenaNode(isShow) + local uiMap = self.root:genAllChildren() + if not isShow then + uiMap["battle_result_ui.arena_node"]:setActive(false) + return + else + uiMap["battle_result_ui.arena_node"]:setActive(true) + end +end + function BattleResultUI:refreshRewards() if self.scrollRectComp then self.scrollRectComp:updateAllCell() diff --git a/lua/app/ui/bounty/bounty_main_ui.lua b/lua/app/ui/bounty/bounty_main_ui.lua index 11909973..f668418d 100644 --- a/lua/app/ui/bounty/bounty_main_ui.lua +++ b/lua/app/ui/bounty/bounty_main_ui.lua @@ -444,6 +444,7 @@ function BountyMainUI:scrollToIndex(targetIndex) end function BountyMainUI:updateTime() + Logger.logError("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") local remainTime = self.endTime - Time:getServerTime() if remainTime < 0 then UIManager:closeUnderUI(self) diff --git a/lua/app/ui/common/cell/hero_cell.lua b/lua/app/ui/common/cell/hero_cell.lua index 100967f1..3463c135 100644 --- a/lua/app/ui/common/cell/hero_cell.lua +++ b/lua/app/ui/common/cell/hero_cell.lua @@ -30,7 +30,6 @@ function HeroCell:init() end) end --- 显示自己英雄 function HeroCell:refresh(heroEntity, isGray) self.selfNode:setVisible(true) self.otherNode:setVisible(false) @@ -81,7 +80,6 @@ function HeroCell:refresh(heroEntity, isGray) end end ---显示其他人英雄 function HeroCell:refreshBriefInfo(id, level) self.selfNode:setVisible(false) self.otherNode:setVisible(true) diff --git a/lua/app/ui/common/cell/player_head_cell.lua b/lua/app/ui/common/cell/player_head_cell.lua index 1daf816c..c39921ca 100644 --- a/lua/app/ui/common/cell/player_head_cell.lua +++ b/lua/app/ui/common/cell/player_head_cell.lua @@ -14,7 +14,6 @@ function PlayerHeadCell:refresh(avatarId, frameId, showRp) self.isSelf = true avatarId = DataManager.PlayerData:getUsingAvatarId() frameId = DataManager.PlayerData:getUsingFrameId() - showRp = showRp == nil and (DataManager.PlayerData:hasNewAvatar() or DataManager.PlayerData:hasNewFrame()) end -- 背景颜色 @@ -43,7 +42,7 @@ function PlayerHeadCell:refresh(avatarId, frameId, showRp) end -- 红点 - if showRp then + if showRp and (DataManager.PlayerData:hasNewAvatar() or DataManager.PlayerData:hasNewFrame()) then self.baseObject:addRedPoint(50, 50, 0.7) else self.baseObject:removeRedPoint() diff --git a/lua/app/ui/common/component/hero_formation_comp.lua b/lua/app/ui/common/component/hero_formation_comp.lua index 678940ed..6640024c 100644 --- a/lua/app/ui/common/component/hero_formation_comp.lua +++ b/lua/app/ui/common/component/hero_formation_comp.lua @@ -39,7 +39,7 @@ end -- formation = {{id = 000, level=000},{id = 000, level=000}, ...} function HeroFormationComp:refreshBriefInfo(formation) for i, heroCell in ipairs(self.heroCells) do - if formation[i] then + if formation[i] and DataManager.HeroData:isExistHeroById(formation[i].id) then heroCell:setVisible(true, 1) heroCell:refreshBriefInfo(formation[i].id, formation[i].level) else diff --git a/lua/app/ui/dungeon/dungeon_board_cell.lua b/lua/app/ui/dungeon/dungeon_board_cell.lua index 18341c0b..7f28ddd6 100644 --- a/lua/app/ui/dungeon/dungeon_board_cell.lua +++ b/lua/app/ui/dungeon/dungeon_board_cell.lua @@ -102,10 +102,10 @@ end function DungeonBoardCell:refreshCountdown(txCountdown) if self.countdownSid then - SchedulerManager:unscheduleGlobal(self.countdownSid) + ModuleManager.DungeonManager:unscheduleGlobal(self.countdownSid) self.countdownSid = nil end - self.countdownSid = txCountdown:scheduleGlobal(function() + self.countdownSid = ModuleManager.DungeonManager:scheduleGlobal(function() self:updateTime(txCountdown) end, 1) self:updateTime(txCountdown) diff --git a/lua/app/ui/main_city/component/arena_comp.lua b/lua/app/ui/main_city/component/arena_comp.lua index 4bac6749..1feaac0c 100644 --- a/lua/app/ui/main_city/component/arena_comp.lua +++ b/lua/app/ui/main_city/component/arena_comp.lua @@ -128,9 +128,9 @@ function ArenaComp:refreshShow() self.seasonChangeCD = DataManager.ArenaData:getRemainSeasonTime() if self.seasonChangeSid then - ModuleManager.BattleManager:unscheduleGlobal(self.seasonChangeSid) + ModuleManager.ArenaManager:unscheduleGlobal(self.seasonChangeSid) end - self.seasonChangeSid = self.txCountdown:scheduleGlobal(function() + self.seasonChangeSid = ModuleManager.ArenaManager:scheduleGlobal(function() self:refreshCountdown() end, 1) diff --git a/lua/app/ui/main_city/component/daily_challenge_comp.lua b/lua/app/ui/main_city/component/daily_challenge_comp.lua index b144e7d1..4697b73d 100644 --- a/lua/app/ui/main_city/component/daily_challenge_comp.lua +++ b/lua/app/ui/main_city/component/daily_challenge_comp.lua @@ -136,7 +136,7 @@ end function DailyChallengeComp:refreshCountdown() self.countdownTx = self.uiMap["daily_challenge_comp.countdown.time_tx"] if not self.countdownSid then - self.countdownSid = self.countdownTx:scheduleGlobal(function() + self.countdownSid = ModuleManager.DailyChallengeManager:scheduleGlobal(function() self:updateTime() end, 1) end diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 91e35371..0e49d4b1 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -39,9 +39,14 @@ function MainCityUI:getCurrencyParams() table.remove(self.currencyParams.itemIds) end if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then - self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD - self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GEM - self.currencyParams.itemIds[3] = GConst.ItemConst.ITEM_ID_VIT + if self.mainComp and self.mainComp:getCurModuleType() == GConst.MainCityConst.MAIN_MODULE.ARENA then + self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GEM + self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_ARENA_TICKET + else + self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD + self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GEM + self.currencyParams.itemIds[3] = GConst.ItemConst.ITEM_ID_VIT + end elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_VIT @@ -758,6 +763,7 @@ function MainCityUI:switchMainCompModule(moduleKey) self:setTopNodeVisible(module:isShowTopNode()) self:setSideBarVisible(module:isShowSideBar()) self:refreshBounty() + UIManager:updateBarsState(self) end end diff --git a/lua/app/ui/tips/formation_tips.lua b/lua/app/ui/tips/formation_tips.lua index a06a6a68..a9fbdff9 100644 --- a/lua/app/ui/tips/formation_tips.lua +++ b/lua/app/ui/tips/formation_tips.lua @@ -2,9 +2,9 @@ local BaseTips = require "app/ui/tips/base_tips" local FormationTips = class("FormationTips", BaseTips) function FormationTips:ctor(params) - self.desc = (params.desc or GConst.EMPTY_STRING) self.tarCornerScreenPos = params.tarCornerScreenPos self.location = params.location + self.formation = params.formation end function FormationTips:getPrefabPath() @@ -17,9 +17,8 @@ end function FormationTips:init() local uiMap = self.root:genAllChildren() - self.bg = uiMap["item_tips.bg1.bg"] - self.bg1 = uiMap["item_tips.bg1"] - self.descTx = uiMap["item_tips.bg1.bg.desc_tx"] + self.bg = uiMap["formation_tips.bg"] + self.heroFormation = uiMap["formation_tips.bg.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP) end function FormationTips:onLoadRootComplete() @@ -29,6 +28,8 @@ function FormationTips:onLoadRootComplete() self.originPivot = tipsBgTransform.pivot self.originAnchoredPosition = tipsBgTransform.anchoredPosition self.originLocalPosition = tipsBgTransform.localPosition + + self.heroFormation:refreshBriefInfo(self.formation) end function FormationTips:onRefresh() @@ -36,16 +37,8 @@ function FormationTips:onRefresh() self:closeUI() end) - self.descTx:setText(self.desc) - -- 这里原来是用preferredHeight,但是在中英文混合的时候这个值可能不准,只有改用renderedHeight - -- renderedHeight必须要先调用下ForceMeshUpdate强制刷新才有效 - self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate() - local height = self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedHeight + 18 - if height < 130 then - height = 130 - end - self.bg:setSizeDeltaY(height) if self.tarCornerScreenPos then + self.tarCornerScreenPos.x = 0 self:locate(self.location, self.originSizeDelta, self.bg, self.tarCornerScreenPos) end end diff --git a/lua/app/userdata/arena/arena_data.lua b/lua/app/userdata/arena/arena_data.lua index 3a9f124d..aeb377aa 100644 --- a/lua/app/userdata/arena/arena_data.lua +++ b/lua/app/userdata/arena/arena_data.lua @@ -203,7 +203,7 @@ end -- 本地是否有排行榜该玩家编队数据 function ArenaData:hasRankFormation(id) - return self.rankFormation == nil or self.rankFormation[id] == nil + return self.rankFormation ~= nil and self.rankFormation[id] ~= nil end -- 获取排行榜玩家编队信息 @@ -215,6 +215,11 @@ end -- 获取匹配玩家信息 function ArenaData:getMatchInfo() + if EDITOR_MODE then + Logger.logHighlight("当前匹配玩家信息") + Logger.printTable(self.matchInfo) + end + if Time:getServerTime() - self.matchSuccessTime > self:getMatchInfoMaxTime() then -- 超过时间需要重新匹配 return nil @@ -226,6 +231,11 @@ function ArenaData:getMatchInfo() return self.matchInfo end +-- 匹配玩家剩余存在时间 +function ArenaData:getMatchExistRemainTime() + return self:getMatchInfoMaxTime() - (Time:getServerTime() - self.matchSuccessTime) +end + -- 个人 ---------------------------------------------------------------------- -- 获取当前段位积分 @@ -288,9 +298,9 @@ function ArenaData:getFreeRematchCd() return self.matchFreeCdEndTime - Time:getServerTime() end --- 今日是否能看视频重新匹配 +-- 是否能看视频重新匹配 function ArenaData:canAdRematch() - return self.todayAdRematchCount < self:getRematchAdDailyMaxNum() + return self.todayAdRematchCount < self:getRematchAdDailyMaxNum() and self:getFreeRematchCd() > 0 end -- 获取上赛季段位id diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index e5f6dff9..6ef046cc 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -36,7 +36,7 @@ function HeroData:init(data) local heroCfg = ConfigManager:getConfig("hero") for heroId, info in pairs(heroCfg) do local entity = self:getHeroById(heroId) - if entity:isActived() then + if entity and entity:isActived() then local matchType = entity:getMatchType() if not self.matchActiveHeroMap[matchType] then self.matchActiveHeroMap[matchType] = {} @@ -53,6 +53,15 @@ function HeroData:init(data) self.showHeroUnlockChapter = 0 end +-- 是否是合法的英雄 +function HeroData:isExistHeroById(id) + if not id or id == 0 then + return false + end + + return self.heroes[id] ~= nil +end + function HeroData:addHero(heroStruct) if self.heroes[heroStruct.id] then return @@ -66,7 +75,7 @@ function HeroData:getEntity(heroStruct) end function HeroData:getHeroById(id) - if not id or id == 0 then + if not self:isExistHeroById(id) then return end if not self.heroes[id] then