summaryrefslogtreecommitdiff
path: root/UI/PlayerLobby/lobby_setting.gd
blob: 8f0efe37c7a740b33b4c3bed35701a9ba54a200d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)