Repair unity packet

This commit is contained in:
emDuy
2026-06-13 02:25:55 +07:00
parent 9048435ac4
commit 2db2424bb1
72 changed files with 52285 additions and 197 deletions

View File

@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UIElements;
using PrimeTween;
using System.Threading.Tasks;
using DG.Tweening;
namespace Hallucinate.UI
{
@@ -41,15 +42,15 @@ namespace Hallucinate.UI
// Lắng nghe sự kiện thay đổi kích thước toàn màn hình
root.RegisterCallback<GeometryChangedEvent>(OnScreenResize);
_logo.RegisterCallback<ClickEvent>(OnLogoClicked);
/*_logo.RegisterCallback<ClickEvent>(OnLogoClicked);*/
var settingsBtn = root.Q<Button>("SettingsBtn");
if (settingsBtn != null) settingsBtn.clicked += () => { if (_isBusy) return; uiManager.ToggleSettings(); };
/*if (settingsBtn != null) settingsBtn.clicked += () => { if (_isBusy) return; uiManager.ToggleSettings(); };
root.Q<Button>("JoinBtn").clicked += async () => { if (_isBusy) return; _isBusy = true; await uiManager.Push<LobbyController>(); };
root.Q<Button>("CreateBtn").clicked += async () => { if (_isBusy) return; _isBusy = true; await uiManager.Push<LobbyController>(); };
root.Q<Button>("ProfileBtn").clicked += async () => { if (_isBusy) return; _isBusy = true; await uiManager.Push<ProfileController>(); };
root.Q<Button>("ExitBtn").clicked += () => Application.Quit();
root.Q<Button>("ExitBtn").clicked += () => Application.Quit();*/
// Đăng ký Localization
if (LocalizationManager.Instance != null)
@@ -130,19 +131,19 @@ namespace Hallucinate.UI
StartRotation();
}
private void StartRotation()
{
if (_currentIcon == null) return;
/*if (_currentIcon == null) return;
if (_rotationTween.isAlive) _rotationTween.Stop();
_rotationTween = Tween.Custom(0f, 360f, duration: 4f,
onValueChange: val => _logo.style.rotate = new StyleRotate(new Rotate(Angle.Degrees(val))),
cycles: -1,
ease: Ease.Linear);
ease: Ease.Linear);*/
}
public override async Task PlayTransitionIn()
/*public override async Task PlayTransitionIn()
{
_isBusy = false;
_lastInteractionTime = Time.time;
@@ -164,11 +165,11 @@ namespace Hallucinate.UI
public override async Task PlayTransitionOut()
{
if (_rotationTween.isAlive) _rotationTween.Stop();
await base.PlayTransitionOut();
}
/*if (_rotationTween.isAlive) _rotationTween.Stop();
await base.PlayTransitionOut();#1#
}*/
private async void OnLogoClicked(ClickEvent evt)
/*private async void OnLogoClicked(ClickEvent evt)
{
if (_isBusy) return;
_lastInteractionTime = Time.time;
@@ -178,7 +179,7 @@ namespace Hallucinate.UI
_isBusy = true;
await uiManager.Push<LobbyController>();
}
}
}*/
private void TransitionToRibbon()
{
@@ -187,7 +188,9 @@ namespace Hallucinate.UI
_lastInteractionTime = Time.time;
_ribbon.style.display = DisplayStyle.Flex;
/*
Tween.Custom(0f, 1f, duration: 0.3f, onValueChange: val => _ribbon.style.opacity = val);
*/
// Đợi một frame để Ribbon layout xong rồi mới lấy vị trí LogoSpace
_logoSpace.RegisterCallback<GeometryChangedEvent>(OnLogoSpaceReady);
@@ -215,7 +218,7 @@ namespace Hallucinate.UI
if (animate)
{
Tween.Custom(_logo.resolvedStyle.left, targetX, duration: 0.5f,
/*Tween.Custom(_logo.resolvedStyle.left, targetX, duration: 0.5f,
onValueChange: val => _logo.style.left = val,
ease: Ease.OutQuad);
@@ -229,7 +232,7 @@ namespace Hallucinate.UI
Tween.Custom(_logo.resolvedStyle.height, 100f, duration: 0.5f,
onValueChange: val => _logo.style.height = val,
ease: Ease.OutQuad);
ease: Ease.OutQuad);*/
}
else
{
@@ -248,7 +251,7 @@ namespace Hallucinate.UI
_currentState = MenuState.Idle;
// Quay lại dùng phần trăm để tự động căn giữa
Tween.Custom(_logo.resolvedStyle.width, 200f, duration: 0.5f, onValueChange: val => _logo.style.width = val, ease: Ease.OutQuad);
/*Tween.Custom(_logo.resolvedStyle.width, 200f, duration: 0.5f, onValueChange: val => _logo.style.width = val, ease: Ease.OutQuad);
Tween.Custom(_logo.resolvedStyle.height, 200f, duration: 0.5f, onValueChange: val => _logo.style.height = val, ease: Ease.OutQuad);
// Animate left/top về 50%
@@ -265,7 +268,7 @@ namespace Hallucinate.UI
});
Tween.Custom(1f, 0f, duration: 0.5f, onValueChange: val => _ribbon.style.opacity = val)
.OnComplete(() => _ribbon.style.display = DisplayStyle.None);
.OnComplete(() => _ribbon.style.display = DisplayStyle.None);*/
}
public override void Update()
@@ -283,12 +286,12 @@ namespace Hallucinate.UI
private void StartPulse()
{
if (_pulseTween.isAlive) _pulseTween.Stop();
/*if (_pulseTween.isAlive) _pulseTween.Stop();
_pulseTween = Tween.Custom(Vector3.one, Vector3.one * 1.1f, duration: 0.8f,
onValueChange: val => _logo.style.scale = new StyleScale(new Scale(val)),
cycles: -1,
cycleMode: CycleMode.Yoyo,
ease: Ease.InOutSine);
ease: Ease.InOutSine);*/
}
private void OnDestroy()