started improving the main code a bit
This commit is contained in:
Binary file not shown.
266
project/addons/discord-sdk-gd/nodes/Deb9885.tmp
Normal file
266
project/addons/discord-sdk-gd/nodes/Deb9885.tmp
Normal file
@@ -0,0 +1,266 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://c1slhdnlsv2qt"]
|
||||
|
||||
[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"
|
||||
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()):
|
||||
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
|
||||
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
|
||||
debug_text_update()
|
||||
else:
|
||||
$Panel/TextureRect.self_modulate = Color(\"#797979\")
|
||||
$Panel/TextureRect/AnimationPlayer.stop()
|
||||
debug_text_update()
|
||||
|
||||
func debug_text_update():
|
||||
$Panel/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}
|
||||
\"
|
||||
$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 = {};
|
||||
|
||||
func _on_activity_join_request(user_requesting):
|
||||
print(user_requesting)
|
||||
user_request = user_requesting
|
||||
|
||||
func _on_accept_join_request_pressed():
|
||||
if(!user_request.is_empty()):
|
||||
discord_sdk.accept_join_request(user_request.id)
|
||||
|
||||
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_accept_with_user_id_text_submitted(new_text):
|
||||
discord_sdk.accept_invite(int(new_text))
|
||||
|
||||
func _on_print_current_user_on_console_pressed():
|
||||
print(discord_sdk.get_current_user())
|
||||
|
||||
func _on_toggle_sdk_toggled(button_pressed):
|
||||
if(button_pressed):
|
||||
discord_sdk.unclear()
|
||||
else:
|
||||
discord_sdk.clear(false)
|
||||
|
||||
func _on_print_friends_pressed():
|
||||
print(discord_sdk.get_all_relationships())
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
||||
|
||||
[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="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="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="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="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}
|
||||
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="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 12.0
|
||||
offset_top = 138.375
|
||||
offset_right = 245.0
|
||||
offset_bottom = 171.375
|
||||
grow_vertical = 2
|
||||
text = "Print current user on console"
|
||||
|
||||
[node name="PrintFriends" type="Button" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 12.0
|
||||
offset_top = 176.5
|
||||
offset_right = 204.0
|
||||
offset_bottom = 207.5
|
||||
grow_vertical = 2
|
||||
text = "Print friends on console"
|
||||
|
||||
[node name="AcceptJoinRequest" type="Button" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 12.0
|
||||
offset_top = 212.875
|
||||
offset_right = 154.0
|
||||
offset_bottom = 243.875
|
||||
grow_vertical = 2
|
||||
text = "ACCEPT REQUEST"
|
||||
|
||||
[node name="InviteWithUserID" type="LineEdit" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 11.0
|
||||
offset_top = 250.375
|
||||
offset_right = 210.0
|
||||
offset_bottom = 281.375
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 0
|
||||
placeholder_text = "Invite with user_id here"
|
||||
|
||||
[node name="AcceptWithUserID" type="LineEdit" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 11.0
|
||||
offset_top = 286.875
|
||||
offset_right = 260.0
|
||||
offset_bottom = 317.875
|
||||
grow_vertical = 2
|
||||
placeholder_text = "Accept Invite with user_id here"
|
||||
|
||||
[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/PrintFriends" to="." method="_on_print_friends_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"]
|
@@ -69,7 +69,7 @@ func _on_toggle_sdk_toggled(button_pressed):
|
||||
if(button_pressed):
|
||||
discord_sdk.unclear()
|
||||
else:
|
||||
discord_sdk.clear()
|
||||
discord_sdk.clear(false)
|
||||
|
||||
func _on_print_friends_pressed():
|
||||
print(discord_sdk.get_all_relationships())
|
||||
|
Reference in New Issue
Block a user