Update Correctly run UI

This commit is contained in:
2026-04-28 10:21:28 +07:00
parent 6d5a9a4e5b
commit ad03c1fefa
5 changed files with 31 additions and 36 deletions

View File

@@ -15,20 +15,25 @@ namespace Hallucinate.UI
root = uxmlRoot;
uiManager = manager;
// Default to hidden
// Đảm bảo ban đầu ẩn hết
Hide();
}
public virtual void Show()
{
if (root != null)
{
root.style.display = DisplayStyle.Flex;
root.style.opacity = 1;
}
}
public virtual void Hide()
{
if (root != null)
{
root.style.display = DisplayStyle.None;
}
}
public virtual async Task PlayTransitionIn()
@@ -36,8 +41,9 @@ namespace Hallucinate.UI
if (root == null) return;
Show();
// Fly-in from right using Custom tween for style.translate
// Reset vị trí mặc định để tránh lỗi trôi màn hình
root.style.translate = new StyleTranslate(new Translate(Length.Percent(100), 0));
await Tween.Custom(100f, 0f, duration: 0.5f, ease: Ease.OutBack,
onValueChange: val => root.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0)));
}
@@ -46,9 +52,9 @@ namespace Hallucinate.UI
{
if (root == null) return;
// Fly-out to left
await Tween.Custom(0f, -100f, duration: 0.5f, ease: Ease.InBack,
onValueChange: val => root.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0)));
Hide();
}
}