Saving some parameters
This commit is contained in:
parent
58509c217b
commit
48a22dd956
13 changed files with 73 additions and 14 deletions
|
|
@ -27,8 +27,9 @@ config/windows_native_icon="res://icon.ico"
|
||||||
LevelController="*res://scripts/LevelController.cs"
|
LevelController="*res://scripts/LevelController.cs"
|
||||||
Cursor="*res://scripts/Cursor.cs"
|
Cursor="*res://scripts/Cursor.cs"
|
||||||
GameRegistry="*res://scripts/systems/GameRegistry.cs"
|
GameRegistry="*res://scripts/systems/GameRegistry.cs"
|
||||||
Cheats="*res://scripts/debug/Cheats.cs"
|
Cheats="res://scripts/debug/Cheats.cs"
|
||||||
AudioSequencer="*res://scenes/audio_sequencer.tscn"
|
AudioSequencer="*res://scenes/audio_sequencer.tscn"
|
||||||
|
SettingsSerializer="*res://scripts/SettingsSerializer.cs"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_jk1qb"]
|
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_jk1qb"]
|
||||||
[ext_resource type="Script" uid="uid://drru785m4eep" path="res://scripts/gui/main_menu_rich_text.gd" id="2_5dd4i"]
|
[ext_resource type="Script" uid="uid://drru785m4eep" path="res://scripts/gui/main_menu_rich_text.gd" id="2_5dd4i"]
|
||||||
[ext_resource type="Script" uid="uid://dgevhrbucpwrs" path="res://scripts/gui/prototype_window.gd" id="2_lgwnu"]
|
[ext_resource type="Script" uid="uid://cghu4i3bnyavg" path="res://scripts/gui/PrototypeWindow.cs" id="2_flqon"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c37pvdhol2x02" path="res://assets/sprites/menu_bg.png" id="3_lgwnu"]
|
[ext_resource type="Texture2D" uid="uid://c37pvdhol2x02" path="res://assets/sprites/menu_bg.png" id="3_lgwnu"]
|
||||||
[ext_resource type="Theme" uid="uid://btulhvgwclket" path="res://resources/themes/MainMenu.tres" id="4_flqon"]
|
[ext_resource type="Theme" uid="uid://btulhvgwclket" path="res://resources/themes/MainMenu.tres" id="4_flqon"]
|
||||||
[ext_resource type="Script" uid="uid://c06k4k3ww48ev" path="res://scripts/gui/menu_buttons.gd" id="5_rcqid"]
|
[ext_resource type="Script" uid="uid://c06k4k3ww48ev" path="res://scripts/gui/menu_buttons.gd" id="5_rcqid"]
|
||||||
|
|
@ -63,7 +63,7 @@ borderless = true
|
||||||
theme_override_styles/panel = SubResource("StyleBoxTexture_jl0ue")
|
theme_override_styles/panel = SubResource("StyleBoxTexture_jl0ue")
|
||||||
ok_button_text = "close"
|
ok_button_text = "close"
|
||||||
dialog_close_on_escape = false
|
dialog_close_on_escape = false
|
||||||
script = ExtResource("2_lgwnu")
|
script = ExtResource("2_flqon")
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="PrototypeWindow"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="PrototypeWindow"]
|
||||||
offset_left = 6.0
|
offset_left = 6.0
|
||||||
|
|
@ -151,6 +151,10 @@ offset_bottom = 235.0
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "about"
|
text = "about"
|
||||||
|
|
||||||
|
[node name="SplashButton" type="Button" parent="Buttons/InfoButtons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "splash"
|
||||||
|
|
||||||
[node name="AlmanachButton" type="Button" parent="Buttons/InfoButtons"]
|
[node name="AlmanachButton" type="Button" parent="Buttons/InfoButtons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
icon = ExtResource("7_flqon")
|
icon = ExtResource("7_flqon")
|
||||||
|
|
@ -207,6 +211,7 @@ script = SubResource("GDScript_flqon")
|
||||||
[connection signal="pressed" from="Buttons/GameButtons/PlayButton" to="Buttons" method="_on_play_button_pressed"]
|
[connection signal="pressed" from="Buttons/GameButtons/PlayButton" to="Buttons" method="_on_play_button_pressed"]
|
||||||
[connection signal="pressed" from="Buttons/GameButtons/ExitButton" to="Buttons" method="_on_exit_button_pressed"]
|
[connection signal="pressed" from="Buttons/GameButtons/ExitButton" to="Buttons" method="_on_exit_button_pressed"]
|
||||||
[connection signal="pressed" from="Buttons/InfoButtons/AboutButton" to="Buttons" method="_on_button_pressed"]
|
[connection signal="pressed" from="Buttons/InfoButtons/AboutButton" to="Buttons" method="_on_button_pressed"]
|
||||||
|
[connection signal="pressed" from="Buttons/InfoButtons/SplashButton" to="Buttons" method="_on_splash_button_pressed"]
|
||||||
[connection signal="pressed" from="Buttons/InfoButtons/AlmanachButton" to="Buttons" method="_on_almanach_button_pressed"]
|
[connection signal="pressed" from="Buttons/InfoButtons/AlmanachButton" to="Buttons" method="_on_almanach_button_pressed"]
|
||||||
[connection signal="close_requested" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_close_requested"]
|
[connection signal="close_requested" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_close_requested"]
|
||||||
[connection signal="confirmed" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_confirmed"]
|
[connection signal="confirmed" from="Buttons/SACRIFICE/CONFIRM" to="Buttons/SACRIFICE" method="_on_confirm_confirmed"]
|
||||||
|
|
|
||||||
43
scripts/SettingsSerializer.cs
Normal file
43
scripts/SettingsSerializer.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
using Godot;
|
||||||
|
using Newlon;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class SettingsSerializer : Node
|
||||||
|
{
|
||||||
|
const string CFG_PATH = "user://config.cfg";
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
GetTree().AutoAcceptQuit = false;
|
||||||
|
if (FileAccess.FileExists(CFG_PATH) == false) return;
|
||||||
|
|
||||||
|
var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Read);
|
||||||
|
|
||||||
|
Utility.SFX = float.Parse(access.GetLine().Split(" ")[1]);
|
||||||
|
Utility.Music = float.Parse(access.GetLine().Split(" ")[1]);
|
||||||
|
Utility.Splash = bool.Parse(access.GetLine().Split(" ")[1]);
|
||||||
|
|
||||||
|
AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Utility.SFX));
|
||||||
|
AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Utility.Music));
|
||||||
|
|
||||||
|
access.Close();
|
||||||
|
}
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Write);
|
||||||
|
access.Resize(0);
|
||||||
|
access.StoreString(string.Format("SFX {0}\nMusic {1}\nSplash {2}\n", Utility.SFX,Utility.Music,Utility.Splash));
|
||||||
|
|
||||||
|
access.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Notification(int what)
|
||||||
|
{
|
||||||
|
if (what == NotificationWMCloseRequest)
|
||||||
|
{
|
||||||
|
_ExitTree();
|
||||||
|
GetTree().Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
1
scripts/SettingsSerializer.cs.uid
Normal file
1
scripts/SettingsSerializer.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bflvotmed7jfy
|
||||||
|
|
@ -31,6 +31,7 @@ public class Utility
|
||||||
|
|
||||||
public static double SFX = 1.0f;
|
public static double SFX = 1.0f;
|
||||||
public static double Music = 1.0f;
|
public static double Music = 1.0f;
|
||||||
|
public static bool Splash = false;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
scripts/gui/PrototypeWindow.cs
Normal file
12
scripts/gui/PrototypeWindow.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using Godot;
|
||||||
|
using Newlon;
|
||||||
|
|
||||||
|
public partial class PrototypeWindow : AcceptDialog
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
if (Utility.Splash) return;
|
||||||
|
Utility.Splash = true;
|
||||||
|
PopupCentered();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scripts/gui/PrototypeWindow.cs.uid
Normal file
1
scripts/gui/PrototypeWindow.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cghu4i3bnyavg
|
||||||
|
|
@ -7,6 +7,7 @@ func _on_play_button_pressed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_exit_button_pressed() -> void:
|
func _on_exit_button_pressed() -> void:
|
||||||
|
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
$ChannelPlayer.call("Play")
|
$ChannelPlayer.call("Play")
|
||||||
|
|
||||||
|
|
@ -15,7 +16,10 @@ func _on_button_pressed() -> void:
|
||||||
$"../AboutWindow".popup_centered()
|
$"../AboutWindow".popup_centered()
|
||||||
$ChannelPlayer.call("Play")
|
$ChannelPlayer.call("Play")
|
||||||
|
|
||||||
|
|
||||||
func _on_almanach_button_pressed() -> void:
|
func _on_almanach_button_pressed() -> void:
|
||||||
$"../Almanach".visible = true
|
$"../Almanach".visible = true
|
||||||
$ChannelPlayer.call("Play")
|
$ChannelPlayer.call("Play")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_splash_button_pressed() -> void:
|
||||||
|
$"../PrototypeWindow".popup_centered()
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
extends AcceptDialog
|
|
||||||
|
|
||||||
static var seen = false
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
if seen:
|
|
||||||
return
|
|
||||||
seen = true
|
|
||||||
popup_centered()
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://dgevhrbucpwrs
|
|
||||||
|
|
@ -53,3 +53,4 @@ close,Close,Закрыть
|
||||||
sfx,SFX,Звуки
|
sfx,SFX,Звуки
|
||||||
music,Music,Музыка
|
music,Music,Музыка
|
||||||
paused,Paused,Игра на паузе
|
paused,Paused,Игра на паузе
|
||||||
|
splash,Splash,Сплэш
|
||||||
|
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue