35 lines
1.5 KiB
C#
35 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.Menu.UI
|
|
{
|
|
public class SongSelectionTabUI : MonoBehaviour
|
|
{
|
|
public SongItemData connectedSong;
|
|
public TMP_Text songNameText;
|
|
public Button switchDifficultyButton;
|
|
public string currentDifficultyName;
|
|
|
|
public void SetUpTab(SongItemData song)
|
|
{
|
|
connectedSong = song;
|
|
songNameText.text = song.songName;
|
|
currentDifficultyName = song.difficultyDataList[0].difficultyName;
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().text = currentDifficultyName + " Lv." + song.difficultyDataList[0].difficultyValue;
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().color = song.difficultyDataList[0].color;
|
|
|
|
switchDifficultyButton.onClick.AddListener(() =>
|
|
{
|
|
int currentIndex = song.difficultyDataList.FindIndex(d => d.difficultyName == currentDifficultyName);
|
|
int nextIndex = (currentIndex + 1) % song.difficultyDataList.Count;
|
|
currentDifficultyName = song.difficultyDataList[nextIndex].difficultyName;
|
|
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().text = currentDifficultyName + " Lv." + song.difficultyDataList[nextIndex].difficultyValue;
|
|
switchDifficultyButton.GetComponentInChildren<TMP_Text>().color = song.difficultyDataList[nextIndex].color;
|
|
});
|
|
}
|
|
}
|
|
} |