Debug.tscn 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. [gd_scene load_steps=9 format=3 uid="uid://c1slhdnlsv2qt"]
  2. [ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://addons/discord-rpc-gd/nodes/assets/Checked.svg" id="2_q6tao"]
  3. [ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://addons/discord-rpc-gd/nodes/assets/Unchecked.svg" id="3_5cyem"]
  4. [ext_resource type="Texture2D" uid="uid://dtc6ckladq0td" path="res://addons/discord-rpc-gd/nodes/assets/circle.svg" id="3_goflf"]
  5. [sub_resource type="GDScript" id="GDScript_ak1tp"]
  6. resource_name = "Debug"
  7. script/source = "extends Node
  8. func _ready():
  9. DiscordRPC.connect(\"activity_join_request\",_on_activity_join_request)
  10. func _process(_delta):
  11. if(DiscordRPC.get_is_discord_working()):
  12. $Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
  13. $Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
  14. debug_text_update()
  15. else:
  16. $Panel/TextureRect.self_modulate = Color(\"#797979\")
  17. $Panel/TextureRect/AnimationPlayer.stop()
  18. debug_text_update()
  19. func debug_text_update():
  20. $Panel/Info.text = \"Application ID : {id}
  21. Details: {details}
  22. State: {state}
  23. Large image key: {lkey}
  24. Large image text: {ltext}
  25. Small image key: {skey}
  26. Small image text: {stext}
  27. Start timestamp: {stimestamp}
  28. End timestamp: {etimestamp}
  29. Party ID: {partyid}
  30. Current party size: {cpartysize}
  31. Max party size: {mpartysize}
  32. Match secret: {msecret}
  33. Join secret: {jsecret}
  34. Spectate secret: {ssecret}
  35. Is party public: {ppublic} (needs to be activated in Discord client settings)
  36. Is instanced: {instanced}
  37. \"
  38. $Panel/Info.text = $Panel/Info.text.replace(\"{ppublic}\",str(DiscordRPC.is_public_party)).replace(\"{instanced}\",str(DiscordRPC.instanced)).replace(\"{ssecret}\",DiscordRPC.spectate_secret).replace(\"{jsecret}\",DiscordRPC.join_secret).replace(\"{msecret}\",DiscordRPC.match_secret).replace(\"{mpartysize}\",str(DiscordRPC.max_party_size)).replace(\"{cpartysize}\",str(DiscordRPC.current_party_size)).replace(\"{partyid}\",DiscordRPC.party_id).replace(\"{id}\",str(DiscordRPC.app_id)).replace(\"{details}\",DiscordRPC.details).replace(\"{state}\",DiscordRPC.state).replace(\"{lkey}\",DiscordRPC.large_image).replace(\"{ltext}\",DiscordRPC.large_image_text).replace(\"{skey}\",DiscordRPC.small_image).replace(\"{stext}\",DiscordRPC.small_image_text).replace(\"{stimestamp}\",str(DiscordRPC.start_timestamp)).replace(\"{etimestamp}\",str(DiscordRPC.end_timestamp))
  39. var user_request = {};
  40. func _on_activity_join_request(user_requesting):
  41. print(user_requesting)
  42. user_request = user_requesting
  43. func _on_accept_join_request_pressed():
  44. if(!user_request.is_empty()):
  45. DiscordRPC.accept_join_request(user_request.id)
  46. func _on_invite_with_user_id_text_submitted(new_text):
  47. DiscordRPC.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
  48. func _on_accept_with_user_id_text_submitted(new_text):
  49. DiscordRPC.accept_invite(int(new_text))
  50. func _on_print_current_user_on_console_pressed():
  51. print(DiscordRPC.get_current_user())
  52. func _on_toggle_sdk_toggled(button_pressed):
  53. if(button_pressed):
  54. DiscordRPC.unclear()
  55. else:
  56. DiscordRPC.clear(false)
  57. func _on_print_friends_pressed():
  58. print(DiscordRPC.get_all_relationships())
  59. "
  60. [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
  61. [sub_resource type="Animation" id="Animation_mmtmn"]
  62. length = 0.001
  63. tracks/0/type = "value"
  64. tracks/0/imported = false
  65. tracks/0/enabled = true
  66. tracks/0/path = NodePath(".:scale")
  67. tracks/0/interp = 1
  68. tracks/0/loop_wrap = true
  69. tracks/0/keys = {
  70. "times": PackedFloat32Array(0.4),
  71. "transitions": PackedFloat32Array(1),
  72. "update": 0,
  73. "values": [Vector2(0.5, 0.5)]
  74. }
  75. [sub_resource type="Animation" id="Animation_5u02v"]
  76. resource_name = "pulsate"
  77. loop_mode = 1
  78. tracks/0/type = "value"
  79. tracks/0/imported = false
  80. tracks/0/enabled = true
  81. tracks/0/path = NodePath(".:scale")
  82. tracks/0/interp = 1
  83. tracks/0/loop_wrap = true
  84. tracks/0/keys = {
  85. "times": PackedFloat32Array(0, 0.5, 1),
  86. "transitions": PackedFloat32Array(1, 1, 1),
  87. "update": 0,
  88. "values": [Vector2(0.5, 0.5), Vector2(0.8, 0.8), Vector2(0.5, 0.5)]
  89. }
  90. [sub_resource type="AnimationLibrary" id="AnimationLibrary_a7ofc"]
  91. _data = {
  92. &"RESET": SubResource("Animation_mmtmn"),
  93. &"pulsate": SubResource("Animation_5u02v")
  94. }
  95. [node name="DebugNodeGroup" type="Node"]
  96. editor_description = "This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input"
  97. script = SubResource("GDScript_ak1tp")
  98. [node name="Panel" type="Panel" parent="."]
  99. anchors_preset = -1
  100. anchor_right = 0.373
  101. anchor_bottom = 1.0
  102. offset_left = -5.0
  103. offset_right = 0.303955
  104. grow_horizontal = 2
  105. grow_vertical = 2
  106. [node name="Info" type="RichTextLabel" parent="Panel"]
  107. layout_mode = 0
  108. offset_left = 12.0
  109. offset_top = 21.0
  110. offset_right = 429.0
  111. offset_bottom = 461.0
  112. theme_override_font_sizes/normal_font_size = 14
  113. text = "Application ID : {id}
  114. Details: {details}
  115. State: {state}
  116. Large image key: {lkey}
  117. Large image text: {ltext}
  118. Small image key: {skey}
  119. Small image text: {stext}
  120. Start timestamp: {stimestamp}
  121. End timestamp: {etimestamp}
  122. Party ID: {partyid}
  123. Current party size: {cpartysize}
  124. Max party size: {mpartysize}
  125. Match secret: {msecret}
  126. Join secret: {jsecret}
  127. Spectate secret: {ssecret}
  128. Is party public: {ppublic} (needs to be activated in Discord client settings)
  129. Is instanced: {instanced}
  130. "
  131. fit_content = true
  132. [node name="PrintCurrentUserOnConsole" type="Button" parent="Panel"]
  133. layout_mode = 1
  134. anchors_preset = 4
  135. anchor_top = 0.5
  136. anchor_bottom = 0.5
  137. offset_left = 12.0
  138. offset_top = 138.375
  139. offset_right = 245.0
  140. offset_bottom = 171.375
  141. grow_vertical = 2
  142. text = "Print current user on console"
  143. [node name="PrintFriends" type="Button" parent="Panel"]
  144. layout_mode = 1
  145. anchors_preset = 4
  146. anchor_top = 0.5
  147. anchor_bottom = 0.5
  148. offset_left = 12.0
  149. offset_top = 176.5
  150. offset_right = 204.0
  151. offset_bottom = 207.5
  152. grow_vertical = 2
  153. text = "Print friends on console"
  154. [node name="AcceptJoinRequest" type="Button" parent="Panel"]
  155. layout_mode = 1
  156. anchors_preset = 4
  157. anchor_top = 0.5
  158. anchor_bottom = 0.5
  159. offset_left = 12.0
  160. offset_top = 212.875
  161. offset_right = 154.0
  162. offset_bottom = 243.875
  163. grow_vertical = 2
  164. text = "ACCEPT REQUEST"
  165. [node name="InviteWithUserID" type="LineEdit" parent="Panel"]
  166. layout_mode = 1
  167. anchors_preset = 4
  168. anchor_top = 0.5
  169. anchor_bottom = 0.5
  170. offset_left = 11.0
  171. offset_top = 250.375
  172. offset_right = 210.0
  173. offset_bottom = 281.375
  174. grow_vertical = 2
  175. size_flags_horizontal = 0
  176. placeholder_text = "Invite with user_id here"
  177. [node name="AcceptWithUserID" type="LineEdit" parent="Panel"]
  178. layout_mode = 1
  179. anchors_preset = 4
  180. anchor_top = 0.5
  181. anchor_bottom = 0.5
  182. offset_left = 11.0
  183. offset_top = 286.875
  184. offset_right = 260.0
  185. offset_bottom = 317.875
  186. grow_vertical = 2
  187. placeholder_text = "Accept Invite with user_id here"
  188. [node name="ToggleSDK" type="CheckButton" parent="Panel"]
  189. layout_mode = 1
  190. anchors_preset = 4
  191. anchor_top = 0.5
  192. anchor_bottom = 0.5
  193. offset_left = 298.0
  194. offset_top = 157.375
  195. offset_right = 1144.0
  196. offset_bottom = 665.375
  197. grow_vertical = 2
  198. scale = Vector2(0.05, 0.05)
  199. theme_override_styles/focus = SubResource("StyleBoxEmpty_8abo6")
  200. theme_override_icons/checked = ExtResource("2_q6tao")
  201. theme_override_icons/unchecked = ExtResource("3_5cyem")
  202. button_pressed = true
  203. [node name="TextureRect" type="TextureRect" parent="Panel"]
  204. self_modulate = Color(0.47451, 0.47451, 0.47451, 1)
  205. layout_mode = 1
  206. anchors_preset = -1
  207. anchor_left = 0.88
  208. anchor_top = 0.762
  209. anchor_right = 0.88
  210. anchor_bottom = 0.762
  211. offset_left = -28.8
  212. offset_top = -28.776
  213. offset_right = 28.0841
  214. offset_bottom = 28.1082
  215. grow_horizontal = 2
  216. grow_vertical = 2
  217. scale = Vector2(0.5, 0.5)
  218. pivot_offset = Vector2(29.0693, 29.0693)
  219. texture = ExtResource("3_goflf")
  220. [node name="AnimationPlayer" type="AnimationPlayer" parent="Panel/TextureRect"]
  221. libraries = {
  222. &"": SubResource("AnimationLibrary_a7ofc")
  223. }
  224. [connection signal="pressed" from="Panel/PrintCurrentUserOnConsole" to="." method="_on_print_current_user_on_console_pressed"]
  225. [connection signal="pressed" from="Panel/PrintFriends" to="." method="_on_print_friends_pressed"]
  226. [connection signal="pressed" from="Panel/AcceptJoinRequest" to="." method="_on_accept_join_request_pressed"]
  227. [connection signal="text_submitted" from="Panel/InviteWithUserID" to="." method="_on_invite_with_user_id_text_submitted"]
  228. [connection signal="text_submitted" from="Panel/AcceptWithUserID" to="." method="_on_accept_with_user_id_text_submitted"]
  229. [connection signal="toggled" from="Panel/ToggleSDK" to="." method="_on_toggle_sdk_toggled"]