Milestone 7 Beta 1
Redid the entire serverside and clientside, matchmaking is finally out, bugfixes.
This commit is contained in:
parent
9de67986dd
commit
699320353a
16 changed files with 324 additions and 266 deletions
|
|
@ -10,45 +10,49 @@
|
|||
extends Control
|
||||
|
||||
var elevated = false
|
||||
var done
|
||||
|
||||
func _ready():
|
||||
multiplayer.connected_to_server.connect(_on_connected_ok)
|
||||
if Server.is_server:
|
||||
|
||||
func server_prepare():
|
||||
if Game.is_server:
|
||||
$player_customization/ip.hide()
|
||||
$player_customization/ip.text = "localhost"
|
||||
$player_customization/ip.editable = false
|
||||
$start/start.show()
|
||||
$start/start.disabled = false
|
||||
$player_list/list.text = " "
|
||||
|
||||
func _process(delta):
|
||||
if Server.is_server:
|
||||
Server.sync_playerlist.rpc($player_list/list.text, multiplayer.get_unique_id())
|
||||
if Server.is_server and !elevated:
|
||||
_ready()
|
||||
Server.send_playerinfo($player_customization/name.text, multiplayer.get_unique_id())
|
||||
elevated = true
|
||||
|
||||
func _on_start_pressed():
|
||||
Server.start_game.rpc(Server.players)
|
||||
|
||||
func _input(event):
|
||||
func _process(_delta):
|
||||
server_prepare()
|
||||
done = 0
|
||||
for id in Game.player_list:
|
||||
if done == 1:
|
||||
$player_list/list.text = str($player_list/list.text +"\n" + Game.player_list[id])
|
||||
else:
|
||||
$player_list/list.text = Game.player_list[id]
|
||||
done = 1
|
||||
|
||||
|
||||
func _on_start_pressed():
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"start_game")
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("escape"):
|
||||
Game.reset()
|
||||
Server.reset()
|
||||
get_tree().change_scene_to_file("res://menus/main_menu.tscn")
|
||||
|
||||
|
||||
func _on_join_pressed():
|
||||
if $player_customization/name.text != "" and $player_customization/name.text.length() <= 20 and $player_customization/ip.text != "":
|
||||
if !Server.is_server:
|
||||
Server.join_game($player_customization/ip.text)
|
||||
Game.room_name = $player_customization/ip.text
|
||||
Game.player_name = $player_customization/name.text
|
||||
Client.join_game()
|
||||
|
||||
func _on_connected_ok():
|
||||
$player_customization/join.hide()
|
||||
$player_customization/join.disabled = true
|
||||
$player_customization/name.editable = false
|
||||
$player_customization/ip.editable = false
|
||||
await get_tree().create_timer(1).timeout
|
||||
Server.send_playerinfo.rpc($player_customization/name.text, multiplayer.get_unique_id())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue