4using System.Collections.Generic;
8#pragma warning disable 0414
16 [CreateAssetMenu(fileName =
"New Radio Data", menuName =
"Ryle Radio/Radio Data")]
26 [SerializeField]
private Color
gizmoColor =
new Color32(200, 180, 255, 255);
38 [SerializeField]
private List<RadioTrackWrapper>
trackWs =
new() {
new() };
51 public Action<RadioData>
OnInit {
get;
set; } =
new(_ => { });
53 public Action<RadioData>
BeforeInit {
get;
set; } =
new(_ => { });
58 private List<string> trackNames;
68 if (trackNames ==
null || trackNames.Count <= 0)
79 public List<string> TrackIDs
99 return _name.Split(
", ")[0];
112 trackNames =
new List<string>();
122 var othersWithID =
trackIDs.Where(t => t == track.
id);
125 if (othersWithID.Count() > 0)
126 track.id += othersWithID.Count();
130 string name = $
"{track.id}, {track.range.x} - {track.range.y}";
133 trackNames.Add(name);
The central data object defining the radio. Contains the tracks and information required to play the ...
List< string > trackIDs
The IDs of all tracks stored in this radio.
int forcedSampleRate
The sample rate this radio can force on AudioClips it references. If left at 0, it chooses the projec...
List< string > TrackNames
The names of all tracks stored in this radio, used when selecting them in the inspector.
Color gizmoColor
The primary colour of gizmos relating to this radio.
void OnValidate()
Updates the track names and IDs when this object is changed.
Action< RadioData > BeforeInit
Event invoked when Init() is called, but at the beginning before anything happens.
static string NameToID(string _name)
Converts a track's name to ID format.
void ClearCache()
Clears track names and IDs.
void Init()
Initialise this radio, its tracks, and referenced components.
Color GizmoColor
Alias for gizmoColor for safety.
Color gizmoColorSecondary
The secondary colour of gizmos relating to this radio.
const float LOW_TUNE
The lower limit for tune on this radio. This may become non-const at some point.
bool TryGetTrack(string _idOrName, out RadioTrackWrapper _trackW, bool _useID=true)
Attempts to find a track in this radio using either an ID or a name.
List< RadioTrackWrapper > trackWs
The tracks contained in this radio, editable in the inspector.
Action< RadioData > OnInit
Event invoked when Init() is called.
const float HIGH_TUNE
The upper limit for tune on this radio. This may become non-const at some point.
bool forceClipSampleRate
Whether or not this radio forces the sample rate on AudioClips it references.
List< RadioTrackWrapper > TrackWrappers
Alias for trackWs for safety- in documentation we usually call them the tracks, but for code clarity ...
void PopulateTrackIDs()
Fills TrackNames and TrackIDs to match the current content of trackWs.
Color GizmoColorSecondary
Alias for gizmoColorSecondary for safety.
A wrapper class for RadioTrack so that track types can be switched between in the inspector!...
string id
The ID of this track- used to find and manipulate it in custom code.
void Init()
Initialize this wrapper and its track.
Base interfaces and classes for components, e.g: track accessors, output accessors.
Tracks to be used on a radio- includes base classes.