summaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/main_menu.gd16
-rw-r--r--client/menu/main_menu.tscn8
2 files changed, 23 insertions, 1 deletions
diff --git a/client/menu/main_menu.gd b/client/menu/main_menu.gd
index 28629e0d..168eda7e 100644
--- a/client/menu/main_menu.gd
+++ b/client/menu/main_menu.gd
@@ -20,6 +20,7 @@ extends Control
@onready var quit_button = $side/margin/options/quit
@onready var connect_uri = $side/margin/options/connect/uri
+@onready var server_button = $side/margin/options/server
func _ready():
if OS.has_feature("web"):
@@ -58,3 +59,18 @@ func _on_change_character_pressed():
func _on_settings_pressed():
menu_manager.goto("settings")
+
+func _on_server_pressed():
+ match Server.state:
+ Server.State.RUNNING: Server.stop()
+ Server.State.STOPPED: Server.start()
+
+func _process(_delta):
+ server_button.disabled = Server.state != Server.State.RUNNING and Server.state != Server.State.STOPPED
+ server_button.modulate = Color.AQUAMARINE if Server.state == Server.State.RUNNING else Color.WHITE
+ match Server.state:
+ Server.State.RUNNING: server_button.text = tr("Stop Server")
+ Server.State.TESTING: server_button.text = tr("Server (Testing)")
+ Server.State.STARTING: server_button.text = tr("Server is starting...")
+ Server.State.STOPPED: server_button.text = tr("Start Server")
+ Server.State.UNAVAILABLE: server_button.text = tr("Server (Unavailable)"); server_button.tooltip_text = tr("Server binary was not found. Please install the server seperately.")
diff --git a/client/menu/main_menu.tscn b/client/menu/main_menu.tscn
index 361be363..32a55276 100644
--- a/client/menu/main_menu.tscn
+++ b/client/menu/main_menu.tscn
@@ -2,7 +2,7 @@
[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_nlcpo"]
[ext_resource type="Script" path="res://menu/main_menu.gd" id="2_qot2j"]
-[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_k58q5"]
+[ext_resource type="Material" path="res://menu/theme/dark_blur_material.tres" id="3_k58q5"]
[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="4_mfs30"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ukani"]
@@ -81,6 +81,11 @@ layout_mode = 2
text = "Settings"
alignment = 0
+[node name="server" type="Button" parent="side/margin/options"]
+layout_mode = 2
+text = "Server"
+alignment = 0
+
[node name="credits" type="Button" parent="side/margin/options"]
layout_mode = 2
text = "Credits"
@@ -95,5 +100,6 @@ alignment = 0
[connection signal="pressed" from="side/margin/options/connect/connect" to="." method="_on_connect_pressed"]
[connection signal="pressed" from="side/margin/options/change_character" to="." method="_on_change_character_pressed"]
[connection signal="pressed" from="side/margin/options/settings" to="." method="_on_settings_pressed"]
+[connection signal="pressed" from="side/margin/options/server" to="." method="_on_server_pressed"]
[connection signal="pressed" from="side/margin/options/credits" to="." method="_on_credits_pressed"]
[connection signal="pressed" from="side/margin/options/quit" to="." method="_on_quit_pressed"]