2025-07-21 05:42:20 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace Ichni.Menu.UI
|
|
|
|
|
{
|
|
|
|
|
public partial class SongSelectionTab : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
private SongListControllerUI songListController => MenuManager.instance.songSelectionUIPage.songListController;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
public bool isLocked;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
public SongItemData connectedSong;
|
|
|
|
|
public TMP_Text songNameText;
|
|
|
|
|
|
|
|
|
|
public Button quickSwitchButton;
|
|
|
|
|
|
|
|
|
|
public float distanceToCenter;
|
|
|
|
|
|
|
|
|
|
[Title("背景图&选中处理")]
|
|
|
|
|
public RectTransform background;
|
|
|
|
|
public Image selectedImage;
|
|
|
|
|
public Image unselectedImage;
|
2025-07-26 04:20:25 -04:00
|
|
|
public Image lockMark;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
public void SetUpTab(SongItemData song)
|
|
|
|
|
{
|
|
|
|
|
connectedSong = song;
|
|
|
|
|
songNameText.text = song.songName;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
isLocked = !GameSaveManager.instance.SongSaveModule.CheckUnlock(song.unlockKey);
|
|
|
|
|
lockMark.gameObject.SetActive(isLocked);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
quickSwitchButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
if (MenuManager.instance.songSelectionUIPage.songListController.selectedTab == this)
|
|
|
|
|
{
|
|
|
|
|
// MenuManager.instance.prepareUIPage.SetUpPrepareUIPage(song.songName);
|
|
|
|
|
// MenuManager.instance.prepareUIPage.FadeIn();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
StartCoroutine(MenuManager.instance.songSelectionUIPage.songListController.SnapToTab(this));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
RectTransform centerPoint = songListController.centerPoint;
|
|
|
|
|
RectTransform rectTransform = GetComponent<RectTransform>();
|
|
|
|
|
|
|
|
|
|
distanceToCenter = Mathf.Abs(centerPoint.position.y - rectTransform.position.y);
|
|
|
|
|
float x1 = Mathf.Sqrt(distanceToCenter) * 25 + 25;
|
|
|
|
|
float x2 = distanceToCenter * 5 + 25;
|
|
|
|
|
float x3 = Mathf.Pow(distanceToCenter, 2) / 10f + 25;
|
|
|
|
|
rectTransform.GetChild(0).GetComponent<RectTransform>().anchoredPosition = new Vector2(x2, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class SongSelectionTab
|
|
|
|
|
{
|
|
|
|
|
public void SetSelection(bool isSelected)
|
|
|
|
|
{
|
|
|
|
|
if (isSelected)
|
|
|
|
|
{
|
|
|
|
|
background.DOScaleY(1.2f, 0.25f)
|
|
|
|
|
.SetEase(Ease.OutQuad)
|
|
|
|
|
.Play();
|
|
|
|
|
|
|
|
|
|
selectedImage.DOFade(1, 0.25f)
|
|
|
|
|
.SetEase(Ease.OutQuad)
|
|
|
|
|
.Play();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
background.DOScaleY(1f, 0.25f)
|
|
|
|
|
.SetEase(Ease.OutQuad)
|
|
|
|
|
.Play();
|
|
|
|
|
|
|
|
|
|
selectedImage.DOFade(0, 0.25f)
|
|
|
|
|
.SetEase(Ease.OutQuad)
|
|
|
|
|
.Play();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|