Refined "print" for better feedback. Host port and player count fields properly pass data now to host function.
This commit is contained in:
parent
014c841ac9
commit
e9d4432937
2 changed files with 45 additions and 41 deletions
|
|
@ -25,19 +25,22 @@ func _on_singleplayer_button_up():
|
|||
func _on_JoinGameBtn_button_up():
|
||||
ip = $JoinPanel/join_ip
|
||||
port = $JoinPanel/join_port
|
||||
print("Attempting to join game at IP ",ip," via port ",port)
|
||||
print("Netplay - Attempting to join game at IP ",ip," via port ",port)
|
||||
join_game()
|
||||
|
||||
func _on_HostGameBtn_button_up():
|
||||
#var host_port = $HostPanel/host_port.text
|
||||
print("Attempting to host game on port ",host_port,"...")
|
||||
var host_port = $HostPanel/host_port.value
|
||||
print("Netplay - Attempting to host game on port ",host_port,"...")
|
||||
host_game(host_port)
|
||||
|
||||
|
||||
func host_game(port):
|
||||
var maxplayers = $HostPanel/playercount.value
|
||||
var host = NetworkedMultiplayerENet.new()
|
||||
host.create_server(port)
|
||||
print("Netplay - Returned: ",host)
|
||||
host.create_server(port, maxplayers) # ports, maxplayers
|
||||
get_tree().set_network_peer(host)
|
||||
print("Hosting on port ",port)
|
||||
print("Netplay - Hosting on port ",port,". Max players: ",maxplayers)
|
||||
print("Netplay - Are you the server ... ",get_tree().is_network_server())
|
||||
$HostPanel/HostGameBtn.disabled = 1
|
||||
$HostPanel/HostGameBtn.hint_tooltip = "Cannot start another server, Server already started."
|
||||
$JoinPanel/JoinGameBtn.disabled = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue