54 lines
1.3 KiB
GDScript3
54 lines
1.3 KiB
GDScript3
|
|
extends Control
|
||
|
|
|
||
|
|
# Create an UDPServer to receive UDP Broadcast packets
|
||
|
|
# List all received games in a list
|
||
|
|
@onready var margin_container = $PanelContainer/MarginContainer
|
||
|
|
@onready var selection_menu = $PanelContainer/SelectionMenu
|
||
|
|
@onready var lan_host = $PanelContainer/MarginContainer/VBoxContainer2/LANHost
|
||
|
|
@onready var lan_join = $PanelContainer/MarginContainer/VBoxContainer2/LANJoin
|
||
|
|
|
||
|
|
|
||
|
|
# Called when the node enters the scene tree for the first time.
|
||
|
|
func _ready():
|
||
|
|
pass
|
||
|
|
|
||
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
|
func _process(delta):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
func _on_back_button_pressed():
|
||
|
|
margin_container.visible = false
|
||
|
|
selection_menu.visible = true
|
||
|
|
|
||
|
|
lan_host.hide_panel()
|
||
|
|
lan_join.hide_panel()
|
||
|
|
|
||
|
|
|
||
|
|
func _on_backto_main_menu_pressed():
|
||
|
|
get_tree().change_scene_to_file("res://UI/main_menu.tscn")
|
||
|
|
|
||
|
|
|
||
|
|
func _on_host_pressed():
|
||
|
|
selection_menu.visible = false
|
||
|
|
margin_container.visible = true
|
||
|
|
|
||
|
|
lan_host.show_panel()
|
||
|
|
|
||
|
|
func _on_join_pressed():
|
||
|
|
selection_menu.visible = false
|
||
|
|
margin_container.visible = true
|
||
|
|
|
||
|
|
lan_join.show_panel()
|
||
|
|
|
||
|
|
@rpc("any_peer", "call_local")
|
||
|
|
func load_game() -> void:
|
||
|
|
push_warning("@@@@")
|
||
|
|
push_warning(multiplayer.is_server())
|
||
|
|
get_tree().change_scene_to_file("res://Game.tscn")
|
||
|
|
push_warning("yoyoyoyo")
|
||
|
|
|
||
|
|
func _on_start_game_button_pressed():
|
||
|
|
load_game.rpc()
|
||
|
|
|