diff options
| author | nokoe <nokoe@mailbox.org> | 2025-07-08 00:08:18 +0200 |
|---|---|---|
| committer | nokoe <nokoe@mailbox.org> | 2025-07-08 00:10:03 +0200 |
| commit | f1ac43aaac6f330fc8e7217437b52c0b2ce836c8 (patch) | |
| tree | 93f878387d56230c344da60aa14121f7787a7fd1 /client/menu/settings | |
| parent | ac1ecb0876d57d73cee54127f5ba793095808b92 (diff) | |
| download | hurrycurry-f1ac43aaac6f330fc8e7217437b52c0b2ce836c8.tar hurrycurry-f1ac43aaac6f330fc8e7217437b52c0b2ce836c8.tar.bz2 hurrycurry-f1ac43aaac6f330fc8e7217437b52c0b2ce836c8.tar.zst | |
add server bind settings; fixes #348
Diffstat (limited to 'client/menu/settings')
| -rw-r--r-- | client/menu/settings/number_setting.gd | 41 | ||||
| -rw-r--r-- | client/menu/settings/number_setting.gd.uid | 1 |
2 files changed, 42 insertions, 0 deletions
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 |