diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/MenuItemTemplate.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/MenuItemTemplate.prefab index deabe98..74413ae 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/MenuItemTemplate.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/MenuItemTemplate.prefab @@ -84,7 +84,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1998281097548910301} - - component: {fileID: 8083619837431842572} - component: {fileID: 2502609279043838113} - component: {fileID: 5700455559359757662} m_Layer: 5 @@ -114,21 +113,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 203} m_Pivot: {x: 0, y: 0.5} ---- !u!111 &8083619837431842572 -Animation: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3189920797946144379} - m_Enabled: 1 - serializedVersion: 3 - m_Animation: {fileID: 0} - m_Animations: [] - m_WrapMode: 0 - m_PlayAutomatically: 1 - m_AnimatePhysics: 0 - m_CullingType: 0 --- !u!114 &2502609279043838113 MonoBehaviour: m_ObjectHideFlags: 0 @@ -144,6 +128,8 @@ MonoBehaviour: Icon: {fileID: 7555299022933968962} Txt: {fileID: 991446423622995247} Root: {fileID: 8754483333502849411} + SelectScale: 1 + UnSelectScale: 0.85 --- !u!114 &5700455559359757662 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MainMenu.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MainMenu.cs index 2289f92..62853aa 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MainMenu.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MainMenu.cs @@ -17,10 +17,6 @@ namespace AxibugEmuOnline.Client.UI [SerializeField] List MenuSetting; [SerializeField] - float SelectScale = 1f; - [SerializeField] - float UnSelectScale = 0.85f; - [SerializeField] float HoriRollSpd = 1f; private RectTransform groupRootRect => GroupRoot.transform as RectTransform; @@ -66,7 +62,7 @@ namespace AxibugEmuOnline.Client.UI private void SetSelectProgress(MenuItem item, float selectProg) { - item.Root.localScale = Vector3.one * Mathf.Lerp(UnSelectScale, SelectScale, selectProg); + item.ControlSelectProgress(selectProg); } private void Start() @@ -77,6 +73,7 @@ namespace AxibugEmuOnline.Client.UI m_runtimeMenuUI.Add(child.GetComponent()); } + Canvas.ForceUpdateCanvases(); SelectIndex = 0; } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs index 75ac62d..b172e87 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs @@ -9,7 +9,11 @@ namespace AxibugEmuOnline.Client.UI Image Icon; [SerializeField] Text Txt; - public Transform Root; + [SerializeField] + Transform Root; + + public float SelectScale = 1f; + public float UnSelectScale = 0.85f; public RectTransform Rect => transform as RectTransform; @@ -21,7 +25,11 @@ namespace AxibugEmuOnline.Client.UI public void ControlSelectProgress(float progress) { + var temp = Txt.color; + temp.a = progress; + Txt.color = temp; + Root.localScale = Vector3.one * Mathf.Lerp(UnSelectScale, SelectScale, progress); } } }