mirror of
https://github.com/thegatesbrowser/godot-multiplayer.git
synced 2025-10-16 11:03:37 -04:00
Update to 4.4.1
This commit is contained in:
parent
4ae45deca1
commit
ceb10e9a06
160 changed files with 491 additions and 71 deletions
17
ui/ui.gd
17
ui/ui.gd
|
@ -15,6 +15,19 @@ func _ready():
|
|||
show_ui()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("quit_game"):
|
||||
if $MainMenu.visible:
|
||||
# If main menu is visible, quit the game
|
||||
get_tree().quit()
|
||||
elif $InGameUI.visible:
|
||||
# If in-game UI is visible, return to main menu
|
||||
# Disconnect from server/client first
|
||||
if Connection.is_peer_connected:
|
||||
multiplayer.multiplayer_peer.close()
|
||||
show_ui()
|
||||
|
||||
|
||||
func start_server_emit() -> void:
|
||||
start_server.emit()
|
||||
$MainMenu.visible = false
|
||||
|
@ -25,6 +38,10 @@ func connect_client_emit() -> void:
|
|||
hide_ui()
|
||||
|
||||
|
||||
func exit_game_emit() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func hide_ui() -> void:
|
||||
$MainMenu.visible = false
|
||||
$InGameUI.visible = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue