diff --git a/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so b/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so index 6d9fe3d..be4770b 100755 Binary files a/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so and b/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so differ diff --git a/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so b/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so index 5f4ab79..bf806b5 100755 Binary files a/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so and b/project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so differ 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 158a347..08d6d83 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 30004f6..1336bcb 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/addons/discord-sdk-gd/export.gd b/project/addons/discord-sdk-gd/export.gd index e01b294..302fc5e 100644 --- a/project/addons/discord-sdk-gd/export.gd +++ b/project/addons/discord-sdk-gd/export.gd @@ -1,7 +1,7 @@ @tool extends EditorExportPlugin -func _export_file(_path, _type, features): +func _export_file(_path, _type, features) -> void: if features[2] == "windows": if features[4] == "x86_64": add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk.dll",[],"/") diff --git a/project/addons/discord-sdk-gd/nodes/Debug.tscn b/project/addons/discord-sdk-gd/nodes/Debug.tscn new file mode 100644 index 0000000..8d5fabf --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/Debug.tscn @@ -0,0 +1,623 @@ +[gd_scene load_steps=68 format=3 uid="uid://c1slhdnlsv2qt"] + +[ext_resource type="Texture2D" uid="uid://cq8lwj2matk6x" path="res://addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png" id="4_gvc3o"] + +[sub_resource type="GDScript" id="GDScript_ak1tp"] +resource_name = "Debug" +script/source = "extends Node + +func _ready(): + discord_sdk.connect(\"activity_join_request\",_on_activity_join_request) + +func _process(_delta): + if(discord_sdk.get_is_discord_working()): + $AnimatedSprite2D.play(\"default\") + debug_text_update() + else: + $AnimatedSprite2D.stop() + $AnimatedSprite2D.animation = \"gray\" + debug_text_update() + +func debug_text_update(): + $Info.text = \"Application ID : {id} +Details: {details} +State: {state} + +Large image key: {lkey} +Large image text: {ltext} +Small image key: {skey} +Small image text: {stext} + +Start timestamp: {stimestamp} +End timestamp: {etimestamp} + +Party ID: {partyid} +Current party size: {cpartysize} +Max party size: {mpartysize} +Match secret: {msecret} +Join secret: {jsecret} +Spectate secret: {ssecret} +Is party public: {ppublic} (needs to be activated in Discord client settings) + +Is instanced: {instanced} +\" + $Info.text = $Info.text.replace(\"{ppublic}\",str(discord_sdk.is_public_party)).replace(\"{instanced}\",str(discord_sdk.instanced)).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(\"{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)) + +var user_request = {}; + +func _on_activity_join_request(user_requesting): + print(user_requesting) + user_request = user_requesting + +func _on_button_pressed(): + if(!user_request.is_empty()): + discord_sdk.accept_join_request(user_request.id) + +func _on_line_edit_text_submitted(new_text): + discord_sdk.send_invite(int(new_text),true,\"this is a test invite sent from godot\") + +func _on_line_edit_2_text_submitted(new_text): + discord_sdk.accept_invite(int(new_text)) + +func _on_button_2_pressed(): + print(discord_sdk.get_current_user()) + +func _on_check_button_toggled(button_pressed): + if(button_pressed): + debug_text_update() + else: + discord_sdk.clear() + debug_text_update() + +" + +[sub_resource type="AtlasTexture" id="AtlasTexture_85oj4"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 0, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vv4mb"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 0, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kwv3j"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 0, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ij57t"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 0, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w2du1"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 512, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4pma1"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 512, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fcoqp"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 512, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tjcb7"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 512, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oudh8"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 512, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_csja0"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 1024, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0xbpk"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 1024, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_p84pv"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 1024, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1gjwh"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 1024, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mrm73"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 1024, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8rkne"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 1536, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_c15qo"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 1536, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_74tpk"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 1536, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_v5nxq"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 1536, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0mf44"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 1536, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kb0hn"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 2048, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_o22ug"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 2048, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_21q7w"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 2048, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gitfl"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 2048, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8hg1o"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 2048, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_niuoc"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 2560, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mt5ft"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 2560, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ub7uo"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 2560, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2uxnl"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 2560, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bh4ts"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 2560, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lcu0i"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 3072, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mmqt1"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 3072, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_orode"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 3072, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ricn8"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 3072, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6ftll"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 3072, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fm4jy"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 3584, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7qcot"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 3584, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2y47g"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 3584, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gpr0t"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 3584, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nn332"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 3584, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jg384"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 4096, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g0wvw"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 4096, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e6fmf"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 4096, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_n1rtv"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 4096, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_365g3"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 4096, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_frkrx"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 4608, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j8adw"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 4608, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_76fh7"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 4608, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gmmrx"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 4608, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rlh42"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 4608, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wijf7"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 5120, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2n5hs"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 5120, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yrp6k"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 5120, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w411h"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 5120, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pe7po"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 5120, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_sr5kq"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 5632, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kgesr"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 5632, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vfk6x"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 5632, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4d1t3"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 5632, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6bexm"] +atlas = ExtResource("4_gvc3o") +region = Rect2(2048, 5632, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tadlo"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 6144, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g2h20"] +atlas = ExtResource("4_gvc3o") +region = Rect2(512, 6144, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_x351d"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1024, 6144, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0jq3r"] +atlas = ExtResource("4_gvc3o") +region = Rect2(1536, 6144, 512, 512) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1eeyl"] +atlas = ExtResource("4_gvc3o") +region = Rect2(0, 0, 512, 512) + +[sub_resource type="SpriteFrames" id="SpriteFrames_kudgl"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_85oj4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vv4mb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kwv3j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ij57t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w2du1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4pma1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fcoqp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tjcb7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oudh8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_csja0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0xbpk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_p84pv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1gjwh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mrm73") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8rkne") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_c15qo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_74tpk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_v5nxq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0mf44") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kb0hn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_o22ug") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_21q7w") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gitfl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8hg1o") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_niuoc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mt5ft") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ub7uo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2uxnl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bh4ts") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lcu0i") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mmqt1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_orode") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ricn8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6ftll") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fm4jy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7qcot") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2y47g") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gpr0t") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nn332") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jg384") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_g0wvw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e6fmf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_n1rtv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_365g3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_frkrx") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j8adw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_76fh7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gmmrx") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rlh42") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wijf7") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2n5hs") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yrp6k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w411h") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pe7po") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_sr5kq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kgesr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vfk6x") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4d1t3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6bexm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tadlo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_g2h20") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_x351d") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0jq3r") +}], +"loop": true, +"name": &"default", +"speed": 30.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_1eeyl") +}], +"loop": true, +"name": &"gray", +"speed": 5.0 +}] + +[node name="DebugNodeGroup" type="Node"] +editor_description = "This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input" +script = SubResource("GDScript_ak1tp") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +position = Vector2(389, 477.375) +scale = Vector2(0.14209, 0.14209) +sprite_frames = SubResource("SpriteFrames_kudgl") +frame_progress = 0.417812 + +[node name="Info" type="RichTextLabel" parent="."] +offset_left = 7.0 +offset_top = 6.0 +offset_right = 424.0 +offset_bottom = 312.0 +theme_override_font_sizes/normal_font_size = 14 +text = "Application ID : {id} +Details: {details} +State: {state} + +Large image key: {lkey} +Large image text: {ltext} +Small image key: {skey} +Small image text: {stext} + +Start timestamp: {stimestamp} +End timestamp: {etimestamp} + +Party ID: {partyid} +Current party size: {cpartysize} +Max party size: {mpartysize} +Match secret: {msecret} +Join secret: {jsecret} +Spectate secret: {ssecret} +Is party public: {ppublic} (needs to be activated in Discord client settings) + +Is instanced: {instanced} +" +fit_content = true + +[node name="PrintCurrentUserOnConsole" type="Button" parent="."] +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 7.0 +offset_top = 141.375 +offset_right = 240.0 +offset_bottom = 174.375 +grow_vertical = 2 +text = "Print current user on console" + +[node name="AcceptInviteRequest" type="Button" parent="."] +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 7.0 +offset_top = 178.875 +offset_right = 149.0 +offset_bottom = 209.875 +grow_vertical = 2 +text = "ACCEPT REQUEST" + +[node name="InviteWithUserID" type="LineEdit" parent="."] +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 6.0 +offset_top = 215.375 +offset_right = 205.0 +offset_bottom = 246.375 +grow_vertical = 2 +size_flags_horizontal = 0 +placeholder_text = "Invite with user_id here" + +[node name="AcceptWithUserID" type="LineEdit" parent="."] +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 6.0 +offset_top = 250.875 +offset_right = 255.0 +offset_bottom = 281.875 +grow_vertical = 2 +placeholder_text = "Accept Invite with user_id here" + +[connection signal="pressed" from="PrintCurrentUserOnConsole" to="." method="_on_button_2_pressed"] +[connection signal="pressed" from="AcceptInviteRequest" to="." method="_on_button_pressed"] +[connection signal="text_submitted" from="InviteWithUserID" to="." method="_on_line_edit_text_submitted"] +[connection signal="text_submitted" from="AcceptWithUserID" to="." method="_on_line_edit_2_text_submitted"] diff --git a/project/addons/discord-sdk-gd/nodes/DiscordSDKLoader.tscn b/project/addons/discord-sdk-gd/nodes/DiscordSDKLoader.tscn new file mode 100644 index 0000000..3900184 --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/DiscordSDKLoader.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://dkbtuqbtdlqnk"] + +[ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/core_updater.gd" id="1_8fjwg"] + +[node name="DiscordSDKLoader" type="Node"] +editor_description = "This always needs to run in the background if you want to comunicate with the discord client." +script = ExtResource("1_8fjwg") diff --git a/project/assets/Checked.svg b/project/addons/discord-sdk-gd/nodes/assets/Checked.svg similarity index 100% rename from project/assets/Checked.svg rename to project/addons/discord-sdk-gd/nodes/assets/Checked.svg diff --git a/project/assets/Checked.svg.import b/project/addons/discord-sdk-gd/nodes/assets/Checked.svg.import similarity index 73% rename from project/assets/Checked.svg.import rename to project/addons/discord-sdk-gd/nodes/assets/Checked.svg.import index d124dbf..bc9fc5a 100644 --- a/project/assets/Checked.svg.import +++ b/project/addons/discord-sdk-gd/nodes/assets/Checked.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dnfq6kug4x6o2" -path="res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex" +path="res://.godot/imported/Checked.svg-152467b95b56fa0b9944b5cc25700916.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://assets/Checked.svg" -dest_files=["res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/Checked.svg" +dest_files=["res://.godot/imported/Checked.svg-152467b95b56fa0b9944b5cc25700916.ctex"] [params] diff --git a/project/addons/discord-sdk-gd/nodes/assets/Debug.svg b/project/addons/discord-sdk-gd/nodes/assets/Debug.svg new file mode 100644 index 0000000..7987166 --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/assets/Debug.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/project/assets/Debug.svg.import b/project/addons/discord-sdk-gd/nodes/assets/Debug.svg.import similarity index 71% rename from project/assets/Debug.svg.import rename to project/addons/discord-sdk-gd/nodes/assets/Debug.svg.import index d7a25d4..8326210 100644 --- a/project/assets/Debug.svg.import +++ b/project/addons/discord-sdk-gd/nodes/assets/Debug.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://d1dntlgjiapde" -path="res://.godot/imported/Debug.svg-dbd0299514a2ed7480404c509868c103.ctex" +uid="uid://ufh1hha1ehui" +path="res://.godot/imported/Debug.svg-c87ff9d4b4b0e718ec457560f6c420dc.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://assets/Debug.svg" -dest_files=["res://.godot/imported/Debug.svg-dbd0299514a2ed7480404c509868c103.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/Debug.svg" +dest_files=["res://.godot/imported/Debug.svg-c87ff9d4b4b0e718ec457560f6c420dc.ctex"] [params] diff --git a/project/addons/discord-sdk-gd/nodes/assets/Group_1.svg b/project/addons/discord-sdk-gd/nodes/assets/Group_1.svg new file mode 100644 index 0000000..d01f59d --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/assets/Group_1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/project/assets/Core Updater.svg.import b/project/addons/discord-sdk-gd/nodes/assets/Group_1.svg.import similarity index 70% rename from project/assets/Core Updater.svg.import rename to project/addons/discord-sdk-gd/nodes/assets/Group_1.svg.import index bb6f9d1..69adaea 100644 --- a/project/assets/Core Updater.svg.import +++ b/project/addons/discord-sdk-gd/nodes/assets/Group_1.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://2no2ced378ds" -path="res://.godot/imported/Core Updater.svg-75aabb825d7cf085efdd2bf5760ba312.ctex" +uid="uid://c70jidlptani4" +path="res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://assets/Core Updater.svg" -dest_files=["res://.godot/imported/Core Updater.svg-75aabb825d7cf085efdd2bf5760ba312.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/Group_1.svg" +dest_files=["res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.ctex"] [params] diff --git a/project/assets/Unchecked.svg b/project/addons/discord-sdk-gd/nodes/assets/Unchecked.svg similarity index 100% rename from project/assets/Unchecked.svg rename to project/addons/discord-sdk-gd/nodes/assets/Unchecked.svg diff --git a/project/assets/Unchecked.svg.import b/project/addons/discord-sdk-gd/nodes/assets/Unchecked.svg.import similarity index 73% rename from project/assets/Unchecked.svg.import rename to project/addons/discord-sdk-gd/nodes/assets/Unchecked.svg.import index c6ca33e..43b3409 100644 --- a/project/assets/Unchecked.svg.import +++ b/project/addons/discord-sdk-gd/nodes/assets/Unchecked.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://compmm3kviqqe" -path="res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex" +path="res://.godot/imported/Unchecked.svg-91cff67e13e7a1508fbc6a949f5f5f52.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://assets/Unchecked.svg" -dest_files=["res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg" +dest_files=["res://.godot/imported/Unchecked.svg-91cff67e13e7a1508fbc6a949f5f5f52.ctex"] [params] diff --git a/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png b/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png new file mode 100644 index 0000000..ce00889 Binary files /dev/null and b/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png differ diff --git a/project/discord_pfp_cache/invitepfp.png.import b/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import similarity index 64% rename from project/discord_pfp_cache/invitepfp.png.import rename to project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import index ca4cc65..5bf804a 100644 --- a/project/discord_pfp_cache/invitepfp.png.import +++ b/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://lct8hsyc4bx6" -path="res://.godot/imported/invitepfp.png-a7b335dc42426751624b97336b7117a8.ctex" +uid="uid://cq8lwj2matk6x" +path="res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://discord_pfp_cache/invitepfp.png" -dest_files=["res://.godot/imported/invitepfp.png-a7b335dc42426751624b97336b7117a8.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png" +dest_files=["res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex"] [params] diff --git a/project/addons/discord-sdk-gd/nodes/core_updater.gd b/project/addons/discord-sdk-gd/nodes/core_updater.gd new file mode 100644 index 0000000..fda168e --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/core_updater.gd @@ -0,0 +1,8 @@ +## This always needs to run in the background if you want to comunicate with the discord client. +extends Node + +@export var is_running: bool =false + +func _process(delta) -> void: + discord_sdk.coreupdate() + is_running = true diff --git a/project/addons/discord-sdk-gd/nodes/debug.gd b/project/addons/discord-sdk-gd/nodes/debug.gd new file mode 100644 index 0000000..0c67774 --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/debug.gd @@ -0,0 +1,6 @@ +## This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input +extends Node + +func _ready() -> void: + const DebugNodeGroup: PackedScene = preload("res://addons/discord-sdk-gd/nodes/Debug.tscn") + add_child(DebugNodeGroup.instantiate()) diff --git a/project/addons/discord-sdk-gd/plugin.cfg b/project/addons/discord-sdk-gd/plugin.cfg index 0b98cc2..fdf7115 100644 --- a/project/addons/discord-sdk-gd/plugin.cfg +++ b/project/addons/discord-sdk-gd/plugin.cfg @@ -3,5 +3,5 @@ name="DiscordSDK" description="Discord Game SDK support for GDScript in Godot" author="vaporvee" -version="1.5" +version="2.0" script="plugin.gd" diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index 12cf41b..1bea3ee 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -1,13 +1,47 @@ @tool extends EditorPlugin -const ExportPlugin = preload("export.gd") +const DiscordSDKLoader = preload("res://addons/discord-sdk-gd/nodes/core_updater.gd") +const DiscordSDKLoader_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Group_1.svg") +var loaded_DiscordSDKLoader = DiscordSDKLoader.new() + +const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd") +const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg") +var loaded_DiscordSDKDebug = DiscordSDKDebug.new() + + +const ExportPlugin = preload("res://addons/discord-sdk-gd/export.gd") var loaded_exportplugin = ExportPlugin.new() -func _enter_tree(): - add_autoload_singleton("updater_discordsdk", "res://addons/discord-sdk-gd/sdk_utility.gd") - add_export_plugin(loaded_exportplugin) -func disable_plugin(): - remove_autoload_singleton("updater_discordsdk") - remove_export_plugin(loaded_exportplugin) +func _enable_plugin() -> void: + print("DiscordSDK Addon got enabled") + add_custom_type("DiscordSDKLoader","Node",DiscordSDKLoader,DiscordSDKLoader_icon) + add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) + add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd") + add_export_plugin(loaded_exportplugin) + + ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) + + ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) + ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) + +func _disable_plugin() -> void: + print("DiscordSDK Addon got disabled") + remove_autoload_singleton("DiscordSDKLoader") + remove_custom_type("DiscordSDKLoader") + remove_custom_type("DiscordSDKDebug") + ProjectSettings.clear("DiscordSDK/EditorPresence/enabled") + +func _process(_delta): + if(ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled")&&!get_editor_interface().is_playing_scene()): + if(discord_sdk.app_id != 1108142249990176808): + discord_sdk.app_id = 1108142249990176808 + discord_sdk.details = ProjectSettings.get_setting("application/config/name") + discord_sdk.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\"" + discord_sdk.large_image = "godot" + discord_sdk.large_image_text = str(Engine.get_version_info()) + discord_sdk.start_timestamp = int(Time.get_unix_time_from_system()) + discord_sdk.refresh() + if(discord_sdk.app_id == 1108142249990176808): + discord_sdk.coreupdate() diff --git a/project/addons/discord-sdk-gd/sdk_utility.gd b/project/addons/discord-sdk-gd/sdk_utility.gd deleted file mode 100644 index be8b542..0000000 --- a/project/addons/discord-sdk-gd/sdk_utility.gd +++ /dev/null @@ -1,4 +0,0 @@ -extends Node - -func _process(delta) -> void: - discord_sdk.coreupdate() diff --git a/project/assets/Core Updater.png b/project/assets/Core Updater.png deleted file mode 100644 index 1370f02..0000000 Binary files a/project/assets/Core Updater.png and /dev/null differ diff --git a/project/assets/Core Updater.png.import b/project/assets/Core Updater.png.import deleted file mode 100644 index 2c54d11..0000000 --- a/project/assets/Core Updater.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://cm3gqnd84wbvu" -path="res://.godot/imported/Core Updater.png-3bb461d6b6e9b42b926c572ac9a4a10f.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Core Updater.png" -dest_files=["res://.godot/imported/Core Updater.png-3bb461d6b6e9b42b926c572ac9a4a10f.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 diff --git a/project/assets/Core Updater.svg b/project/assets/Core Updater.svg deleted file mode 100644 index 3d5d9fe..0000000 --- a/project/assets/Core Updater.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/project/assets/Debug.png b/project/assets/Debug.png deleted file mode 100644 index 9ecdfa8..0000000 Binary files a/project/assets/Debug.png and /dev/null differ diff --git a/project/assets/Debug.png.import b/project/assets/Debug.png.import deleted file mode 100644 index b2ab25d..0000000 --- a/project/assets/Debug.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://b5dn3rnp5eqqp" -path="res://.godot/imported/Debug.png-81b23c4a8a55e89d458626f08de3d2fb.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://assets/Debug.png" -dest_files=["res://.godot/imported/Debug.png-81b23c4a8a55e89d458626f08de3d2fb.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 diff --git a/project/assets/Debug.svg b/project/assets/Debug.svg deleted file mode 100644 index 33eef54..0000000 --- a/project/assets/Debug.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/project/discord_pfp_cache/invitepfp.png b/project/discord_pfp_cache/invitepfp.png deleted file mode 100644 index 7e644f0..0000000 Binary files a/project/discord_pfp_cache/invitepfp.png and /dev/null differ diff --git a/project/main.gd b/project/main.gd index c78e1f2..8354aa4 100644 --- a/project/main.gd +++ b/project/main.gd @@ -1,28 +1,13 @@ extends Node -var invite_pfp - -func _ready(): +func _ready() -> void: 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) - download_texture("https://cdn.discordapp.com/embed/avatars/1.png", "res://discord_pfp_cache/invitepfp.png") - debug_text_update() - print(discord_sdk.get_current_user()) -func download_texture(url, file_name): - $user_request_avatar/HTTPRequest.download_file = file_name - invite_pfp = file_name - $user_request_avatar/HTTPRequest.request(url) - -func _on_http_request_request_completed(_result, _response_code, _headers, _body): - var image = Image.new() - image.load(str(invite_pfp)) - var texture = ImageTexture.create_from_image(image) - $user_request_avatar.texture = texture - -func set_activity(): +func set_activity() -> void: + discord_sdk.clear() discord_sdk.app_id = 1099618430065324082 discord_sdk.details = "A demo activity by vaporvee#1231" discord_sdk.state = "Checkpoint 23/23" @@ -32,11 +17,10 @@ func set_activity(): discord_sdk.small_image = "boss" discord_sdk.small_image_text = "Fighting the end boss! D:" discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time - print(discord_sdk.get_is_overlay_enabled()) # It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server # understands and returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others. - var my_secret = str(randi_range(0,999999)) + var my_secret: String = str(randi_range(0,999999)) discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret discord_sdk.current_party_size = 1 @@ -51,18 +35,13 @@ func set_activity(): #discord_sdk.register_steam(1389990) discord_sdk.refresh() -func debug_text_update(): - $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)) +var user_request: Dictionary; -var user_request = {}; - -func _on_activity_join_request(user_requesting): +func _on_activity_join_request(user_requesting) -> void: print(user_requesting) user_request = user_requesting - print(user_requesting.avatar_url) - download_texture(user_requesting.avatar_url, "res://discord_pfp_cache/invitepfp.png") -func _on_activity_join(secret): +func _on_activity_join(secret) -> void: if(discord_sdk.join_secret != secret): discord_sdk.current_party_size = clamp(int(secret) + 1, 0, discord_sdk.max_party_size) discord_sdk.party_id = secret.replace("j_","mylobbycanbeeverything_") @@ -70,31 +49,12 @@ func _on_activity_join(secret): 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)) - debug_text_update() -func _on_activity_spectate(secret): +func _on_activity_spectate(secret) -> void: print(secret) - -func _on_check_button_toggled(button_pressed): + +func _on_toggle_sdk_toggled(button_pressed): if(button_pressed): set_activity() else: discord_sdk.clear() - -func _on_button_pressed(): - if(!user_request.is_empty()): - discord_sdk.accept_join_request(user_request.id) - -func _on_line_edit_text_submitted(new_text): - discord_sdk.send_invite(int(new_text),true,"this is a test invite sent from godot") - print(int(new_text)) - - -func _on_line_edit_2_text_submitted(new_text): - discord_sdk.accept_invite(int(new_text)) - print(int(new_text)) - - -func _on_button_2_pressed(): - print(discord_sdk.get_current_user()) diff --git a/project/main.tscn b/project/main.tscn index 56e7b5e..5d6c8ba 100644 --- a/project/main.tscn +++ b/project/main.tscn @@ -1,12 +1,12 @@ -[gd_scene load_steps=7 format=3 uid="uid://dmx2xuigcpvt4"] +[gd_scene load_steps=7 format=3 uid="uid://dyc3kseph4el7"] [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"] -[ext_resource type="Texture2D" uid="uid://ht210p8vs8s7" path="res://assets/1.png" id="5_06yyg"] +[ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"] +[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://addons/discord-sdk-gd/nodes/assets/Checked.svg" id="3_wajuo"] +[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg" id="4_8hvtu"] +[ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/debug.gd" id="6_ujijw"] -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1w3f4"] +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phc3u"] [node name="Node" type="Node"] script = ExtResource("1_kl8ri") @@ -25,7 +25,7 @@ color = Color(0.345098, 0.396078, 0.94902, 1) texture_filter = 4 position = Vector2(580, 308) scale = Vector2(0.408203, 0.408203) -texture = ExtResource("2_1hv5q") +texture = ExtResource("2_gd222") [node name="DiscordSDK Test" type="RichTextLabel" parent="."] anchors_preset = -1 @@ -41,116 +41,25 @@ grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 4 size_flags_vertical = 4 -theme_override_colors/font_outline_color = Color(1, 1, 1, 1) -theme_override_constants/outline_size = 10 bbcode_enabled = true -text = "[center][font s=60][rainbow]DiscordSDK Test[/rainbow][/font]" +text = "[center][font s=60]DiscordSDK Test" -[node name="Info" type="RichTextLabel" parent="."] -offset_left = 7.0 -offset_top = 6.0 -offset_right = 424.0 -offset_bottom = 312.0 -text = "Discord working: {discordinfo} +[node name="DiscordSDKDebug" type="Node" parent="."] +script = ExtResource("6_ujijw") -Application ID : {id} -Details: {details} -State: {state} - -Large image key: {lkey} -Large image text: {ltext} -Small image key: {skey} -Small image text: {stext} - -Start timestamp: {stimestamp} -End timestamp: {etimestamp} - -Party ID: {partyid} -Current party size: {cpartysize} -Max party size: {mpartysize} -Match secret: {msecret} -Join secret: {jsecret} -Spectate secret: {ssecret}" - -[node name="CheckButton" type="CheckButton" parent="."] -anchors_preset = -1 -anchor_left = 0.484 -anchor_top = 0.781 -anchor_right = 0.521 -anchor_bottom = 0.82 -offset_left = 0.431946 -offset_top = -0.0880127 -offset_right = 803.808 -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 - -[node name="user_request_avatar" type="Sprite2D" parent="."] -position = Vector2(662, 559) -scale = Vector2(0.152344, 0.152344) -texture = ExtResource("5_06yyg") - -[node name="HTTPRequest" type="HTTPRequest" parent="user_request_avatar"] - -[node name="Button" type="Button" parent="."] -anchors_preset = -1 -anchor_left = 0.437 -anchor_top = 0.844 -anchor_right = 0.562 -anchor_bottom = 0.892 -offset_left = 0.575989 -offset_top = 0.0879517 -offset_right = -1.42395 -offset_bottom = -0.0159912 -grow_horizontal = 2 -grow_vertical = 0 -text = "ACCEPT REQUEST" - -[node name="LineEdit" type="LineEdit" parent="."] -anchors_preset = -1 -anchor_left = 0.416 -anchor_top = 0.904 -anchor_right = 0.584 -anchor_bottom = 0.952 -offset_left = 0.268005 -offset_top = 0.207947 -offset_right = -0.268066 -offset_bottom = 0.104004 -grow_horizontal = 2 -grow_vertical = 0 -placeholder_text = "Invite with user_id here" - -[node name="LineEdit2" type="LineEdit" parent="."] -anchors_preset = 7 -anchor_left = 0.5 -anchor_top = 1.0 -anchor_right = 0.5 -anchor_bottom = 1.0 -offset_left = -124.0 -offset_top = -31.0 -offset_right = 125.0 -grow_horizontal = 2 -grow_vertical = 0 -placeholder_text = "Accept Invite with user_id here" - -[node name="Button2" type="Button" parent="."] +[node name="ToggleSDK" type="CheckButton" parent="."] anchors_preset = 4 anchor_top = 0.5 anchor_bottom = 0.5 -offset_top = -4.0 -offset_right = 136.0 -offset_bottom = 29.0 +offset_left = 293.0 +offset_top = 142.375 +offset_right = 1139.0 +offset_bottom = 650.375 grow_vertical = 2 -text = "Get current user" +scale = Vector2(0.05, 0.05) +theme_override_icons/checked = ExtResource("3_wajuo") +theme_override_icons/unchecked = ExtResource("4_8hvtu") +theme_override_styles/focus = SubResource("StyleBoxEmpty_phc3u") +button_pressed = true -[connection signal="toggled" from="CheckButton" to="." method="_on_check_button_toggled"] -[connection signal="request_completed" from="user_request_avatar/HTTPRequest" to="." method="_on_http_request_request_completed"] -[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] -[connection signal="text_submitted" from="LineEdit" to="." method="_on_line_edit_text_submitted"] -[connection signal="text_submitted" from="LineEdit2" to="." method="_on_line_edit_2_text_submitted"] -[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"] +[connection signal="toggled" from="ToggleSDK" to="." method="_on_toggle_sdk_toggled"] diff --git a/project/project.godot b/project/project.godot index 9c69244..e0c93bb 100644 --- a/project/project.godot +++ b/project/project.godot @@ -20,7 +20,7 @@ config/icon="res://assets/Logo_V2.png" [autoload] -updater_discordsdk="*res://addons/discord-sdk-gd/sdk_utility.gd" +DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/core_updater.gd" [display] @@ -44,5 +44,4 @@ paths=["res://example.gdextension"] [rendering] -renderer/rendering_method="gl_compatibility" environment/defaults/default_environment="res://default_env.tres" diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp index 33f3b70..ee52c92 100644 --- a/src/discordgodot.cpp +++ b/src/discordgodot.cpp @@ -179,7 +179,7 @@ void discord_sdk::set_app_id(int64_t value) if(String(user_requesting["avatar"]).is_empty()) user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((user_requesting["discriminator"].INT % 5) - 1)+ ".png").c_str()); else - user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str()); + user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str());//I don't know what the hell i did there but removing ?size=512 will crash the whole editor user_requesting.make_read_only(); discord_sdk::get_singleton() ->emit_signal("activity_join_request",user_requesting); }); @@ -238,13 +238,15 @@ void discord_sdk::clear() small_image_text = ""; start_timestamp = 0; end_timestamp = 0; - party_id = "-"; + party_id = ""; current_party_size = 0; max_party_size = 0; match_secret = ""; join_secret = ""; spectate_secret = ""; instanced = false; + is_public_party = false; + is_overlay_locked = false; delete core; core = nullptr; diff --git a/src/discordgodot.h b/src/discordgodot.h index 8af2d8d..cbc1da7 100644 --- a/src/discordgodot.h +++ b/src/discordgodot.h @@ -38,7 +38,7 @@ private: String join_secret; String spectate_secret; - bool is_public_party = true; + bool is_public_party; bool instanced;