Audio system and rich text
This commit is contained in:
parent
a6f817efbc
commit
68cafff083
161 changed files with 1605 additions and 255 deletions
43
scripts/audio/AudioSlider.cs
Normal file
43
scripts/audio/AudioSlider.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
|
||||
public partial class AudioSlider : HSlider
|
||||
{
|
||||
enum TYPE
|
||||
{
|
||||
SFX,
|
||||
MUSIC
|
||||
}
|
||||
|
||||
[Export] private TYPE affects;
|
||||
public override void _Ready()
|
||||
{
|
||||
DragEnded += OnDragEnded;
|
||||
if (affects == TYPE.SFX)
|
||||
{
|
||||
SetValueNoSignal(Utility.SFX);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetValueNoSignal(Utility.Music);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDragEnded(bool hasChanged)
|
||||
{
|
||||
if (hasChanged)
|
||||
{
|
||||
if (affects == TYPE.SFX)
|
||||
{
|
||||
Utility.SFX = Value;
|
||||
AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
Utility.Music = Value;
|
||||
AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue