kind of fixed the lobby
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -70,7 +70,9 @@
|
||||
"thread": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"variant": "cpp"
|
||||
"variant": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"mutex": "cpp"
|
||||
},
|
||||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||
|
@@ -3,12 +3,6 @@ extends DiscordConnector
|
||||
func _on_user_connected(access_token: String, refresh_token: String, expires_in: int) -> void:
|
||||
print_debug("Access token: %s \nRefresh Token: %s \nExpires in: %s" % [access_token, refresh_token, expires_in])
|
||||
|
||||
func _on_user_updated() -> void:
|
||||
print_debug("USER UPDATED")
|
||||
await get_tree().create_timer(2).timeout
|
||||
print("oop")
|
||||
$DiscordLobby.create_or_join_lobby("beanis")
|
||||
|
||||
func _on_user_connection_failed(error: String) -> void:
|
||||
push_error("User connection failed! Error: " + error)
|
||||
|
||||
@@ -17,6 +11,7 @@ func _on_user_update_failed(error: String) -> void:
|
||||
|
||||
func _on_connection_ready() -> void:
|
||||
print_debug("CONNECTION READY")
|
||||
$DiscordLobby.create_or_join_lobby("beanis")
|
||||
|
||||
func _on_connection_error(error: String) -> void:
|
||||
push_error(error)
|
||||
|
@@ -1 +0,0 @@
|
||||
extends DiscordLobby
|
@@ -1 +0,0 @@
|
||||
uid://del0aaf7txxn6
|
@@ -2,7 +2,6 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"]
|
||||
[ext_resource type="Script" uid="uid://kmubk5a6i385" path="res://discord_connector.gd" id="3_h2yge"]
|
||||
[ext_resource type="Script" uid="uid://del0aaf7txxn6" path="res://discord_lobby.gd" id="4_1bvp3"]
|
||||
[ext_resource type="Script" uid="uid://46tue7u6crd6" path="res://addons/discord-rpc-gd/nodes/debug.gd" id="6_ujijw"]
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
@@ -54,7 +53,6 @@ root_connector = NodePath("..")
|
||||
|
||||
[node name="DiscordLobby" type="DiscordLobby" parent="DiscordConnector"]
|
||||
root_connector = NodePath("..")
|
||||
script = ExtResource("4_1bvp3")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(789, 330.5)
|
||||
|
@@ -5,27 +5,21 @@ void DiscordLobby ::_bind_methods()
|
||||
BIND_METHOD(DiscordLobby, create_or_join_lobby, "secret");
|
||||
}
|
||||
|
||||
void DiscordLobby::create_or_join_lobby(String secret) {
|
||||
if (connector) {
|
||||
auto current_client = connector->client;
|
||||
|
||||
current_client->CreateOrJoinLobby(secret.utf8().get_data(),[current_client](discordpp::ClientResult result, uint64_t lobbyId) {
|
||||
void DiscordLobby::create_or_join_lobby(String secret)
|
||||
{
|
||||
DiscordLobby::connector->client->CreateOrJoinLobby(secret.utf8().get_data(), [this](discordpp::ClientResult result, uint64_t lobbyId)
|
||||
{
|
||||
if(result.Successful()) {
|
||||
std::cout << "Lobby created or joined successfully! Lobby Id: " << lobbyId << std::endl;
|
||||
} else {
|
||||
std::cout << "Lobby creation/join failed\n" << result.Error().c_str();
|
||||
}
|
||||
});
|
||||
}
|
||||
UtilityFunctions::print("Failed to create or join lobby: " + String(result.Error().c_str()));
|
||||
} });
|
||||
}
|
||||
|
||||
DiscordLobby::DiscordLobby()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DiscordLobby::~DiscordLobby()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user