This commit is contained in:
Daniel Flanagan 2021-12-02 16:30:24 -06:00
parent ed3e07cf4b
commit c062499bf0
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
6 changed files with 16 additions and 5 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ export_presets.cfg
.mono
data_*/
/webrtc/
/exports/

View File

@ -11,6 +11,9 @@ func _ready():
Global.client.signaller.connect("lobby_left", self, "_lobby_left")
Global.client.signaller.connect("websocket_disconnected", self, "_signaller_disconnected")
Global.client.signaller.request_lobby_list()
func _draw():
$join.disabled = len($lobbies.get_selected_items()) < 1
func _signaller_disconnected():
Global.main_menu()
@ -46,3 +49,7 @@ func _lobby_delete(id):
if id == $lobbies.get_item_metadata(i)["id"]:
$lobbies.remove_item(i)
return
func _on_lobbies_item_activated(index):
_on_join_pressed()

View File

@ -31,10 +31,10 @@ __meta__ = {
}
[node name="join" type="Button" parent="."]
margin_left = 10.0
margin_top = 414.0
margin_right = 548.0
margin_bottom = 489.0
margin_left = 563.0
margin_top = 13.0
margin_right = 963.0
margin_bottom = 88.0
text = "Join"
__meta__ = {
"_edit_use_anchors_": false
@ -55,3 +55,4 @@ __meta__ = {
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
[connection signal="pressed" from="create_lobby" to="." method="_on_create_lobby_pressed"]
[connection signal="pressed" from="join" to="." method="_on_join_pressed"]
[connection signal="item_activated" from="lobbies" to="." method="_on_lobbies_item_activated"]

View File

@ -4,7 +4,7 @@ extends Node
This module sets up WebRTC peer connections.
"""
var multiplayer_url = "ws://localhost:8888"
var multiplayer_url = "wss://webrtc-signaller.deno.dev" # "ws://localhost:8888"
var webrtc_ice_servers = [
{ "urls": ["stun:stun.l.google.com:19302"] },
# { "urls": ["stun:localhost:3478"] }

View File

@ -8,6 +8,7 @@ type ID = string;
// app state
const allLobbies = new Map<ID, Lobby>();
const allClients = new Map<ID, Client>();
// TODO: client index by id
interface DataMessage {
type: string;

View File

@ -41,6 +41,7 @@ func connect_to_websocket_signaller(url: String):
close()
print("Attempting to connect to WebSocket signalling server at %s" % url)
var _result = ws.connect_to_url(url)
print("%s" % _result)
func _closed(_unknown):
emit_signal("websocket_disconnected")