Woot
This commit is contained in:
parent
ed3e07cf4b
commit
c062499bf0
6 changed files with 16 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@ export_presets.cfg
|
||||||
.mono
|
.mono
|
||||||
data_*/
|
data_*/
|
||||||
/webrtc/
|
/webrtc/
|
||||||
|
/exports/
|
||||||
|
|
|
@ -11,6 +11,9 @@ func _ready():
|
||||||
Global.client.signaller.connect("lobby_left", self, "_lobby_left")
|
Global.client.signaller.connect("lobby_left", self, "_lobby_left")
|
||||||
Global.client.signaller.connect("websocket_disconnected", self, "_signaller_disconnected")
|
Global.client.signaller.connect("websocket_disconnected", self, "_signaller_disconnected")
|
||||||
Global.client.signaller.request_lobby_list()
|
Global.client.signaller.request_lobby_list()
|
||||||
|
|
||||||
|
func _draw():
|
||||||
|
$join.disabled = len($lobbies.get_selected_items()) < 1
|
||||||
|
|
||||||
func _signaller_disconnected():
|
func _signaller_disconnected():
|
||||||
Global.main_menu()
|
Global.main_menu()
|
||||||
|
@ -46,3 +49,7 @@ func _lobby_delete(id):
|
||||||
if id == $lobbies.get_item_metadata(i)["id"]:
|
if id == $lobbies.get_item_metadata(i)["id"]:
|
||||||
$lobbies.remove_item(i)
|
$lobbies.remove_item(i)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
func _on_lobbies_item_activated(index):
|
||||||
|
_on_join_pressed()
|
||||||
|
|
|
@ -31,10 +31,10 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="join" type="Button" parent="."]
|
[node name="join" type="Button" parent="."]
|
||||||
margin_left = 10.0
|
margin_left = 563.0
|
||||||
margin_top = 414.0
|
margin_top = 13.0
|
||||||
margin_right = 548.0
|
margin_right = 963.0
|
||||||
margin_bottom = 489.0
|
margin_bottom = 88.0
|
||||||
text = "Join"
|
text = "Join"
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
|
@ -55,3 +55,4 @@ __meta__ = {
|
||||||
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
[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="create_lobby" to="." method="_on_create_lobby_pressed"]
|
||||||
[connection signal="pressed" from="join" to="." method="_on_join_pressed"]
|
[connection signal="pressed" from="join" to="." method="_on_join_pressed"]
|
||||||
|
[connection signal="item_activated" from="lobbies" to="." method="_on_lobbies_item_activated"]
|
||||||
|
|
|
@ -4,7 +4,7 @@ extends Node
|
||||||
This module sets up WebRTC peer connections.
|
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 = [
|
var webrtc_ice_servers = [
|
||||||
{ "urls": ["stun:stun.l.google.com:19302"] },
|
{ "urls": ["stun:stun.l.google.com:19302"] },
|
||||||
# { "urls": ["stun:localhost:3478"] }
|
# { "urls": ["stun:localhost:3478"] }
|
||||||
|
|
|
@ -8,6 +8,7 @@ type ID = string;
|
||||||
// app state
|
// app state
|
||||||
const allLobbies = new Map<ID, Lobby>();
|
const allLobbies = new Map<ID, Lobby>();
|
||||||
const allClients = new Map<ID, Client>();
|
const allClients = new Map<ID, Client>();
|
||||||
|
// TODO: client index by id
|
||||||
|
|
||||||
interface DataMessage {
|
interface DataMessage {
|
||||||
type: string;
|
type: string;
|
||||||
|
|
|
@ -41,6 +41,7 @@ func connect_to_websocket_signaller(url: String):
|
||||||
close()
|
close()
|
||||||
print("Attempting to connect to WebSocket signalling server at %s" % url)
|
print("Attempting to connect to WebSocket signalling server at %s" % url)
|
||||||
var _result = ws.connect_to_url(url)
|
var _result = ws.connect_to_url(url)
|
||||||
|
print("%s" % _result)
|
||||||
|
|
||||||
func _closed(_unknown):
|
func _closed(_unknown):
|
||||||
emit_signal("websocket_disconnected")
|
emit_signal("websocket_disconnected")
|
||||||
|
|
Loading…
Reference in a new issue