using Newtonsoft.Json;
using RhythmBase.Converters;
namespace RhythmBase.Components
{
///
/// Level settings.
///
public class Settings
{
private int[] rankMaxMistakes = new int[4];
private string[] rankDescription = ["", "", "", "", "", ""];
///
/// Level settings.
///
public Settings()
{
Version = 61;
Artist = "";
Song = "";
SpecialArtistType = SpecialArtistTypes.None;
ArtistPermission = "";
ArtistLinks = "";
Author = "";
Difficulty = DifficultyLevel.Medium;
SeizureWarning = false;
PreviewImage = "";
SyringeIcon = "";
PreviewSong = "";
Description = "";
Tags = "";
Separate2PLevelFilename = "";
CanBePlayedOn = LevelPlayedMode.OnePlayerOnly;
FirstBeatBehavior = FirstBeatBehaviors.RunNormally;
MultiplayerAppearance = MultiplayerAppearances.HorizontalStrips;
LevelVolume = 1f;
}
///
/// The version number of the level.
/// The minimum level version number supported by this library is 55.
///
public int Version { get; set; }
///
/// Song artist.
///
public string Artist { get; set; }
///
/// Song name.
///
public string Song { get; set; }
///
/// Special artist type.
///
public SpecialArtistTypes SpecialArtistType { get; set; }
///
/// File path for proof of artist's permission.
///
public string ArtistPermission { get; set; }
///
/// Artist links.
///
public string ArtistLinks { get; set; }
///
/// Level author.
///
public string Author { get; set; }
///
/// Level difficulty.
///
public DifficultyLevel Difficulty { get; set; }
///
/// Show seizure warning.
///
public bool SeizureWarning { get; set; }
///
/// Preview image file path.
///
public string PreviewImage { get; set; }
///
/// Syringe packaging image file path.
///
public string SyringeIcon { get; set; }
///
/// The file path of the music used for previewing.
///
public string PreviewSong { get; set; }
///
/// Start time of preview music.
///
[JsonConverter(typeof(SecondConverter))]
public TimeSpan PreviewSongStartTime { get; set; }
///
/// Duration of preview music.
///
[JsonConverter(typeof(SecondConverter))]
public TimeSpan PreviewSongDuration { get; set; }
///
/// Hue offset or grayscale of the level name on the syringe.
///
[JsonProperty("songNameHue")]
public float SongNameHueOrGrayscale { get; set; }
///
/// Whether grayscale is enabled.
///
public bool SongLabelGrayscale { get; set; }
///
/// Level description.
///
public string Description { get; set; }
///
/// Level tags.
///
public string Tags { get; set; }
///
/// Separate two-player level file paths.
/// It is uncertain if this attribute is still being used.
///
public string Separate2PLevelFilename { get; set; }
///
/// Level play mode.
///
public LevelPlayedMode CanBePlayedOn { get; set; }
///
/// Behavior of the first beat of the level.
///
public FirstBeatBehaviors FirstBeatBehavior { get; set; }
///
/// Appearance of the level in multiplayer mode.
///
public MultiplayerAppearances MultiplayerAppearance { get; set; }
///
/// A percentage value indicating the total volume of the level.
///
public float LevelVolume { get; set; }
///
/// Maximum number of mistakes per rank.
///
public int[] RankMaxMistakes
{
get => rankMaxMistakes;
set => rankMaxMistakes = value.Length == 4 ? value : throw new RhythmBase.Exceptions.RhythmBaseException();
}
///
/// Description of each rank.
///
public string[] RankDescription
{
get => rankDescription;
set => rankDescription = value.Length == 6 ? value : throw new RhythmBase.Exceptions.RhythmBaseException();
}
///
/// Mods enabled for the level.
///
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List Mods { get; set; } = [];
///
/// Difficulty level of the level.
///
public enum DifficultyLevel
{
///
/// Easy difficulty.
///
Easy,
///
/// Medium difficulty.
///
Medium,
///
/// Tough difficulty.
///
Tough,
///
/// Very tough difficulty.
///
VeryTough
}
///
/// Play mode of the level.
///
public enum LevelPlayedMode
{
///
/// Can be played by one player only.
///
OnePlayerOnly,
///
/// Can be played by two players only.
///
TwoPlayerOnly,
///
/// Can be played in both one-player and two-player modes.
///
BothModes
}
///
/// Behavior of the first beat of the level.
///
public enum FirstBeatBehaviors
{
///
/// Run normally.
///
RunNormally,
///
/// Run events on prebar.
///
RunEventsOnPrebar
}
///
/// Appearance of the level in multiplayer mode.
///
public enum MultiplayerAppearances
{
///
/// Horizontal strips appearance.
///
HorizontalStrips,
///
/// No special appearance.
///
Nothing
}
}
}