2025-07-21 05:42:20 -04:00
|
|
|
|
using DG.Tweening;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
using Ichni.RhythmGame;
|
2026-07-21 15:24:42 -04:00
|
|
|
|
using Ichni.Story;
|
2025-06-14 14:42:49 -04:00
|
|
|
|
using Ichni.UI;
|
2026-03-14 03:13:10 -04:00
|
|
|
|
using SLSUtilities.WwiseAssistance;
|
2026-07-24 17:56:30 -04:00
|
|
|
|
using UnityEngine;
|
2025-08-11 14:04:06 -04:00
|
|
|
|
using UnityEngine.Events;
|
2025-07-08 14:28:40 -04:00
|
|
|
|
using UnityEngine.UI;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
using UnityEngine.UI.Extensions;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
namespace Ichni.Menu
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
public partial class SongSelectionUIPage : UIPageBase
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
2025-08-11 14:04:06 -04:00
|
|
|
|
public Button backButton;
|
2026-07-24 17:56:30 -04:00
|
|
|
|
|
|
|
|
|
|
[Tooltip("从选曲页进入当前章节剧情树的按钮。会优先定位当前选中歌曲对应的 SongBlock;未找到时显示剧情开头。")]
|
|
|
|
|
|
public Button enterStoryButton;
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
public Gradient2 backgroundFrames;
|
|
|
|
|
|
public float framePositionOffset = -1;
|
|
|
|
|
|
|
2025-07-10 08:42:30 -04:00
|
|
|
|
public SongListControllerUI songListController;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
public PlaySongUI playSongUI;
|
|
|
|
|
|
public SongInfoUI songInfoUI;
|
|
|
|
|
|
public DifficultySelectionContainer difficultySelectionContainer;
|
2025-08-27 21:45:18 -04:00
|
|
|
|
//public int currentSelectedDifficultyIndex;
|
2025-06-14 14:42:49 -04:00
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
protected override void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Awake();
|
|
|
|
|
|
|
|
|
|
|
|
fadeOutAction = () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
songListController.ClearSongTabs();
|
|
|
|
|
|
MenuInputManager.OnMoveUp -= songListController.GoToFormerTab;
|
|
|
|
|
|
MenuInputManager.OnMoveDown -= songListController.GoToNextTab;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
fadeInStartAction = () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
songListController.InitializeList();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
fadeInFinishAction = () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
MenuInputManager.OnMoveUp += songListController.GoToFormerTab;
|
|
|
|
|
|
MenuInputManager.OnMoveDown += songListController.GoToNextTab;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-07-24 17:56:30 -04:00
|
|
|
|
backButton.onClick.AddListener(ReturnToChapterSelection);
|
2026-07-21 15:24:42 -04:00
|
|
|
|
|
2026-07-24 17:56:30 -04:00
|
|
|
|
if (enterStoryButton != null)
|
|
|
|
|
|
enterStoryButton.onClick.AddListener(OpenStoryForSelectedSong);
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
|
|
|
|
|
songInfoUI.SetUp();
|
|
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
2026-07-24 17:56:30 -04:00
|
|
|
|
private void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
backButton.onClick.RemoveListener(ReturnToChapterSelection);
|
|
|
|
|
|
|
|
|
|
|
|
if (enterStoryButton != null)
|
|
|
|
|
|
enterStoryButton.onClick.RemoveListener(OpenStoryForSelectedSong);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 选曲页的全局返回语义固定为回到章节选择页。
|
|
|
|
|
|
/// 即使本次页面最初由 Story SongBlock 打开,也不再把 Back 视为“返回剧情树”;
|
|
|
|
|
|
/// 玩家需要使用专门的 <see cref="enterStoryButton"/> 进入剧情。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void ReturnToChapterSelection()
|
|
|
|
|
|
{
|
|
|
|
|
|
FadeOut();
|
|
|
|
|
|
SongSelectionManager.instance.StopPreviewSong();
|
|
|
|
|
|
|
|
|
|
|
|
// Story SongBlock 入口上下文只服务于一次“进入游戏后返回剧情”的流程。
|
|
|
|
|
|
// 玩家主动离开选曲页时必须清除它,避免之后普通选曲误继承旧的目标歌曲与返回目的地。
|
|
|
|
|
|
InformationTransistor.instance?.storySongEntryContext?.Clear();
|
|
|
|
|
|
MenuManager.instance.chapterSelectionUIPage.FadeIn();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从选曲页打开当前章节的剧情树。若当前歌曲在 StoryData 中存在对应 SongBlock,
|
|
|
|
|
|
/// StoryManager 会把视口定位到该 Block;未选中歌曲或没有对应 Block 时则显示剧情开头。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OpenStoryForSelectedSong()
|
|
|
|
|
|
{
|
|
|
|
|
|
ChapterSelectionUnit chapter = ChapterSelectionManager.instance?.currentChapter;
|
|
|
|
|
|
StoryManager.instance?.TryOpenStoryForSong(chapter, selectedSong);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
private void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
Sequence framesSeq = DOTween.Sequence();
|
|
|
|
|
|
framesSeq.Append(DOTween.To(() => framePositionOffset, x => framePositionOffset = x, 1f, 1f)
|
|
|
|
|
|
.SetEase(Ease.Linear)
|
|
|
|
|
|
.OnUpdate(() => backgroundFrames.Offset = framePositionOffset));
|
|
|
|
|
|
framesSeq.AppendInterval(4f);
|
|
|
|
|
|
framesSeq.SetLoops(-1, LoopType.Restart);
|
|
|
|
|
|
framesSeq.Play();
|
2025-06-14 14:42:49 -04:00
|
|
|
|
}
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
public partial class SongSelectionUIPage
|
|
|
|
|
|
{
|
|
|
|
|
|
public SongItemData selectedSong;
|
|
|
|
|
|
public DifficultyData selectedDifficulty;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
public SongStatusSave selectedSave;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
}
|
2026-07-18 16:51:18 -04:00
|
|
|
|
}
|