aboutsummaryrefslogtreecommitdiff
path: root/logic/stage.gd
diff options
context:
space:
mode:
Diffstat (limited to 'logic/stage.gd')
-rw-r--r--logic/stage.gd31
1 files changed, 6 insertions, 25 deletions
diff --git a/logic/stage.gd b/logic/stage.gd
index 3cc5943..892dee4 100644
--- a/logic/stage.gd
+++ b/logic/stage.gd
@@ -49,11 +49,9 @@ func _ready():
save_button.connect("pressed", self, "save_action")
discard_button.connect("pressed", self, "discard_action")
- # @DAM Not working because we changed the stage/controls/.. estructure with the new option_sets.
- # @DAM We could try to do a recursive approach or, build a stack of next items to process.
for it in get_node("controls").get_children():
if it is LineEdit:
- it.connect("focus_entered", it, "set_cursor_position", [99999999]) # @DAM Use MAX_INT
+ it.connect("focus_entered", it, "set", ["caret_position", it.max_length])
it.connect("focus_exited", it, "deselect")
# Map option sets buttons.
@@ -68,16 +66,12 @@ func _ready():
"intervention": intervention
}
for key in option_sets_map:
-# var button := option_sets_map[key].get_node("option_set") as Button
-# button.connect("pressed", self, "show_option_sets", [key])
-
-# if key != "place": # @DAM DEBUG
-# continue
- var button := option_sets_map[key].get_node("options") as Button
- button.connect("pressed", self, "show_option_sets", [key])
+ var button := option_sets_map[key].get_node("options") as Button # @DAM Maybe rename "options". Also requires rename on option_set.
+ button.connect("pressed", self, "show_options", [key])
-func get_option_sets(field: String):
+func show_options(field: String):
+ var option_set_field := self[field] as OptionSet
var options: Array
match field:
@@ -92,20 +86,7 @@ func get_option_sets(field: String):
options.append(OPTION_SETS_NOT_AVAILABLE)
options.sort()
- return options
-
-
-# @DAM WIP I suspect that these should go inside the option_set class...
-func show_option_sets(field: String):
- var stage_options = get_node("/root/main/popup_list") as Popup
- stage_options.connect("item_selected", self, "option_set_selected", [field], CONNECT_ONESHOT)
- stage_options.popup_options(get_option_sets(field))
-
-
-func option_set_selected(index: int, field: String):
- var field_input: LineEdit = self[field].get_node("input")
- field_input.text = get_option_sets(field)[index]
- field_input.caret_position = field_input.text.length()
+ option_set_field.show_options(options)
func save_action():