fix state management issues with settings
This commit is contained in:
parent
022053a078
commit
076c7a3315
|
|
@ -129,8 +129,6 @@ func _ready():
|
|||
|
||||
get_viewport().gui_focus_changed.connect(reclaim_lost_focus)
|
||||
|
||||
print(get_save_dict())
|
||||
|
||||
|
||||
func reclaim_lost_focus():
|
||||
if has_stage:
|
||||
|
|
|
|||
|
|
@ -19,14 +19,16 @@ var has_stage:bool = false:
|
|||
@onready var font_picker: OptionButton = %FontSeettings
|
||||
@onready var subtitle_picker: OptionButton = %SubtitleSettings
|
||||
@onready var scale_slider: HSlider = %UIScaleSlider
|
||||
@onready var accept_or_continue: Button = %SaveButton
|
||||
@onready var save_button: Button = %SaveButton
|
||||
@onready var back_button: Button = %BackButton
|
||||
|
||||
func _ready() -> void:
|
||||
if is_in_beginning:
|
||||
%SaveButton.text = "save and continue"
|
||||
back_button.show()
|
||||
else:
|
||||
%SaveButton.text = "save and exit"
|
||||
back_button.hide()
|
||||
|
||||
update_ui_from_state()
|
||||
|
||||
|
|
@ -38,6 +40,7 @@ func _ready() -> void:
|
|||
font_picker.item_selected.connect(func(value): State.font_style = value)
|
||||
subtitle_picker.item_selected.connect(func(value): State.subtitles = value)
|
||||
scale_slider.drag_ended.connect(_on_scale_slider_dragged)
|
||||
save_button.pressed.connect(_on_save_button_pressed)
|
||||
|
||||
|
||||
func _on_scale_slider_dragged(update:bool):
|
||||
|
|
@ -54,7 +57,11 @@ func update_ui_from_state():
|
|||
subtitle_picker.selected = State.subtitles
|
||||
scale_slider.value = State.ui_scaling
|
||||
|
||||
func _on_exit_button_pressed() -> void:
|
||||
func _on_save_button_pressed() -> void:
|
||||
leave_stage.emit()
|
||||
State.save_settings()
|
||||
State.leave_stage(self)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and has_stage:
|
||||
State.leave_stage(self)
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ disabled = true
|
|||
selected = 1
|
||||
item_count = 3
|
||||
popup/item_0/text = "none"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "spoken text"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "closed captions"
|
||||
|
|
|
|||
|
|
@ -78,3 +78,7 @@ func _on_exit_button_pressed() -> void:
|
|||
leave_stage.emit()
|
||||
State.save_settings()
|
||||
State.leave_stage(self)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and has_stage:
|
||||
State.leave_stage(self)
|
||||
|
|
|
|||
|
|
@ -42,3 +42,7 @@ func _on_exit_button_pressed() -> void:
|
|||
leave_stage.emit()
|
||||
State.save_settings()
|
||||
State.leave_stage(self)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and has_stage:
|
||||
State.leave_stage(self)
|
||||
|
|
|
|||
|
|
@ -33,3 +33,7 @@ func _on_exit_button_pressed() -> void:
|
|||
leave_stage.emit()
|
||||
State.save_settings()
|
||||
State.leave_stage(self)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and has_stage:
|
||||
State.leave_stage(self)
|
||||
|
|
|
|||
|
|
@ -274,3 +274,7 @@ func window_mode_to_select_id(mode: DisplayServer.WindowMode) -> int:
|
|||
|
||||
func select_id_to_window_mode(item_id) -> DisplayServer.WindowMode:
|
||||
return item_id + 2 if item_id != 0 else 0
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel") and has_stage:
|
||||
_on_exit_button_pressed()
|
||||
|
|
|
|||
Loading…
Reference in New Issue