summaryrefslogtreecommitdiff
path: root/UI/PlayerLobby/lobby_setting.gd
diff options
context:
space:
mode:
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)