Mockup of load / save menu

main
copygirl 6 months ago
parent d6696fa701
commit afe534376d
  1. 38
      ui/LoadSaveMenu.cs
  2. 119
      ui/menu.tscn

@ -0,0 +1,38 @@
public partial class LoadSaveMenu : MarginContainer
{
const string SAVES_FOLDER = "user://saves/";
[Export] public FileDialog LoadFileDialog { get; set; }
[Export] public FileDialog SaveFileDialog { get; set; }
public override void _EnterTree()
{
DirAccess.MakeDirAbsolute(SAVES_FOLDER);
LoadFileDialog.RootSubfolder = SAVES_FOLDER;
SaveFileDialog.RootSubfolder = SAVES_FOLDER;
}
public void OnLoadPressed()
{
LoadFileDialog.Popup();
}
public void OnOverwriteSavePressed()
{
}
public void OnCreateSavePressed()
{
SaveFileDialog.Popup();
}
public void OnLoadFileDialogSelected(string path)
{
}
public void OnSaveFileDialogSelected(string path)
{
}
}

@ -1,6 +1,7 @@
[gd_scene load_steps=12 format=3 uid="uid://c5ooi36ibspfo"] [gd_scene load_steps=13 format=3 uid="uid://c5ooi36ibspfo"]
[ext_resource type="Script" path="res://ui/Menu.cs" id="1_5qxrt"] [ext_resource type="Script" path="res://ui/Menu.cs" id="1_5qxrt"]
[ext_resource type="Script" path="res://ui/LoadSaveMenu.cs" id="2_0yqy1"]
[ext_resource type="Script" path="res://ui/MultiplayerMenu.cs" id="2_3ulcb"] [ext_resource type="Script" path="res://ui/MultiplayerMenu.cs" id="2_3ulcb"]
[ext_resource type="Script" path="res://ui/ControlsMenu.cs" id="3_jnj0g"] [ext_resource type="Script" path="res://ui/ControlsMenu.cs" id="3_jnj0g"]
@ -62,50 +63,125 @@ columns = 2
custom_minimum_size = Vector2(160, 0) custom_minimum_size = Vector2(160, 0)
layout_mode = 2 layout_mode = 2
[node name="Gameplay" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] [node name="LoadSave" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2 layout_mode = 2
toggle_mode = true disabled = true
text = "Gameplay" text = "Load / Save"
[node name="Multiplayer" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] [node name="Multiplayer" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2 layout_mode = 2
toggle_mode = true
text = "Multiplayer" text = "Multiplayer"
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
custom_minimum_size = Vector2(0, 40)
layout_mode = 2
text = "Options"
horizontal_alignment = 1
vertical_alignment = 2
[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2
[node name="Gameplay" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2
text = "Gameplay"
[node name="Controls" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] [node name="Controls" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2 layout_mode = 2
toggle_mode = true
text = "Controls" text = "Controls"
[node name="Graphics" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] [node name="Graphics" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2 layout_mode = 2
toggle_mode = true
text = "Graphics" text = "Graphics"
[node name="Audio" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"] [node name="Audio" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/SideButtons"]
layout_mode = 2 layout_mode = 2
toggle_mode = true
text = "Audio" text = "Audio"
[node name="TabContainer" type="TabContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"] [node name="TabContainer" type="TabContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer"]
custom_minimum_size = Vector2(400, 300) custom_minimum_size = Vector2(400, 300)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
current_tab = 1
tabs_visible = false tabs_visible = false
use_hidden_tabs_for_min_size = true use_hidden_tabs_for_min_size = true
[node name="Gameplay" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"] [node name="LoadSave" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("LoadFileDialog", "SaveFileDialog")]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = ExtResource("2_0yqy1")
LoadFileDialog = NodePath("LoadFileDialog")
SaveFileDialog = NodePath("SaveFileDialog")
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Gameplay"] [node name="LoadFileDialog" type="FileDialog" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave"]
title = "Open a File"
initial_position = 2
size = Vector2i(480, 400)
popup_window = true
ok_button_text = "Open"
file_mode = 0
access = 1
use_native_dialog = true
[node name="SaveFileDialog" type="FileDialog" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave"]
initial_position = 2
size = Vector2i(480, 400)
popup_window = true
ok_button_text = "Save"
access = 1
use_native_dialog = true
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave"]
layout_mode = 2 layout_mode = 2
text = "Gameplay
(nothing here yet)" [node name="Load" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer"]
layout_mode = 2
text = "Load existing Save File"
[node name="GridContainer" type="GridContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer"]
layout_mode = 2
columns = 2
[node name="Label1" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/GridContainer"]
custom_minimum_size = Vector2(112, 0)
layout_mode = 2
text = "Filename: "
horizontal_alignment = 2
[node name="Filename" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "<none>"
label_settings = SubResource("LabelSettings_nmchh")
horizontal_alignment = 1
text_overrun_behavior = 3
[node name="Label2" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/GridContainer"]
custom_minimum_size = Vector2(112, 0)
layout_mode = 2
text = "Last Saved: "
horizontal_alignment = 2
[node name="LastSaved" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "never"
label_settings = SubResource("LabelSettings_nmchh")
horizontal_alignment = 1 horizontal_alignment = 1
[node name="OverwriteSave" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer"]
layout_mode = 2
disabled = true
text = "Overwrite current Save File"
[node name="CreateSave" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer"]
layout_mode = 2
text = "Create new Save File ..."
[node name="Multiplayer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("StatusLabel", "WhenDisconnected", "AddressInput", "PortInput", "ConnectButton", "HostButton", "WhenServer", "PortDisplay", "WhenConnected", "PlayersLabel", "DisconnectButton")] [node name="Multiplayer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("StatusLabel", "WhenDisconnected", "AddressInput", "PortInput", "ConnectButton", "HostButton", "WhenServer", "PortDisplay", "WhenConnected", "PlayersLabel", "DisconnectButton")]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_constants/margin_left = 8 theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8 theme_override_constants/margin_top = 8
@ -256,6 +332,16 @@ layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Disconnect" text = "Disconnect"
[node name="Gameplay" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer"]
visible = false
layout_mode = 2
[node name="Label" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Gameplay"]
layout_mode = 2
text = "Gameplay
(nothing here yet)"
horizontal_alignment = 1
[node name="Controls" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("DisplayX", "DisplayY", "SliderX", "SliderY", "InvertX", "InvertY")] [node name="Controls" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" node_paths=PackedStringArray("DisplayX", "DisplayY", "SliderX", "SliderY", "InvertX", "InvertY")]
visible = false visible = false
layout_mode = 2 layout_mode = 2
@ -368,6 +454,11 @@ text = "Return to Game
" "
[connection signal="tab_changed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" to="." method="OnTabChanged"] [connection signal="tab_changed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer" to="." method="OnTabChanged"]
[connection signal="file_selected" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/LoadFileDialog" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave" method="OnLoadFileDialogSelected"]
[connection signal="file_selected" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/SaveFileDialog" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave" method="OnSaveFileDialogSelected"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/Load" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave" method="OnLoadPressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/OverwriteSave" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave" method="OnOverwriteSavePressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave/VBoxContainer/CreateSave" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/LoadSave" method="OnCreateSavePressed"]
[connection signal="toggled" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/ShowAddress" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnShowAddressToggled"] [connection signal="toggled" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/ShowAddress" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnShowAddressToggled"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/Connect" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnConnectPressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer/Connect" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnConnectPressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer2/Create" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnHostPressed"] [connection signal="pressed" from="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer/VBoxContainer/WhenDisconnected/HBoxContainer2/Create" to="PanelContainer/MarginContainer/VBoxContainer/GridContainer/TabContainer/Multiplayer" method="OnHostPressed"]

Loading…
Cancel
Save