Session closing and quitting fixes
This commit is contained in:
parent
4dd4ee7417
commit
75427dd336
4 changed files with 27 additions and 3 deletions
|
|
@ -6,6 +6,8 @@ func _ready() -> void:
|
|||
hide()
|
||||
Session.session_started.connect(%LeaveButton.show)
|
||||
Session.session_ended.connect(%LeaveButton.hide)
|
||||
Lobby.lobby_created.connect(%StopSession.show)
|
||||
Lobby.lobby_closed.connect(%StopSession.hide)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("menu_settings"):
|
||||
|
|
@ -24,13 +26,16 @@ func _on_fullscreen_button_toggled(toggled_on: bool) -> void:
|
|||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
|
||||
func _on_sensitivity_slider_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/SpinBox.set_value_no_signal(value)
|
||||
%SensitivityBox.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
func _on_sensitivity_box_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/HSlider.set_value_no_signal(value)
|
||||
%SensitivitySlider.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
|
||||
func _on_leave_button_pressed() -> void:
|
||||
Session.quit_session()
|
||||
|
||||
func _on_stop_session_pressed() -> void:
|
||||
if multiplayer.is_server():
|
||||
Session.end_session()
|
||||
|
|
|
|||
|
|
@ -152,12 +152,17 @@ func end_session() -> void:
|
|||
buy_timer.stop()
|
||||
object_containers.clear()
|
||||
session_ended.emit()
|
||||
|
||||
|
||||
session_started_flag = false
|
||||
dynamic_objects_spawner = null
|
||||
plants = []
|
||||
plant_deadzones = {}
|
||||
|
||||
func quit_session() -> void:
|
||||
if multiplayer.is_server():
|
||||
end_session()
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
else:
|
||||
session_ended.emit()
|
||||
session_started_flag = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue