Audio system and rich text
This commit is contained in:
parent
a6f817efbc
commit
68cafff083
161 changed files with 1605 additions and 255 deletions
35
scripts/audio/ChannelPlaylist.cs
Normal file
35
scripts/audio/ChannelPlaylist.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue