diff options
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/play.gd | 4 | ||||
-rw-r--r-- | client/menu/settings/number_setting.gd | 41 | ||||
-rw-r--r-- | client/menu/settings/number_setting.gd.uid | 1 |
3 files changed, 44 insertions, 2 deletions
diff --git a/client/menu/play.gd b/client/menu/play.gd index 2633163e..afc257f3 100644 --- a/client/menu/play.gd +++ b/client/menu/play.gd @@ -143,10 +143,10 @@ func _on_editor_control_pressed(): Service.State.FAILED: Editor.start() func _on_server_connect_pressed(): - connect_to("ws://127.0.0.1:27032/") + connect_to("ws://%s:%d" % [Server.connect_address(), Global.get_setting("server.bind_port")]) func _on_editor_connect_pressed(): - connect_to("ws://127.0.0.1:27035/") + connect_to("ws://[::1]:27032/") func _process(_delta): server_control.disabled = false diff --git a/client/menu/settings/number_setting.gd b/client/menu/settings/number_setting.gd new file mode 100644 index 00000000..2326eef1 --- /dev/null +++ b/client/menu/settings/number_setting.gd @@ -0,0 +1,41 @@ +# Hurry Curry! - a game about cooking +# Copyright 2025 nokoe +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +class_name NumberSetting +extends GameSetting + +var placeholder: String +var min: int +var max: int + +func _init(new_id: String, default: int, min: int, max: int): + super(new_id, default) + self.min = min + self.max = max + +func create_row(): + var row = super() + var input := SpinBox.new() + input.min_value = min + input.max_value = max + + input.value_changed.connect(func(value): Global.set_setting(key, value as int)) + Settings.hook_changed_init(key, true, + func(v): + if is_instance_valid(input): + input.value = v + ) + row.value_node = input + return row diff --git a/client/menu/settings/number_setting.gd.uid b/client/menu/settings/number_setting.gd.uid new file mode 100644 index 00000000..4301c642 --- /dev/null +++ b/client/menu/settings/number_setting.gd.uid @@ -0,0 +1 @@ +uid://babmw2ohuhmuk |