Initial Android commit
This commit is contained in:
commit
1e2b80c13d
8521 changed files with 231475 additions and 0 deletions
39
scripts/CustomControls/GalleryMusicPlayer.gd
Normal file
39
scripts/CustomControls/GalleryMusicPlayer.gd
Normal file
|
@ -0,0 +1,39 @@
|
|||
extends Control
|
||||
|
||||
onready var playIcon = preload("res://resources/graphics/GUI/Gallery/Play.webp")
|
||||
onready var stopIcon = preload("res://resources/graphics/GUI/Gallery/Stop.webp")
|
||||
|
||||
var musicPath;
|
||||
var unlocked;
|
||||
var state = false;
|
||||
signal PlayerStarted;
|
||||
|
||||
func Init(object, index:int):
|
||||
state = false
|
||||
var name = object["name"];
|
||||
unlocked = GallerySingleton.HaveMusic(name)
|
||||
if unlocked:
|
||||
$Label.text = str("%02d" % index, " ", name);
|
||||
musicPath = object["path"];
|
||||
else :
|
||||
$Label.text = tr("ui_gallery_locked");
|
||||
|
||||
func _on_Button_pressed():
|
||||
if not unlocked:
|
||||
return ;
|
||||
state = not state;
|
||||
DrawButtonIcon();
|
||||
emit_signal("PlayerStarted");
|
||||
|
||||
func DrawButtonIcon():
|
||||
if state:
|
||||
$Button.icon = stopIcon;
|
||||
else :
|
||||
$Button.icon = playIcon;
|
||||
|
||||
func GetAudioStream()->AudioStream:
|
||||
if not ResourceLoader.exists(musicPath):
|
||||
return null
|
||||
|
||||
var stream = load(musicPath);
|
||||
return stream;
|
Loading…
Add table
Add a link
Reference in a new issue