Quit.gd 891 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. extends WindowPanel
  2. @onready var stayButton : Button = $Margin/VBoxContainer/Container/ButtonChoice/Stay
  3. @onready var logOutButton : Button = $Margin/VBoxContainer/Container/ButtonChoice/LogOut
  4. @onready var quitButton : Button = $Margin/VBoxContainer/Container/ButtonChoice/Quit
  5. #
  6. func EnableControl(state : bool):
  7. super(state)
  8. if state:
  9. Center()
  10. if FSM.IsGameState():
  11. logOutButton.set_visible(true)
  12. logOutButton.grab_focus()
  13. else:
  14. if quitButton.is_visible():
  15. logOutButton.set_visible(false)
  16. quitButton.grab_focus()
  17. else:
  18. set_visible(false)
  19. #
  20. func _on_logout_pressed():
  21. FSM.EnterState(FSM.States.LOGIN_SCREEN)
  22. Network.DisconnectAccount()
  23. EnableControl(false)
  24. func _on_quit_pressed():
  25. FSM.EnterState(FSM.States.QUIT)
  26. ToggleControl()
  27. func _on_stay_pressed():
  28. ToggleControl()
  29. func _ready():
  30. if LauncherCommons.isWeb:
  31. quitButton.set_visible(false)