Class Jukebox
Provides managed access to a placed native jukebox.
public sealed class Jukebox
- Inheritance
-
Jukebox
- Inherited Members
- Extension Methods
Remarks
This wrapper exposes only tracks configured by the game. Controls use the native jukebox methods, including its existing authority, replication, and persistence behavior.
Properties
CurrentTrack
Gets the current native track, or null when none is selected.
public JukeboxTrack? CurrentTrack { get; }
Property Value
CurrentTrackOrderIndex
Gets the current position in the native playback queue.
public int CurrentTrackOrderIndex { get; }
Property Value
CurrentTrackTime
Gets the elapsed time of the current track in seconds.
public float CurrentTrackTime { get; }
Property Value
GUID
Gets the placed-object identifier assigned by the game.
public string GUID { get; }
Property Value
GameObject
Gets the game object that owns the native jukebox.
public GameObject GameObject { get; }
Property Value
- GameObject
IsPlaying
Gets whether the jukebox is playing.
public bool IsPlaying { get; }
Property Value
NormalizedVolume
Gets the native volume normalized by the game's maximum volume.
public float NormalizedVolume { get; }
Property Value
RepeatMode
Gets the native repeat mode.
public JukeboxRepeatMode RepeatMode { get; }
Property Value
Shuffle
Gets whether the native playback queue is shuffled.
public bool Shuffle { get; }
Property Value
State
Gets an immutable snapshot of the jukebox's current state.
public JukeboxState State { get; }
Property Value
Sync
Gets whether the jukebox synchronizes with other native jukeboxes.
public bool Sync { get; }
Property Value
Tracks
Gets an immutable snapshot of tracks configured on this jukebox.
public IReadOnlyList<JukeboxTrack> Tracks { get; }
Property Value
Volume
Gets the current native volume value.
public int Volume { get; }
Property Value
Methods
ChangeVolume(int)
Changes the volume using the native jukebox control.
public void ChangeVolume(int change)
Parameters
changeintThe change to apply to the current native volume, which the game clamps from 0 through 8.
FromGameObject(GameObject)
Gets the jukebox component on a game object.
public static Jukebox? FromGameObject(GameObject gameObject)
Parameters
gameObjectGameObjectThe game object to inspect.
Returns
Exceptions
- ArgumentNullException
gameObjectisnullor destroyed.
NextTrack()
Selects the next track using the native jukebox control.
public void NextTrack()
PreviousTrack()
Selects the previous track using the native jukebox control.
public void PreviousTrack()
SelectTrack(int)
Selects a configured native track.
public void SelectTrack(int trackIndex)
Parameters
Exceptions
- ArgumentOutOfRangeException
trackIndexdoes not identify a configured track.
SetVolume(int)
Sets the volume and requests native replication.
public void SetVolume(int volume)
Parameters
volumeintThe native volume value to set. The game clamps the value from 0 through 8.
TogglePlay()
Toggles playback using the native jukebox control.
public void TogglePlay()
ToggleRepeatMode()
Cycles the native repeat mode.
public void ToggleRepeatMode()
ToggleShuffle()
Toggles native queue shuffling.
public void ToggleShuffle()
ToggleSync()
Toggles native jukebox synchronization.
public void ToggleSync()
Events
OnStateChanged
Occurs when the native jukebox reports a state change.
public event Action<JukeboxState> OnStateChanged