35 lines
652 B
C#
35 lines
652 B
C#
using Godot;
|
|
using Godot.Collections;
|
|
|
|
[GlobalClass]
|
|
public partial class ChannelPlaylist : Node
|
|
{
|
|
[Export] private Array<AudioStream> playlist;
|
|
[Export] private Array<string> channels;
|
|
[Export] private ChannelSettings channelSettings;
|
|
private int internal_index = 0;
|
|
|
|
public void Play()
|
|
{
|
|
AudioSequencer.Play(channels[internal_index], playlist[internal_index]);
|
|
}
|
|
|
|
public void SetIndex(int index)
|
|
{
|
|
internal_index = index;
|
|
if (internal_index >= playlist.Count)
|
|
{
|
|
internal_index = 0;
|
|
}
|
|
else if (internal_index < 0)
|
|
{
|
|
internal_index = playlist.Count - 1;
|
|
}
|
|
}
|
|
|
|
public void Next()
|
|
{
|
|
SetIndex(internal_index + 1);
|
|
}
|
|
|
|
}
|