From e2d08a7ffa93ec3f8a28ac8286f1600e3b2a582c Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 17 Jul 2023 15:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=8A=A5=E9=98=B5=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/tips/tips_manager.lua | 10 ++++++++-- lua/app/ui/arena/arena_recent_battle_ui.lua | 3 +++ lua/app/ui/tips/base_tips.lua | 4 ++++ lua/app/ui/tips/formation_tips.lua | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lua/app/module/tips/tips_manager.lua b/lua/app/module/tips/tips_manager.lua index 0ddeeb54..8c9d714a 100644 --- a/lua/app/module/tips/tips_manager.lua +++ b/lua/app/module/tips/tips_manager.lua @@ -14,7 +14,8 @@ TipsManager.ALIGN_TYPE = { LEFT_BOTTOM = 10, RIGHT_TOP = 11, RIGHT_CENTER = 12, - RIGHT_BOTTOM = 13 + RIGHT_BOTTOM = 13, + CUSTOM = 14, } TipsManager.REWARDS_TIPS_TYPE = { @@ -110,6 +111,7 @@ 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) + location = TipsManager.ALIGN_TYPE.CUSTOM local params = { tarCornerScreenPos = tarCornerScreenPos, location = location, @@ -242,7 +244,11 @@ function TipsManager:getCornerScreenPosition(tarPrefabObj, alignType) screenPoint = uiCamera:WorldToScreenPoint(tarCorner) end end - return BF.Vector2(screenPoint.x, screenPoint.y), location + if screenPoint then + return BF.Vector2(screenPoint.x, screenPoint.y), location + else + return BF.Vector2(0, 0), location + end end return TipsManager \ No newline at end of file diff --git a/lua/app/ui/arena/arena_recent_battle_ui.lua b/lua/app/ui/arena/arena_recent_battle_ui.lua index 40909cdf..479d491c 100644 --- a/lua/app/ui/arena/arena_recent_battle_ui.lua +++ b/lua/app/ui/arena/arena_recent_battle_ui.lua @@ -82,6 +82,9 @@ function ArenaRecentBattleUI:refreshRecord(obj, info) local playerHeadCell = CellManager:addCellComp(uiMap["player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL) playerHeadCell:refresh(info.match_info.avatar, info.match_info.avatar_frame) + uiMap["player_head_cell"]:addClickListener(function() + ModuleManager.TipsManager:showHeroFormation(uiMap["player_head_cell"], info.match_info.array_heroes) + end) local name = info.match_info.name if name == nil or #name == 0 then name = I18N:getGlobalText(I18N.GlobalConst.NEW_PLAYER) diff --git a/lua/app/ui/tips/base_tips.lua b/lua/app/ui/tips/base_tips.lua index 6b04c025..e872658d 100644 --- a/lua/app/ui/tips/base_tips.lua +++ b/lua/app/ui/tips/base_tips.lua @@ -87,6 +87,10 @@ function BaseTips:locate(location, originSizeDelta, node, tarCornerScreenPos) local posy = node:getTransform().sizeDelta.y/2 - originSizeDelta.y*(0.5 - self:getPosPercentY()) node:addLocalPosition(tarCornerLp.x + self:getOffsetX(), tarCornerLp.y + posy, 0) self:adaptWhenOverScreen(node, 0, 0.5) + elseif location == ModuleManager.TipsManager.ALIGN_TYPE.CUSTOM then + local pivot = node:getTransform().pivot + node:addLocalPosition(tarCornerLp.x, tarCornerLp.y, 0) + self:adaptWhenOverScreen(node, pivot.x, pivot.y) end self:finalSetPos(node) diff --git a/lua/app/ui/tips/formation_tips.lua b/lua/app/ui/tips/formation_tips.lua index 1719664a..c83a12d2 100644 --- a/lua/app/ui/tips/formation_tips.lua +++ b/lua/app/ui/tips/formation_tips.lua @@ -17,7 +17,7 @@ end function FormationTips:init() local uiMap = self.root:genAllChildren() - self.bg = uiMap["formation_tips.bg"] + self.bg = uiMap["formation_tips.bg.bg"] self.heroFormation = uiMap["formation_tips.bg.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP) end