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 7f9c787..d574699 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 2d23261..53942aa 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/nodes/Debug.tscn b/project/addons/discord-sdk-gd/nodes/Debug.tscn index 8d5fabf..2b2acb9 100644 --- a/project/addons/discord-sdk-gd/nodes/Debug.tscn +++ b/project/addons/discord-sdk-gd/nodes/Debug.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=68 format=3 uid="uid://c1slhdnlsv2qt"] +[gd_scene load_steps=9 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"] +[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://addons/discord-sdk-gd/nodes/assets/Checked.svg" id="2_q6tao"] +[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg" id="3_5cyem"] +[ext_resource type="Texture2D" uid="uid://dtc6ckladq0td" path="res://addons/discord-sdk-gd/nodes/assets/circle.svg" id="3_goflf"] [sub_resource type="GDScript" id="GDScript_ak1tp"] resource_name = "Debug" @@ -11,15 +13,16 @@ func _ready(): func _process(_delta): if(discord_sdk.get_is_discord_working()): - $AnimatedSprite2D.play(\"default\") + $Panel/TextureRect.self_modulate = Color(\"#3eff8d\") + $Panel/TextureRect/AnimationPlayer.play(\"pulsate\") debug_text_update() else: - $AnimatedSprite2D.stop() - $AnimatedSprite2D.animation = \"gray\" + $Panel/TextureRect.self_modulate = Color(\"#797979\") + $Panel/TextureRect/AnimationPlayer.stop() debug_text_update() func debug_text_update(): - $Info.text = \"Application ID : {id} + $Panel/Info.text = \"Application ID : {id} Details: {details} State: {state} @@ -41,7 +44,7 @@ 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)) + $Panel/Info.text = $Panel/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 = {}; @@ -49,504 +52,86 @@ func _on_activity_join_request(user_requesting): print(user_requesting) user_request = user_requesting -func _on_button_pressed(): +func _on_accept_join_request_pressed(): if(!user_request.is_empty()): discord_sdk.accept_join_request(user_request.id) -func _on_line_edit_text_submitted(new_text): +func _on_invite_with_user_id_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): +func _on_accept_with_user_id_text_submitted(new_text): discord_sdk.accept_invite(int(new_text)) -func _on_button_2_pressed(): +func _on_print_current_user_on_console_pressed(): print(discord_sdk.get_current_user()) -func _on_check_button_toggled(button_pressed): +func _on_toggle_sdk_toggled(button_pressed): if(button_pressed): debug_text_update() + discord_sdk.unclear() 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="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"] -[sub_resource type="AtlasTexture" id="AtlasTexture_vv4mb"] -atlas = ExtResource("4_gvc3o") -region = Rect2(1024, 0, 512, 512) +[sub_resource type="Animation" id="Animation_mmtmn"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0.4), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0.5, 0.5)] +} -[sub_resource type="AtlasTexture" id="AtlasTexture_kwv3j"] -atlas = ExtResource("4_gvc3o") -region = Rect2(1536, 0, 512, 512) +[sub_resource type="Animation" id="Animation_5u02v"] +resource_name = "pulsate" +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5, 1), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0.5, 0.5), Vector2(0.8, 0.8), Vector2(0.5, 0.5)] +} -[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 -}] +[sub_resource type="AnimationLibrary" id="AnimationLibrary_a7ofc"] +_data = { +"RESET": SubResource("Animation_mmtmn"), +"pulsate": SubResource("Animation_5u02v") +} [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="Panel" type="Panel" parent="."] +anchors_preset = -1 +anchor_right = 0.373 +anchor_bottom = 1.0 +offset_left = -5.0 +offset_right = 0.303955 +grow_horizontal = 2 +grow_vertical = 2 -[node name="Info" type="RichTextLabel" parent="."] -offset_left = 7.0 -offset_top = 6.0 -offset_right = 424.0 -offset_bottom = 312.0 +[node name="Info" type="RichTextLabel" parent="Panel"] +layout_mode = 0 +offset_left = 12.0 +offset_top = 21.0 +offset_right = 429.0 +offset_bottom = 461.0 theme_override_font_sizes/normal_font_size = 14 text = "Application ID : {id} Details: {details} @@ -572,52 +157,96 @@ Is instanced: {instanced} " fit_content = true -[node name="PrintCurrentUserOnConsole" type="Button" parent="."] +[node name="PrintCurrentUserOnConsole" type="Button" parent="Panel"] +layout_mode = 1 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 +offset_left = 12.0 +offset_top = 156.375 +offset_right = 245.0 +offset_bottom = 189.375 grow_vertical = 2 text = "Print current user on console" -[node name="AcceptInviteRequest" type="Button" parent="."] +[node name="AcceptJoinRequest" type="Button" parent="Panel"] +layout_mode = 1 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 +offset_left = 12.0 +offset_top = 193.875 +offset_right = 154.0 +offset_bottom = 224.875 grow_vertical = 2 text = "ACCEPT REQUEST" -[node name="InviteWithUserID" type="LineEdit" parent="."] +[node name="InviteWithUserID" type="LineEdit" parent="Panel"] +layout_mode = 1 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 +offset_left = 11.0 +offset_top = 230.375 +offset_right = 210.0 +offset_bottom = 261.375 grow_vertical = 2 size_flags_horizontal = 0 placeholder_text = "Invite with user_id here" -[node name="AcceptWithUserID" type="LineEdit" parent="."] +[node name="AcceptWithUserID" type="LineEdit" parent="Panel"] +layout_mode = 1 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 +offset_left = 11.0 +offset_top = 265.875 +offset_right = 260.0 +offset_bottom = 296.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"] +[node name="ToggleSDK" type="CheckButton" parent="Panel"] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 298.0 +offset_top = 157.375 +offset_right = 1144.0 +offset_bottom = 665.375 +grow_vertical = 2 +scale = Vector2(0.05, 0.05) +theme_override_icons/checked = ExtResource("2_q6tao") +theme_override_icons/unchecked = ExtResource("3_5cyem") +theme_override_styles/focus = SubResource("StyleBoxEmpty_8abo6") +button_pressed = true + +[node name="TextureRect" type="TextureRect" parent="Panel"] +self_modulate = Color(0.47451, 0.47451, 0.47451, 1) +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.88 +anchor_top = 0.762 +anchor_right = 0.88 +anchor_bottom = 0.762 +offset_left = -28.8 +offset_top = -28.776 +offset_right = 28.0841 +offset_bottom = 28.1082 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.5, 0.5) +pivot_offset = Vector2(29.0693, 29.0693) +texture = ExtResource("3_goflf") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Panel/TextureRect"] +libraries = { +"": SubResource("AnimationLibrary_a7ofc") +} + +[connection signal="pressed" from="Panel/PrintCurrentUserOnConsole" to="." method="_on_print_current_user_on_console_pressed"] +[connection signal="pressed" from="Panel/AcceptJoinRequest" to="." method="_on_accept_join_request_pressed"] +[connection signal="text_submitted" from="Panel/InviteWithUserID" to="." method="_on_invite_with_user_id_text_submitted"] +[connection signal="text_submitted" from="Panel/AcceptWithUserID" to="." method="_on_accept_with_user_id_text_submitted"] +[connection signal="toggled" from="Panel/ToggleSDK" to="." method="_on_toggle_sdk_toggled"] diff --git a/project/addons/discord-sdk-gd/nodes/assets/circle.svg b/project/addons/discord-sdk-gd/nodes/assets/circle.svg new file mode 100644 index 0000000..acd3753 --- /dev/null +++ b/project/addons/discord-sdk-gd/nodes/assets/circle.svg @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import b/project/addons/discord-sdk-gd/nodes/assets/circle.svg.import similarity index 60% rename from project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import rename to project/addons/discord-sdk-gd/nodes/assets/circle.svg.import index 5bf804a..d7598a8 100644 --- a/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png.import +++ b/project/addons/discord-sdk-gd/nodes/assets/circle.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://cq8lwj2matk6x" -path="res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex" +uid="uid://dtc6ckladq0td" +path="res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png" -dest_files=["res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex"] +source_file="res://addons/discord-sdk-gd/nodes/assets/circle.svg" +dest_files=["res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex"] [params] @@ -32,3 +32,6 @@ 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/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png b/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png deleted file mode 100644 index ce00889..0000000 Binary files a/project/addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png and /dev/null differ diff --git a/project/addons/discord-sdk-gd/nodes/debug.gd b/project/addons/discord-sdk-gd/nodes/debug.gd index 4b323a7..a4e8ee0 100644 --- a/project/addons/discord-sdk-gd/nodes/debug.gd +++ b/project/addons/discord-sdk-gd/nodes/debug.gd @@ -3,6 +3,7 @@ ## The DiscordSDK Debug Node will show info about the current values of its variables and some buttons to change them. ## ## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki +@tool extends Node func _ready() -> void: diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index fb8b99e..73ff77b 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -13,6 +13,7 @@ func _enter_tree() -> void: func _enable_plugin() -> void: print("DiscordSDK Addon got enabled (PLEASE RESTART THE EDITOR)") ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) + ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true) ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) diff --git a/project/export_presets.cfg b/project/export_presets.cfg index 983ae28..ccf6593 100644 --- a/project/export_presets.cfg +++ b/project/export_presets.cfg @@ -8,18 +8,17 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../exportestt/discord_sdk_demo.exe" +export_path="../../testexpoort/discord_sdk_demo.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false encrypt_directory=false -script_encryption_key="" [preset.0.options] custom_template/debug="" custom_template/release="" -debug/export_console_script=1 +debug/export_console_wrapper=1 binary_format/embed_pck=true texture_format/bptc=true texture_format/s3tc=true @@ -27,9 +26,6 @@ texture_format/etc=false texture_format/etc2=false binary_format/architecture="x86_64" codesign/enable=false -codesign/identity_type=0 -codesign/identity="" -codesign/password="" codesign/timestamp=true codesign/timestamp_server_url="" codesign/digest_algorithm=1 diff --git a/project/main.gd b/project/main.gd index 8354aa4..c8fba9a 100644 --- a/project/main.gd +++ b/project/main.gd @@ -1,6 +1,7 @@ extends Node func _ready() -> void: + print(discord_sdk.get_current_user()) set_activity() discord_sdk.connect("activity_join_request",_on_activity_join_request) discord_sdk.connect("activity_join",_on_activity_join) @@ -52,9 +53,3 @@ func _on_activity_join(secret) -> void: func _on_activity_spectate(secret) -> void: print(secret) - -func _on_toggle_sdk_toggled(button_pressed): - if(button_pressed): - set_activity() - else: - discord_sdk.clear() diff --git a/project/main.tscn b/project/main.tscn index 5d6c8ba..662b902 100644 --- a/project/main.tscn +++ b/project/main.tscn @@ -1,13 +1,9 @@ -[gd_scene load_steps=7 format=3 uid="uid://dyc3kseph4el7"] +[gd_scene load_steps=4 format=3 uid="uid://dyc3kseph4el7"] [ext_resource type="Script" path="res://main.gd" id="1_kl8ri"] [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_phc3u"] - [node name="Node" type="Node"] script = ExtResource("1_kl8ri") @@ -23,7 +19,7 @@ color = Color(0.345098, 0.396078, 0.94902, 1) [node name="Sprite2D" type="Sprite2D" parent="."] texture_filter = 4 -position = Vector2(580, 308) +position = Vector2(789, 330.5) scale = Vector2(0.408203, 0.408203) texture = ExtResource("2_gd222") @@ -33,10 +29,10 @@ anchor_left = 0.293 anchor_top = 0.59 anchor_right = 0.736 anchor_bottom = 0.727 -offset_left = -0.536011 -offset_top = -0.319977 -offset_right = 0.12793 -offset_bottom = -0.0960388 +offset_left = 208.464 +offset_top = 22.18 +offset_right = 209.128 +offset_bottom = 22.4039 grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 4 @@ -46,20 +42,3 @@ text = "[center][font s=60]DiscordSDK Test" [node name="DiscordSDKDebug" type="Node" parent="."] script = ExtResource("6_ujijw") - -[node name="ToggleSDK" type="CheckButton" parent="."] -anchors_preset = 4 -anchor_top = 0.5 -anchor_bottom = 0.5 -offset_left = 293.0 -offset_top = 142.375 -offset_right = 1139.0 -offset_bottom = 650.375 -grow_vertical = 2 -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="ToggleSDK" to="." method="_on_toggle_sdk_toggled"] diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp index ee52c92..338ec35 100644 --- a/src/discordgodot.cpp +++ b/src/discordgodot.cpp @@ -84,7 +84,8 @@ void discord_sdk::_bind_methods() ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting"))); ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh); - ClassDB::bind_method(D_METHOD("clear"), &discord_sdk::clear); + ClassDB::bind_method(D_METHOD("clear", "reset_values"), &discord_sdk::clear, false); + ClassDB::bind_method(D_METHOD("unclear"), &discord_sdk::unclear); ClassDB::bind_method(D_METHOD("register_command", "command"), &discord_sdk::register_command); ClassDB::bind_method(D_METHOD("register_steam", "steam_id"), &discord_sdk::register_steam); @@ -154,23 +155,25 @@ void discord_sdk::debug() void discord_sdk::set_app_id(int64_t value) { app_id = value; - result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything - - if (result == discord::Result::Ok && app_id > 0) + if (app_id > 0) { - // initialize currentuser stuff - core->UserManager().OnCurrentUserUpdate.Connect([]() - {discord::User user{}; - core->UserManager().GetCurrentUser(&user); }); - // signals - core->ActivityManager().OnActivityJoin.Connect([](const char *secret) - { discord_sdk::get_singleton() - ->emit_signal("activity_join", secret); }); - core->ActivityManager().OnActivitySpectate.Connect([](const char *secret) + result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything + + if (result == discord::Result::Ok) + { + // initialize currentuser stuff + core->UserManager().OnCurrentUserUpdate.Connect([]() + {discord::User user{}; + core->UserManager().GetCurrentUser(&user); }); + // signals + core->ActivityManager().OnActivityJoin.Connect([](const char *secret) { discord_sdk::get_singleton() - ->emit_signal("activity_spectate", secret); }); - core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user) - { Dictionary user_requesting; + ->emit_signal("activity_join", secret); }); + core->ActivityManager().OnActivitySpectate.Connect([](const char *secret) + { discord_sdk::get_singleton() + ->emit_signal("activity_spectate", secret); }); + core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user) + { Dictionary user_requesting; user_requesting["avatar"] = user.GetAvatar(); //can be empty when user has no avatar user_requesting["is_bot"] = user.GetBot(); user_requesting["discriminator"] = user.GetDiscriminator(); @@ -184,9 +187,10 @@ void discord_sdk::set_app_id(int64_t value) discord_sdk::get_singleton() ->emit_signal("activity_join_request",user_requesting); }); - core->OverlayManager().OnToggle.Connect([](bool is_locked) - { discord_sdk::get_singleton() - ->emit_signal("overlay_toggle", is_locked); }); + core->OverlayManager().OnToggle.Connect([](bool is_locked) + { discord_sdk::get_singleton() + ->emit_signal("overlay_toggle", is_locked); }); + } } } int64_t discord_sdk::get_app_id() @@ -225,34 +229,52 @@ void discord_sdk::refresh() UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!"); } -void discord_sdk::clear() +void discord_sdk::clear(bool reset_values = false) { 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; - is_public_party = false; - is_overlay_locked = false; - + if (reset_values) + { + old_app_id = 0; + set_state(""); + set_details(""); + set_large_image(""); + set_large_image_text(""); + set_small_image(""); + set_small_image_text(""); + set_start_timestamp(0); + set_end_timestamp(0); + set_party_id(""); + set_current_party_size(0); + set_max_party_size(0); + set_match_secret(""); + set_join_secret(""); + set_spectate_secret(""); + set_instanced(false); + set_is_public_party(false); + set_is_overlay_locked(false); + core->ActivityManager().ClearActivity([](discord::Result result) {}); + } + else + old_app_id = app_id; + set_app_id(0); delete core; core = nullptr; } } +void discord_sdk::unclear() +{ + if (old_app_id > 0) + { + set_app_id(old_app_id); + refresh(); + old_app_id = 0; + } + else + UtilityFunctions::push_warning("Discord Activity couldn't be uncleared. Maybe it didn't get cleared before?"); +} + void discord_sdk::set_large_image(String value) { large_image = value; @@ -463,7 +485,7 @@ Dictionary discord_sdk::get_current_user() if (String(userdict["avatar"]).is_empty()) userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str()); else - userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str()); + userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png").c_str()); userdict.make_read_only(); } return userdict; diff --git a/src/discordgodot.h b/src/discordgodot.h index 1e08a39..16dfeb2 100644 --- a/src/discordgodot.h +++ b/src/discordgodot.h @@ -54,8 +54,9 @@ public: void debug(); void coreupdate(); void refresh(); - void clear(); - + void clear(bool reset_values); + int64_t old_app_id; + void unclear(); int64_t get_app_id(); void set_app_id(int64_t value); String get_state();