From 31ca1b9571025505f34e81fb15078c4eb90c8a1a Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 20 Aug 2025 10:49:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=A7=E8=BE=B9=E6=A0=8FUI?= =?UTF-8?q?=E7=9A=84=E5=B8=83=E5=B1=80=E8=AE=A1=E7=AE=97bug(=E5=BD=93?= =?UTF-8?q?=E6=9C=89=E5=AD=90=E8=8F=9C=E5=8D=95=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?,=E4=BB=BB=E6=84=8F=E8=8F=9C=E5=8D=95=E9=A1=B9=E5=8F=91?= =?UTF-8?q?=E7=94=9Fvisible=E5=8F=98=E5=8C=96=E9=87=8D=E6=96=B0=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E7=9A=84=E4=BD=8D=E7=BD=AE=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Script/AppMain/UI/OptionUI/OptionUI.cs | 60 ++++++++++--------- .../Script/AppMain/UI/Tools/Selector.cs | 2 - 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs index 0b242694..16d7bdac 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/OptionUI/OptionUI.cs @@ -92,27 +92,18 @@ namespace AxibugEmuOnline.Client { Canvas.ForceUpdateCanvases(); + var topParent = FindTopOptionUI(); + var totalWidth = GetTotalWidth(topParent); + + Vector2 end = new Vector2(-totalWidth, MenuRoot.anchoredPosition.y); + if (m_popTween != null) { - Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y); m_popTween.ChangeEndValue(end, false); } else { - Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y); - var topParent = m_parent; - while (topParent != null && topParent.m_parent != null) - { - topParent = topParent.m_parent; - } - if (topParent != null) - { - topParent.MenuRoot.anchoredPosition = end; - } - else - { - MenuRoot.anchoredPosition = end; - } + topParent.MenuRoot.anchoredPosition = end; } RebuildSelectIndex(); } @@ -223,7 +214,6 @@ namespace AxibugEmuOnline.Client if (!m_bPoped) { - m_bPoped = true; Vector2 start = new Vector2(0, MenuRoot.anchoredPosition.y); Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y); @@ -234,19 +224,8 @@ namespace AxibugEmuOnline.Client var moveDelta = value - start; start = value; - var topParent = m_parent; - while (topParent != null && topParent.m_parent != null) - { - topParent = topParent.m_parent; - } - if (topParent != null) - { - topParent.MenuRoot.anchoredPosition += moveDelta; - } - else - { - MenuRoot.anchoredPosition += moveDelta; - } + var topParent = FindTopOptionUI(); + topParent.MenuRoot.anchoredPosition += moveDelta; }, end, 0.3f @@ -256,7 +235,30 @@ namespace AxibugEmuOnline.Client m_lastCS = CommandDispatcher.Instance.Mode; CommandDispatcher.Instance.Mode = CommandListener.ScheduleType.Normal; } + } + OptionUI FindTopOptionUI() + { + if (m_parent == null) return this; + + var topParent = m_parent; + while (topParent != null && topParent.m_parent != null) + { + topParent = topParent.m_parent; + } + + return topParent; + } + + static float GetTotalWidth(OptionUI root) + { + float totalWidth = root.MenuRoot.rect.width; + if (root.m_child != null) + { + totalWidth += GetTotalWidth(root.m_child); + } + + return totalWidth; } /// diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/Tools/Selector.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/Tools/Selector.cs index 2cf827fd..b4f5c840 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/Tools/Selector.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/Tools/Selector.cs @@ -21,8 +21,6 @@ namespace AxibugEmuOnline.Client get => m_target; set { - if (m_target == value) return; - m_target = value; if (m_target == null) {