개발중

This commit is contained in:
logonkhi
2025-11-12 12:28:17 +09:00
parent 0443abbfab
commit 8850f51193
54 changed files with 6131 additions and 2919 deletions

View File

@@ -1,7 +1,6 @@
#nullable enable
using Cysharp.Threading.Tasks;
using DG.Tweening;
using System;
using System.Linq;
using System.Threading;
using TMPro;
@@ -66,15 +65,15 @@ namespace UVC.UI.Window
// 검색 작업 상태
protected CancellationTokenSource? searchCts;
protected bool isSearching = false;
protected float searchProgress =0f; // 내부 진행도 추적용
protected float searchProgress = 0f; // 내부 진행도 추적용
[SerializeField]
[Tooltip("로딩 아이콘 회전 속도(도/초)")]
protected float loadingRotateSpeed =360f;
protected float loadingRotateSpeed = 360f;
[SerializeField]
[Tooltip("로딩 이미지의 채우기 애니메이션 속도(사이클/초)")]
protected float loadingFillCycle =0.5f; // cycles per second. loadingRotateSpeed360 일때, loadingFillCycle를0.5 보다 높게 설정하면 이상해 보임
protected float loadingFillCycle = 0.5f; // cycles per second. loadingRotateSpeed360 일때, loadingFillCycle를0.5 보다 높게 설정하면 이상해 보임
// DOTween tweens
protected Tween? loadingRotationTween;
@@ -161,6 +160,21 @@ namespace UVC.UI.Window
treeList.DeleteItem(data);
}
/// <summary>
/// 이름으로 아이템 선택
/// </summary>
/// <param name="name"></param>
public void SelectItem(string name)
{
//검색 중이면 취소
CancelSearch();
treeListSearch.gameObject.SetActive(false);
treeList.gameObject.SetActive(true);
treeList.SelectItem(name);
}
protected void StartLoadingAnimation()
{
if (loadingImage == null) return;
@@ -168,21 +182,21 @@ namespace UVC.UI.Window
// 기존 트윈 정리
StopLoadingAnimation();
loadingImage.fillAmount =0f;
loadingImage.fillAmount = 0f;
loadingImage.transform.localRotation = Quaternion.identity;
loadingImage.gameObject.SetActive(true);
// 회전 트윈
float rotDuration = (loadingRotateSpeed !=0f) ? (360f / Mathf.Abs(loadingRotateSpeed)) :1f;
float rotDuration = (loadingRotateSpeed != 0f) ? (360f / Mathf.Abs(loadingRotateSpeed)) : 1f;
loadingRotationTween = loadingImage.transform
.DOLocalRotate(new Vector3(0f,0f, -360f), rotDuration, RotateMode.LocalAxisAdd)
.DOLocalRotate(new Vector3(0f, 0f, -360f), rotDuration, RotateMode.LocalAxisAdd)
.SetEase(Ease.Linear)
.SetLoops(-1, LoopType.Restart);
// 채우기 트윈
float fullDuration = (loadingFillCycle >0f) ? (1f / loadingFillCycle) :1f;
float fullDuration = (loadingFillCycle > 0f) ? (1f / loadingFillCycle) : 1f;
loadingFillTween = DOTween
.To(() => loadingImage.fillAmount, x => loadingImage.fillAmount = x,1f, fullDuration)
.To(() => loadingImage.fillAmount, x => loadingImage.fillAmount = x, 1f, fullDuration)
.SetEase(Ease.InOutSine)
.SetLoops(-1, LoopType.Yoyo);
}
@@ -205,7 +219,7 @@ namespace UVC.UI.Window
{
loadingImage.gameObject.SetActive(false);
loadingImage.transform.localRotation = Quaternion.identity;
loadingImage.fillAmount =0f;
loadingImage.fillAmount = 0f;
}
}
@@ -218,7 +232,7 @@ namespace UVC.UI.Window
searchCts = null;
}
isSearching = false;
searchProgress =0f;
searchProgress = 0f;
StopLoadingAnimation();
}
@@ -281,7 +295,7 @@ namespace UVC.UI.Window
protected async UniTaskVoid PerformSearchAsync(string text, CancellationToken token)
{
isSearching = true;
searchProgress =0f;
searchProgress = 0f;
var results = new System.Collections.Generic.List<TreeListItemData>();
@@ -294,7 +308,7 @@ namespace UVC.UI.Window
}
int total = sourceList.Count;
if (total ==0)
if (total == 0)
{
isSearching = false;
StopLoadingAnimation();
@@ -305,8 +319,8 @@ namespace UVC.UI.Window
string lower = text.ToLowerInvariant();
// 분할 처리: 일정 갯수마다 await으로 제어권을 반환
const int chunk =100;
for (int i =0; i < total; i++)
const int chunk = 100;
for (int i = 0; i < total; i++)
{
token.ThrowIfCancellationRequested();
@@ -317,7 +331,7 @@ namespace UVC.UI.Window
}
// 진행도 업데이트 (내부 사용)
if ((i % chunk) ==0)
if ((i % chunk) == 0)
{
searchProgress = (float)i / (float)total;
await UniTask.Yield(PlayerLoopTiming.Update);
@@ -325,7 +339,7 @@ namespace UVC.UI.Window
}
// 최종 진행도
searchProgress =1f;
searchProgress = 1f;
// UI 반영은 메인 스레드에서
if (!PlayerLoopHelper.IsMainThread) await UniTask.SwitchToMainThread();