129 lines
3.8 KiB
C#
129 lines
3.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using AK.Wwise;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace Ichni.Menu
|
|
{
|
|
[CreateAssetMenu(fileName = "DefaultChapter", menuName = "Ichni/UI/ChapterSelectionUnit", order = 0)]
|
|
public partial class ChapterSelectionUnit : SerializedScriptableObject
|
|
{
|
|
public string chapterIndex;
|
|
public string chapterName;
|
|
public string chapterSubtitle;
|
|
public Color themeColor;
|
|
public Sprite avatar;
|
|
public Switch chapterSwitch;
|
|
|
|
[Searchable]
|
|
public List<SongItemData> songs = new List<SongItemData>();
|
|
|
|
[Button]
|
|
public void SetUpDefaultDifficulties()
|
|
{
|
|
foreach (SongItemData song in songs)
|
|
{
|
|
if(song.difficultyDataList.All(d => d.difficultyName != "Easy"))
|
|
{
|
|
song.difficultyDataList.Add(new DifficultyData(
|
|
0, "Easy","Easy", 0, "",
|
|
new Color(0f, 0.7f, 0.2f, 1f)));
|
|
}
|
|
|
|
if (song.difficultyDataList.All(d => d.difficultyName != "Hard"))
|
|
{
|
|
song.difficultyDataList.Add(new DifficultyData(
|
|
1,"Hard", "Hard", 0, "",
|
|
new Color(1f, 0.2f, 0.2f, 1f)));
|
|
}
|
|
}
|
|
}
|
|
|
|
[Button]
|
|
public void SelectSwitch()
|
|
{
|
|
MenuAudioManager.instance.audioContainer.SetSwitch(chapterSwitch);
|
|
}
|
|
}
|
|
|
|
public partial class ChapterSelectionUnit
|
|
{
|
|
public List<string> GetRelatedSongNamesOfUnlockKey(string key)
|
|
{
|
|
return (from song in songs where song.storyUnlockKey == key select song.songName).ToList();
|
|
}
|
|
}
|
|
|
|
[InlineProperty]
|
|
[Serializable]
|
|
public class SongItemData
|
|
{
|
|
[FoldoutGroup("$songName", false)]
|
|
public string songName;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string displaySongName;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string composer;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public Switch songSwitch;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public Sprite illustration;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string illustratorName;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string additionalInformation;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public List<DifficultyData> difficultyDataList;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string storyUnlockKey;
|
|
|
|
[FoldoutGroup("$songName")]
|
|
public string paymentUnlockKey;
|
|
}
|
|
|
|
[Serializable]
|
|
public class DifficultyData
|
|
{
|
|
public int difficultyIndex;
|
|
public string difficultyName;
|
|
public string displayDifficultyName;
|
|
public int difficultyValue;
|
|
public string charterName;
|
|
public Color color;
|
|
public bool isAvailable;
|
|
|
|
public DifficultyData()
|
|
{
|
|
|
|
}
|
|
|
|
public DifficultyData(int difficultyIndex, string difficultyName, string displayDifficultyName, int difficultyValue, string charterName, Color color)
|
|
{
|
|
this.difficultyIndex = difficultyIndex;
|
|
this.difficultyName = difficultyName;
|
|
this.displayDifficultyName = displayDifficultyName;
|
|
this.charterName = charterName;
|
|
this.difficultyValue = difficultyValue;
|
|
this.color = color;
|
|
this.isAvailable = true;
|
|
}
|
|
|
|
public string GetDifficultyName()
|
|
{
|
|
return string.IsNullOrEmpty(displayDifficultyName) ? difficultyName : displayDifficultyName;
|
|
}
|
|
}
|
|
}
|