summaryrefslogtreecommitdiff
path: root/UI/PlayerLobby/lobby_setting.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-26 17:13:40 +0100
commitcb9bb9d1c757b53707c741a3c8c218b513ffb5ec (patch)
tree1e3741a70672504d71685db98b22f7fe61e0e6cb /UI/PlayerLobby/lobby_setting.gd
parent72863ffa31e27f4c6be862d80472cfb897fccaea (diff)
next commit
Diffstat (limited to 'UI/PlayerLobby/lobby_setting.gd')
-rw-r--r--UI/PlayerLobby/lobby_setting.gd42
1 files changed, 42 insertions, 0 deletions
diff --git a/UI/PlayerLobby/lobby_setting.gd b/UI/PlayerLobby/lobby_setting.gd
new file mode 100644
index 0000000..8f0efe3
--- /dev/null
+++ b/UI/PlayerLobby/lobby_setting.gd
@@ -0,0 +1,42 @@
+extends HBoxContainer
+
+
+signal value_changed(value: Variant)
+
+var label := "":
+ set(value):
+ $Label.text = str(value)
+ name = str(value)
+ get():
+ return $Label.text
+
+var value: Variant = "":
+ set(new_value):
+ value = new_value
+ if typeof(new_value) == TYPE_BOOL:
+ $TextEdit.visible = false
+ $CheckBox.visible = true
+
+ $CheckBox.set_pressed_no_signal(new_value)
+ else:
+ $TextEdit.visible = true
+ $CheckBox.visible = false
+ $TextEdit.text = str(new_value)
+ get():
+ if typeof(value) == TYPE_BOOL:
+ return $CheckBox.button_pressed
+ else:
+ return $TextEdit.text
+
+var disabled := false:
+ set(value):
+ disabled = value
+ $TextEdit.editable = !value
+ $CheckBox.disabled = value
+
+
+func _on_text_edit_text_changed(new_text: String) -> void:
+ value_changed.emit(new_text)
+
+func _on_check_box_toggled(_toggled_on: bool) -> void:
+ value_changed.emit($CheckBox.button_pressed)