Update Correctly run UI
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user