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;
|
2025-08-22 14:54:40 -04:00
|
|
|
using UniRx;
|
2025-07-21 05:42:20 -04:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
namespace Ichni.Menu
|
2025-07-21 05:42:20 -04:00
|
|
|
{
|
|
|
|
|
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;
|
2025-08-11 14:04:06 -04:00
|
|
|
public TMP_Text composerNameText;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
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;
|
2025-08-11 14:04:06 -04:00
|
|
|
songNameText.text = song.displaySongName;
|
|
|
|
|
composerNameText.text = song.composer;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
isLocked = !GameSaveManager.instance.SongSaveModule.CheckStoryKey(song.storyUnlockKey);
|
2025-07-26 04:20:25 -04:00
|
|
|
lockMark.gameObject.SetActive(isLocked);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
quickSwitchButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
if (MenuManager.instance.songSelectionUIPage.songListController.selectedTab == this)
|
|
|
|
|
{
|
2025-08-27 21:45:18 -04:00
|
|
|
if (MenuManager.instance.isEnteringGame)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MenuManager.instance.isEnteringGame = true;
|
|
|
|
|
|
2025-08-22 14:54:40 -04:00
|
|
|
InformationTransistor.instance.SetInformation(
|
|
|
|
|
ChapterSelectionManager.instance.currentChapter,
|
|
|
|
|
MenuManager.instance.songSelectionUIPage.selectedSong,
|
|
|
|
|
MenuManager.instance.songSelectionUIPage.selectedDifficulty);
|
2025-08-27 21:45:18 -04:00
|
|
|
|
2025-08-22 14:54:40 -04:00
|
|
|
MenuAudioManager.instance.audioContainer.PlaySoundFX("EnterToGame");
|
|
|
|
|
MenuAudioManager.instance.audioContainer.StopEvent("PlayPreview");
|
|
|
|
|
MenuManager.instance.transitionUIPage.FadeIn();
|
2025-08-27 21:45:18 -04:00
|
|
|
|
2025-08-22 14:54:40 -04:00
|
|
|
Observable.Timer(TimeSpan.FromSeconds(0.6f)).Subscribe(_ =>
|
|
|
|
|
{
|
2025-09-06 21:58:48 -04:00
|
|
|
MenuManager.instance.EnterGame();
|
2025-08-22 14:54:40 -04:00
|
|
|
});
|
2025-07-21 05:42:20 -04:00
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|