76 lines
2.8 KiB
C#
76 lines
2.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Ichni.Menu;
|
|
using Ichni.Story;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.UI
|
|
{
|
|
public partial class PrepareUIPage : UIPageBase
|
|
{
|
|
public Button enterGameButton;
|
|
public Button switchDifficultyButton;
|
|
|
|
public string songName;
|
|
public List<string> difficulties;
|
|
public string difficultyName;
|
|
|
|
private ChapterSelectionUnit chapter;
|
|
private SongItemData songItem;
|
|
private DifficultyData difficultyData;
|
|
}
|
|
|
|
public partial class PrepareUIPage
|
|
{
|
|
public void SetUpPrepareUIPage(string songName)
|
|
{
|
|
chapter = ChapterSelectionManager.instance.chapters
|
|
.FirstOrDefault(c => c.chapterIndex == ChapterSelectionManager.instance.currentChapter);
|
|
songItem = chapter.songs.FirstOrDefault(s => s.songName == songName);
|
|
|
|
this.songName = songName;
|
|
this.difficulties = new List<string>();
|
|
foreach (DifficultyData difficulty in songItem.difficultyDataList)
|
|
{
|
|
this.difficulties.Add(difficulty.difficultyName);
|
|
}
|
|
|
|
this.difficultyName = difficulties[0];
|
|
|
|
difficultyData = songItem.difficultyDataList.FirstOrDefault(d => d.difficultyName == difficultyName);
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().text = difficultyName + " Lv." + difficultyData.difficultyValue;
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().color = difficultyData.color;
|
|
}
|
|
|
|
public void SwitchDifficulty()
|
|
{
|
|
int currentIndex = difficulties.IndexOf(difficultyName);
|
|
int nextIndex = (currentIndex + 1) % difficulties.Count;
|
|
difficultyName = difficulties[nextIndex];
|
|
|
|
difficultyData = songItem.difficultyDataList
|
|
.FirstOrDefault(d => d.difficultyName == difficultyName);
|
|
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().text = difficultyName + " Lv." + difficultyData.difficultyValue;
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().color = difficultyData.color;
|
|
}
|
|
|
|
public void EnterGame()
|
|
{
|
|
InformationTransistor.instance.SetInformation(
|
|
ChapterSelectionManager.instance.currentChapter,
|
|
songItem.songName,
|
|
songItem.composer,
|
|
difficultyName,
|
|
songItem.illustratorName,
|
|
difficultyData.displayDifficultyName,
|
|
difficultyData.color, songItem.albumIllustrationCover,
|
|
chapter.chapterSwitch, songItem.songSwitch);
|
|
|
|
MenuManager.instance.TestEnterGame();
|
|
}
|
|
}
|
|
} |