save loading
This commit is contained in:
@@ -21,7 +21,7 @@ compress/lossy_quality=0.7
|
|||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
mipmaps/generate=false
|
mipmaps/generate=true
|
||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ compress/lossy_quality=0.7
|
|||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
mipmaps/generate=false
|
mipmaps/generate=true
|
||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://bam5mbsffdryc"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_84l0p"]
|
||||||
|
font_size = 20
|
||||||
|
shadow_size = 2
|
||||||
|
shadow_color = Color(0, 0, 0, 0.564706)
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_24osb"]
|
||||||
|
font_color = Color(0.791999, 0.791999, 0.791999, 1)
|
||||||
|
shadow_size = 2
|
||||||
|
shadow_color = Color(0, 0, 0, 0.564706)
|
||||||
|
|
||||||
|
[node name="SourceDisplay" type="Control"]
|
||||||
|
custom_minimum_size = Vector2(0, 75)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = -572.0
|
||||||
|
offset_bottom = -573.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="Name" type="Label" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 6
|
||||||
|
text = "Name"
|
||||||
|
label_settings = SubResource("LabelSettings_84l0p")
|
||||||
|
clip_text = true
|
||||||
|
text_overrun_behavior = 3
|
||||||
|
|
||||||
|
[node name="Path" type="Label" parent="VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 6
|
||||||
|
text = "Artist"
|
||||||
|
label_settings = SubResource("LabelSettings_24osb")
|
||||||
|
clip_text = true
|
||||||
|
text_overrun_behavior = 3
|
||||||
|
|
||||||
|
[node name="CheckBox" type="CheckBox" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -24.0
|
||||||
|
offset_top = -12.0
|
||||||
|
offset_bottom = 12.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Enabled"
|
||||||
+5
-2
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=17 format=3 uid="uid://mfcbf2sfino6"]
|
[gd_scene load_steps=18 format=3 uid="uid://mfcbf2sfino6"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://0jo87vtoeheu" path="res://Images/pole2.jpg" id="1_6bp64"]
|
[ext_resource type="Texture2D" uid="uid://0jo87vtoeheu" path="res://Images/pole2.jpg" id="1_6bp64"]
|
||||||
[ext_resource type="Texture2D" uid="uid://df2e70jxwrmjs" path="res://Icons/BackOne.png" id="1_8gbba"]
|
[ext_resource type="Texture2D" uid="uid://df2e70jxwrmjs" path="res://Icons/BackOne.png" id="1_8gbba"]
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://cekkhyppj88xi" path="res://Icons/Headphones.png" id="4_kry3j"]
|
[ext_resource type="Texture2D" uid="uid://cekkhyppj88xi" path="res://Icons/Headphones.png" id="4_kry3j"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dds3tnltcg0sg" path="res://Scenes/PerformanceDisplay.tscn" id="5_fdnlq"]
|
[ext_resource type="PackedScene" uid="uid://dds3tnltcg0sg" path="res://Scenes/PerformanceDisplay.tscn" id="5_fdnlq"]
|
||||||
[ext_resource type="Script" uid="uid://ci5h1wwbedkbt" path="res://Scripts/UIManager.cs" id="12_6iyac"]
|
[ext_resource type="Script" uid="uid://ci5h1wwbedkbt" path="res://Scripts/UIManager.cs" id="12_6iyac"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dumymuj4w4si0" path="res://Icons/shuffle.png" id="13_jkdf5"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ch8wymyxftkb3" path="res://Icons/Pause.png" id="14_jkdf5"]
|
[ext_resource type="Texture2D" uid="uid://ch8wymyxftkb3" path="res://Icons/Pause.png" id="14_jkdf5"]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_bo1nx"]
|
[sub_resource type="GDScript" id="GDScript_bo1nx"]
|
||||||
@@ -224,8 +225,10 @@ icon = ExtResource("4_21xkr")
|
|||||||
expand_icon = true
|
expand_icon = true
|
||||||
|
|
||||||
[node name="Shuffle" type="Button" parent="Padding/VBoxContainer/Bottom/HBoxContainer"]
|
[node name="Shuffle" type="Button" parent="Padding/VBoxContainer/Bottom/HBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(42, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "shuffle"
|
icon = ExtResource("13_jkdf5")
|
||||||
|
expand_icon = true
|
||||||
|
|
||||||
[node name="Volume" type="Button" parent="Padding/VBoxContainer/Bottom/HBoxContainer"]
|
[node name="Volume" type="Button" parent="Padding/VBoxContainer/Bottom/HBoxContainer"]
|
||||||
custom_minimum_size = Vector2(42, 0)
|
custom_minimum_size = Vector2(42, 0)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using ATL;
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -12,10 +13,13 @@ public partial class Context : Node
|
|||||||
DirectoryLoader manager = new();
|
DirectoryLoader manager = new();
|
||||||
static public SongPlayer ISongPlayer;
|
static public SongPlayer ISongPlayer;
|
||||||
public event Action<IEnumerable<Song>> SongsUpdated;
|
public event Action<IEnumerable<Song>> SongsUpdated;
|
||||||
|
public SimplaudioSettings Setting;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
Setting = SaveManager.LoadSettings();
|
||||||
|
GD.Print("keys: ", Setting.Sources.Keys);
|
||||||
instance = this;
|
instance = this;
|
||||||
ISongPlayer = new SongPlayer();
|
ISongPlayer = new SongPlayer();
|
||||||
AddChild(ISongPlayer);
|
AddChild(ISongPlayer);
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using DiscordRPC;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
public class SaveManager{
|
||||||
|
const String SaveLocation = "user://Saved.tres";
|
||||||
|
public static SimplaudioSettings LoadSettings(){
|
||||||
|
SimplaudioSettings loaded = GD.Load<SimplaudioSettings>(SaveLocation);
|
||||||
|
if (loaded == null){
|
||||||
|
return new SimplaudioSettings();
|
||||||
|
}
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://vqf4yrwaaggo
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
|
[GlobalClass][Tool]
|
||||||
|
public partial class SimplaudioSettings : Resource{
|
||||||
|
[Export] public bool Shuffled { get; set; }
|
||||||
|
[Export] public Dictionary<String,bool> Sources { get; set; }
|
||||||
|
|
||||||
|
public SimplaudioSettings(){
|
||||||
|
Sources = new Dictionary<String, bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dbelngrrq8x2s
|
||||||
+55
-55
@@ -4,64 +4,64 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
public partial class UIManager : Node{
|
public partial class UIManager : Node{
|
||||||
[Export] Button PlayPauseButton;
|
[Export] Button PlayPauseButton;
|
||||||
[Export] Texture2D PauseImage;
|
[Export] Texture2D PauseImage;
|
||||||
[Export] Texture2D PlayImage;
|
[Export] Texture2D PlayImage;
|
||||||
[Export] HSlider ProgressIndicator;
|
[Export] HSlider ProgressIndicator;
|
||||||
[Export] Button SkipButton;
|
[Export] Button SkipButton;
|
||||||
[Export] Button GoBackButton;
|
[Export] Button GoBackButton;
|
||||||
[Export] Button LoopButton;
|
[Export] Button LoopButton;
|
||||||
[Export] Button RandomizeButton;
|
[Export] Button RandomizeButton;
|
||||||
|
|
||||||
bool SliderDragging;
|
bool SliderDragging;
|
||||||
|
|
||||||
static UIManager instance;
|
static UIManager instance;
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
base._Ready();
|
base._Ready();
|
||||||
instance = this;
|
instance = this;
|
||||||
ProgressIndicator.DragStarted += sliderDrag;
|
ProgressIndicator.DragStarted += sliderDrag;
|
||||||
ProgressIndicator.DragEnded += sliderDragEnded;
|
ProgressIndicator.DragEnded += sliderDragEnded;
|
||||||
PlayPauseButton.Toggled += PausePlay;
|
PlayPauseButton.Toggled += PausePlay;
|
||||||
Context.ISongPlayer.SongStateUpdated += UpdatePausePlay;
|
Context.ISongPlayer.SongStateUpdated += UpdatePausePlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PausePlay(bool Newstate){
|
void PausePlay(bool Newstate){
|
||||||
if (Newstate){
|
if (Newstate){
|
||||||
Context.ISongPlayer.PauseSong();
|
Context.ISongPlayer.PauseSong();
|
||||||
PlayPauseButton.Icon = PlayImage;
|
PlayPauseButton.Icon = PlayImage;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Context.ISongPlayer.UnpauseSong();
|
Context.ISongPlayer.UnpauseSong();
|
||||||
PlayPauseButton.Icon = PauseImage;
|
PlayPauseButton.Icon = PauseImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePausePlay(bool paused){
|
void UpdatePausePlay(bool paused){
|
||||||
if (paused){
|
if (paused){
|
||||||
PlayPauseButton.Icon = PlayImage;
|
PlayPauseButton.Icon = PlayImage;
|
||||||
PlayPauseButton.ButtonPressed = true;
|
PlayPauseButton.ButtonPressed = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
PlayPauseButton.Icon = PauseImage;
|
PlayPauseButton.Icon = PauseImage;
|
||||||
PlayPauseButton.ButtonPressed = false;
|
PlayPauseButton.ButtonPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
base._Process(delta);
|
base._Process(delta);
|
||||||
if (!SliderDragging){
|
if (!SliderDragging){
|
||||||
ProgressIndicator.Value = Context.ISongPlayer.GetPosition();
|
ProgressIndicator.Value = Context.ISongPlayer.GetPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sliderDrag(){
|
void sliderDrag(){
|
||||||
SliderDragging = true;
|
SliderDragging = true;
|
||||||
}
|
}
|
||||||
void sliderDragEnded(bool changed){
|
void sliderDragEnded(bool changed){
|
||||||
SliderDragging = false;
|
SliderDragging = false;
|
||||||
|
|
||||||
Context.ISongPlayer.SetPosition((float)ProgressIndicator.Value);
|
Context.ISongPlayer.SetPosition((float)ProgressIndicator.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[gd_resource type="Resource" script_class="SimplaudioSettings" load_steps=2 format=3 uid="uid://dn1yyh3jwlvf5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dbelngrrq8x2s" path="res://Scripts/SimplaudioSettings.cs" id="1_by5j6"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_by5j6")
|
||||||
|
Shuffled = false
|
||||||
|
Sources = {
|
||||||
|
"Cogs": true,
|
||||||
|
"dafdaf": true,
|
||||||
|
"dfagg": false
|
||||||
|
}
|
||||||
|
metadata/_custom_type_script = "uid://dbelngrrq8x2s"
|
||||||
Reference in New Issue
Block a user