Skip to content

SongSelect

namespace Griff.Modules.Rhythm;
public sealed class SongSelect : Component, IPlaytestReport

A rhythm game’s song select, with no code: the player moves up and down its songs’ cards (the entity’s children, in order, one for each of its Songs), left and right through the difficulties, hears each song as it’s picked out, and plays it with a press (or a click or a tap on its card); the song and difficulty are kept in the save data and Scene loads, where NoteLanes with a Saved Song and Saved Difficulty play them. What it says about the song picked out (its title, difficulty, notes, best score and grade) are outputs for texts to show.

A song’s chart is the table named like it (Music/First Light.wav plays the First Light table), and its best score is the one the lanes kept under BestFrom (their Save Best As). Up and down (the arrows, W and S, the D-pad or the stick) move between the songs and left and right between the difficulties; Space, Enter or the gamepad’s A (its PlayActions) play; Esc, Backspace or B go Back. A click or tap on a card picks it out, and another on the one picked out plays it. Its Cursor is moved over the card picked out.

This is a component: its saved properties are on its component page.

public string? Back { get; set; }

The scene Back (Esc, Backspace or the gamepad’s B) goes to, e.g. the title. Empty: Back does nothing here.

public int Best { get; }

The best score kept for the song picked out at the difficulty picked out (0 before it’s been played).

public string? BestFrom { get; set; }

The name the lanes keep their best scores under (their Save Best As), to show each song’s best: “Best”.

public string BestGrade { get; }

The grade of that best score: “S”, “A”… (empty before it’s been played).

public bool Clicks { get; set; }

A click or a tap on a card picks it out, and another on the card picked out plays it.

public bool Controllable { get; set; }

Untick it to ignore the player’s keys, clicks and gamepad (its actions still work). Its Focus action ticks it and unticks it on everything else the player plays.

public string? Cursor { get; set; }

What’s moved over the card picked out, by name.

public float Delay { get; set; }

Seconds after a song is picked before its scene loads, to hear the pick.

public IReadOnlyList<string> Difficulties { get; set; }

The difficulties to pick from, easiest first: the names the charts’ Difficulty column uses.

public string Difficulty { get; }

The difficulty picked out: “Normal”.

public int DifficultyIndex { get; set; }

The difficulty picked out, from 0 (Easy). Set by the game.

public int Index { get; set; }

The song picked out, from 0. Set by the game (and as it starts, to the one saved last).

public string? MoveSound { get; set; }

A sound played as the song or difficulty picked out changes.

public int Notes { get; }

How many notes the song picked out has at the difficulty picked out.

public string? PickSound { get; set; }

A sound played as a song is played.

public bool Picked { get; set; }

True once a song’s been picked to play: its scene loads after Delay. Set by the game.

public string? PlayActions { get; set; }

The input actions that play the song picked out, separated by commas: Jump is Space and the gamepad’s A, Interact Enter and E.

public bool Preview { get; set; }

Plays the song picked out, from PreviewFrom, over and over while it’s picked out.

public float PreviewFrom { get; set; }

Seconds into each song its preview starts.

public float PreviewVolume { get; set; }

How loud the preview plays, 0 to 1, on top of the player’s music volume.

public string? SaveAs { get; set; }

A name to keep the song picked under in the save data, e.g. “Song”: a Note Lanes’ Saved Song.

public string? SaveDifficultyAs { get; set; }

A name to keep the difficulty picked under in the save data, e.g. “Difficulty”: a Note Lanes’ Saved Difficulty.

public string? Scene { get; set; }

The scene to load as a song is picked, e.g. “Play”: its Note Lanes play what was picked.

public IReadOnlyList<string> Songs { get; set; }

The songs to pick from, in the order of its cards, e.g. “Music/First Light.wav”. Each one’s chart is the table named like it.

public float Timer { get; set; }

Seconds until the song’s scene loads, once it’s been picked. Set by the game.

public string Title { get; }

The song picked out’s title: its file’s name (“First Light”), which its chart is named.

public IReadOnlyList<string> Titles { get; }

Its songs’ titles, one by one, in the order of its Songs.

public int BestOf(string song)

The best score kept for a song at the difficulty picked out, by its title or path: “Best Score:First Light”.

public string GradeOf(string song)

The grade of the best score kept for a song at the difficulty picked out, by its title or path: “Grade:First Light”, for a badge on its card. Empty before it’s been played.

public int IndexOf(string? song)

Which of its songs song (a title or a path) is, from 0; -1 if it isn’t one.

public void Next()

Picks out the next song down (round to the first after the last).

public void NextDifficulty()

Picks out the next difficulty, a step harder (stopping at the hardest).

public void Pick(string song)

Picks out the song called song (its title or path) and plays it, as a click on its card twice does.

public void Play()

Plays the song picked out, at the difficulty picked out.

public void Previous()

Picks out the song before (round to the last before the first).

public void PreviousDifficulty()

Picks out the difficulty a step easier (stopping at the easiest).

public static string TitleOf(string? song)

The title a song’s path gives: “Music/First Light.wav” (and “First Light”) is First Light.

public override bool Uses(string property)
public event Action<SongSelect>? Played

Raised as a song is picked to play.