diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll
index bf806b9..c9c3126 100644
Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding.dll differ
diff --git a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll
index a841bbd..64de40d 100644
Binary files a/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll and b/project/addons/discord-sdk-gd/bin/windows/discord_game_sdk_binding_debug.dll differ
diff --git a/project/assets/Checked.svg b/project/assets/Checked.svg
new file mode 100644
index 0000000..d37a1c2
--- /dev/null
+++ b/project/assets/Checked.svg
@@ -0,0 +1,18 @@
+
diff --git a/project/assets/Checked.svg.import b/project/assets/Checked.svg.import
new file mode 100644
index 0000000..d124dbf
--- /dev/null
+++ b/project/assets/Checked.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dnfq6kug4x6o2"
+path="res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/Checked.svg"
+dest_files=["res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/project/assets/Unchecked.svg b/project/assets/Unchecked.svg
new file mode 100644
index 0000000..58cb234
--- /dev/null
+++ b/project/assets/Unchecked.svg
@@ -0,0 +1,18 @@
+
diff --git a/project/assets/Unchecked.svg.import b/project/assets/Unchecked.svg.import
new file mode 100644
index 0000000..c6ca33e
--- /dev/null
+++ b/project/assets/Unchecked.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://compmm3kviqqe"
+path="res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/Unchecked.svg"
+dest_files=["res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/project/main.gd b/project/main.gd
index 53847e7..ad3cf15 100644
--- a/project/main.gd
+++ b/project/main.gd
@@ -1,6 +1,12 @@
extends Node
func _ready():
+ set_activity()
+ discord_sdk.connect("activity_join_request",_on_activity_join_request)
+ discord_sdk.connect("activity_join",_on_activity_join)
+ discord_sdk.connect("activity_spectate",_on_activity_spectate)
+
+func set_activity():
discord_sdk.app_id = 1099618430065324082
discord_sdk.details = "A demo activity by vaporvee#1231"
discord_sdk.state = "Checkpoint 23/23"
@@ -16,8 +22,8 @@ func _ready():
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
discord_sdk.current_party_size = 1
discord_sdk.max_party_size = 4
- discord_sdk.match_secret = "m_" + my_secret + ",discord_sdk.current_party_size" #better use seeds with 1 to 1 range instead of just chars
- discord_sdk.join_secret = "j_" + my_secret + ",discord_sdk.current_party_size"
+ discord_sdk.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
+ discord_sdk.join_secret = "j_" + my_secret
discord_sdk.spectate_secret = "s_" + my_secret
#discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
#discord_sdk.register_command("steam://rungameid/1389990")
@@ -32,11 +38,11 @@ func _on_activity_join_request(user_requesting):
func _on_activity_join(secret):
if(discord_sdk.join_secret != secret):
- discord_sdk.current_party_size = clamp(int(secret.split(",")[1]) + 1, 0, discord_sdk.max_party_size)
- discord_sdk.party_id = secret.split(",")[0].replace("j_","mylobbycanbeeverything_")
- discord_sdk.match_secret = secret.split(",")[0].replace("j_","m_")
- discord_sdk.join_secret = secret.split(",")[0]
- discord_sdk.spectate_secret = secret.split(",")[0].replace("j_","s_")
+ discord_sdk.current_party_size = clamp(int(secret) + 1, 0, discord_sdk.max_party_size)
+ discord_sdk.party_id = secret.replace("j_","mylobbycanbeeverything_")
+ discord_sdk.match_secret = secret.replace("j_","m_")
+ discord_sdk.join_secret = secret
+ discord_sdk.spectate_secret = secret.replace("j_","s_")
discord_sdk.refresh()
$Info.text = $Info.text.replace("{ssecret}",discord_sdk.spectate_secret).replace("{jsecret}",discord_sdk.join_secret).replace("{msecret}",discord_sdk.match_secret).replace("{mpartysize}",str(discord_sdk.max_party_size)).replace("{cpartysize}",str(discord_sdk.current_party_size)).replace("{partyid}",discord_sdk.party_id).replace("{discordinfo}",str(discord_sdk.get_is_discord_working())).replace("{id}",str(discord_sdk.app_id)).replace("{details}",discord_sdk.details).replace("{state}",discord_sdk.state).replace("{lkey}",discord_sdk.large_image).replace("{ltext}",discord_sdk.large_image_text).replace("{skey}",discord_sdk.small_image).replace("{stext}",discord_sdk.small_image_text).replace("{stimestamp}",str(discord_sdk.start_timestamp)).replace("{etimestamp}",str(discord_sdk.end_timestamp))
print(secret)
@@ -45,3 +51,10 @@ func _on_activity_join(secret):
func _on_activity_spectate(secret):
print(secret)
+
+
+func _on_check_button_toggled(button_pressed):
+ if(button_pressed):
+ set_activity()
+ else:
+ discord_sdk.clear()
diff --git a/project/main.tscn b/project/main.tscn
index 4f92dc3..493da55 100644
--- a/project/main.tscn
+++ b/project/main.tscn
@@ -1,7 +1,11 @@
-[gd_scene load_steps=3 format=3 uid="uid://dmx2xuigcpvt4"]
+[gd_scene load_steps=6 format=3 uid="uid://dmx2xuigcpvt4"]
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
[ext_resource type="Texture2D" uid="uid://dhuttdaet6q1u" path="res://assets/Logo_V2_Clyde.png" id="2_1hv5q"]
+[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://assets/Checked.svg" id="3_ny5eu"]
+[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://assets/Unchecked.svg" id="4_xydmq"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1w3f4"]
[node name="Node" type="Node"]
script = ExtResource("1_kl8ri")
@@ -18,20 +22,20 @@ color = Color(0.345098, 0.396078, 0.94902, 1)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 4
-position = Vector2(565, 308)
+position = Vector2(591, 308)
scale = Vector2(0.408203, 0.408203)
texture = ExtResource("2_1hv5q")
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
-anchors_preset = 8
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-offset_left = -257.0
-offset_top = 54.0
-offset_right = 257.0
-offset_bottom = 150.0
+anchors_preset = -1
+anchor_left = 0.296
+anchor_top = 0.59
+anchor_right = 0.742
+anchor_bottom = 0.727
+offset_left = 0.00799561
+offset_top = -0.320007
+offset_right = 0.215942
+offset_bottom = -0.0960388
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
@@ -67,3 +71,23 @@ Match secret: {msecret}
Join secret: {jsecret}
Spectate secret: {ssecret}"
scroll_active = false
+
+[node name="CheckButton" type="CheckButton" parent="."]
+anchors_preset = -1
+anchor_left = 0.494
+anchor_top = 0.781
+anchor_right = 0.531
+anchor_bottom = 0.82
+offset_left = -0.0879517
+offset_top = -0.0879822
+offset_right = 803.288
+offset_bottom = 482.64
+grow_horizontal = 2
+grow_vertical = 0
+scale = Vector2(0.05, 0.05)
+theme_override_icons/checked = ExtResource("3_ny5eu")
+theme_override_icons/unchecked = ExtResource("4_xydmq")
+theme_override_styles/focus = SubResource("StyleBoxEmpty_1w3f4")
+button_pressed = true
+
+[connection signal="toggled" from="CheckButton" to="." method="_on_check_button_toggled"]
diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp
index 3150e17..45d45fa 100644
--- a/src/discordgodot.cpp
+++ b/src/discordgodot.cpp
@@ -193,9 +193,28 @@ void discord_sdk::refresh()
void discord_sdk::clear()
{
- if (result == discord::Result::Ok /*should it be only at ok?*/ && app_id > 0)
- //
- ;
+ if (result == discord::Result::Ok)
+ {
+ app_id = 0;
+ state = "";
+ details = "";
+ large_image = "";
+ large_image_text = "";
+ small_image = "";
+ small_image_text = "";
+ start_timestamp = 0;
+ end_timestamp = 0;
+ party_id = "-";
+ current_party_size = 0;
+ max_party_size = 0;
+ match_secret = "";
+ join_secret = "";
+ spectate_secret = "";
+ instanced = false;
+
+ delete core;
+ core = nullptr;
+ }
}
void discord_sdk::set_large_image(String value)