修复UI表现

This commit is contained in:
ALIENJACK\alien 2024-09-12 11:02:30 +08:00
parent 828e87c3d0
commit 86ec353733
3 changed files with 19 additions and 4 deletions

View File

@ -13,8 +13,10 @@ namespace AxibugEmuOnline.Client
CanvasGroup RomGroupRoot; CanvasGroup RomGroupRoot;
private TweenerCore<float, float, FloatOptions> m_showTween; private TweenerCore<float, float, FloatOptions> m_showTween;
private void Awake() protected override void Awake()
{ {
base.Awake();
RomGroupRoot.gameObject.SetActive(false); RomGroupRoot.gameObject.SetActive(false);
RomGroupRoot.alpha = 0; RomGroupRoot.alpha = 0;
} }
@ -58,7 +60,7 @@ namespace AxibugEmuOnline.Client
thirdMenuGroup.itemGroup.UpdateDependencyProperty(thirdMenuGroup); thirdMenuGroup.itemGroup.UpdateDependencyProperty(thirdMenuGroup);
thirdMenuGroup.itemGroup.SetData(roms); thirdMenuGroup.itemGroup.SetData(roms);
thirdMenuGroup.itemGroup.UpdateProxyVisualState(); thirdMenuGroup.itemGroup.UpdateProxyVisualState();
thirdMenuGroup.SelectIndex = 0; thirdMenuGroup.ResetToFirst();
}); });
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true); if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true);

View File

@ -33,6 +33,11 @@ namespace AxibugEmuOnline.Client.UI
protected TweenerCore<float, float, FloatOptions> progressTween; protected TweenerCore<float, float, FloatOptions> progressTween;
protected float m_progress; protected float m_progress;
protected virtual void Awake()
{
Reset();
}
public void SetData(MenuData data) public void SetData(MenuData data)
{ {
Reset(); Reset();
@ -47,7 +52,6 @@ namespace AxibugEmuOnline.Client.UI
m_select = false; m_select = false;
m_progress = 0f; m_progress = 0f;
if (InfoNode != null) InfoNode.alpha = 0;
Root.localScale = Vector3.one * UnSelectScale; Root.localScale = Vector3.one * UnSelectScale;
if (progressTween != null) { progressTween.Kill(); progressTween = null; } if (progressTween != null) { progressTween.Kill(); progressTween = null; }

View File

@ -39,6 +39,12 @@ namespace AxibugEmuOnline.Client
} }
} }
public void ResetToFirst()
{
m_selectIndex = -1;
SelectIndex = 0;
}
protected override MenuItem GetItemUIByIndex(int index) protected override MenuItem GetItemUIByIndex(int index)
{ {
return itemGroup.GetItemUIByDataIndex(index).GetComponent<MenuItem>(); return itemGroup.GetItemUIByDataIndex(index).GetComponent<MenuItem>();
@ -89,7 +95,10 @@ namespace AxibugEmuOnline.Client
if (!useAnim) if (!useAnim)
srollRect.content.anchoredPosition += new Vector2(0, gap); srollRect.content.anchoredPosition += new Vector2(0, gap);
else else
srollRect.content.anchoredPosition += new Vector2(0, gap); {
var endValue = srollRect.content.anchoredPosition + new Vector2(0, gap);
DOTween.To(() => srollRect.content.anchoredPosition, (x) => srollRect.content.anchoredPosition = x, endValue, 0.125f);
}
} }
Vector3[] corner = new Vector3[4]; Vector3[] corner = new Vector3[4];