This commit is contained in:
2026-04-28 10:25:34 +07:00
parent ad03c1fefa
commit 0ac5256b40
2 changed files with 27 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
</component>
<component name="ChangeListManager">
<list default="true" id="f9183c68-daf0-43b8-be4c-fad79983f91b" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/UI/BaseUIController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/UI/BaseUIController.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/UI/MainMenuController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/UI/MainMenuController.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Scripts/UI/SettingsController.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/UI/SettingsController.cs" afterDir="false" />
@@ -145,7 +146,7 @@
<workItem from="1777150520438" duration="58000" />
<workItem from="1777150592854" duration="4699000" />
<workItem from="1777181837663" duration="1519000" />
<workItem from="1777269364664" duration="27420000" />
<workItem from="1777269364664" duration="27758000" />
</task>
<servers />
</component>

View File

@@ -50,6 +50,7 @@ namespace Hallucinate.UI
private void ResetLogoPosition()
{
if (_logo == null) return;
_logo.style.left = (Screen.width / 2f) - 100;
_logo.style.top = (Screen.height / 2f) - 100;
_logo.style.width = 200;
@@ -78,10 +79,21 @@ namespace Hallucinate.UI
public override async Task PlayTransitionIn()
{
if (root != null) root.style.translate = new StyleTranslate(new Translate(0, 0));
Show();
UnityEngine.Cursor.visible = true;
await Task.CompletedTask;
// 1. Đưa về trạng thái Idle và reset vị trí Logo về giữa trước khi hiện
_currentState = MenuState.Idle;
ResetLogoPosition();
if (_ribbon != null)
{
_ribbon.style.display = DisplayStyle.None;
_ribbon.style.opacity = 0;
}
// 2. Chạy hiệu ứng bay vào từ bên phải của Base class
// Hàm này sẽ gọi Show() và chạy Tween di chuyển toàn bộ root
await base.PlayTransitionIn();
// 3. Sau khi bay vào xong, tự động kích hoạt Ribbon
TransitionToRibbon();
}
public override async Task PlayTransitionOut()
@@ -99,16 +111,21 @@ namespace Hallucinate.UI
private async void TransitionToRibbon()
{
// Tránh chạy đè nếu đang ở Ribbon rồi
if (_currentState == MenuState.Ribbon) return;
_currentState = MenuState.Ribbon;
// Hiện Ribbon
_ribbon.style.display = DisplayStyle.Flex;
_ribbon.style.opacity = 0;
Tween.Custom(0f, 1f, duration: 0.3f, onValueChange: val => _ribbon.style.opacity = val);
// Đợi UI Toolkit cập nhật layout
await Task.Yield();
if (_logoSpace == null) return;
Rect targetBounds = _logoSpace.worldBound;
// Di chuyển Logo vào vị trí trong Ribbon
Tween.Custom(_logo.style.left.value.value, targetBounds.x, duration: 0.5f, ease: Ease.OutQuad,
onValueChange: val => _logo.style.left = val);
@@ -120,10 +137,13 @@ namespace Hallucinate.UI
Tween.Custom(_logo.style.height.value.value, 120f, duration: 0.5f, ease: Ease.OutQuad,
onValueChange: val => _logo.style.height = val);
_lastInteractionTime = Time.time;
}
private void TransitionToIdle()
{
if (_currentState == MenuState.Idle) return;
_currentState = MenuState.Idle;
float targetX = (Screen.width / 2f) - 100;