added clear()
method
This commit is contained in:
Binary file not shown.
Binary file not shown.
18
project/assets/Checked.svg
Normal file
18
project/assets/Checked.svg
Normal file
@@ -0,0 +1,18 @@
|
||||
<svg width="834" height="500" viewBox="0 0 834 500" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_162_85)">
|
||||
<rect width="833.333" height="500" rx="250" fill="#23A55A"/>
|
||||
<g clip-path="url(#clip1_162_85)">
|
||||
<path d="M791.667 250C791.667 134.941 698.393 41.6666 583.333 41.6666C468.274 41.6666 375 134.941 375 250C375 365.059 468.274 458.333 583.333 458.333C698.393 458.333 791.667 365.059 791.667 250Z" fill="white"/>
|
||||
<path d="M539.491 351.121L506.345 317.977L673.122 151.199L706.268 184.345L539.491 351.121Z" fill="#23A55A"/>
|
||||
<path d="M460.134 272.714L493.279 239.568L571.844 318.133L538.698 351.279L460.134 272.714Z" fill="#23A55A"/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_162_85">
|
||||
<rect width="833.333" height="500" rx="250" fill="white"/>
|
||||
</clipPath>
|
||||
<clipPath id="clip1_162_85">
|
||||
<rect width="583.333" height="416.667" fill="white" transform="translate(291.667 41.6666)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 926 B |
37
project/assets/Checked.svg.import
Normal file
37
project/assets/Checked.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dnfq6kug4x6o2"
|
||||
path="res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Checked.svg"
|
||||
dest_files=["res://.godot/imported/Checked.svg-f72e721c76a88d84ce4de3fd19f840d5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
18
project/assets/Unchecked.svg
Normal file
18
project/assets/Unchecked.svg
Normal file
@@ -0,0 +1,18 @@
|
||||
<svg width="834" height="500" viewBox="0 0 834 500" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_162_79)">
|
||||
<rect x="0.666687" width="833.333" height="500" rx="250" fill="#80848E"/>
|
||||
<g clip-path="url(#clip1_162_79)">
|
||||
<path d="M459 250C459 134.941 365.726 41.6666 250.667 41.6666C135.607 41.6666 42.3333 134.941 42.3333 250C42.3333 365.059 135.607 458.333 250.667 458.333C365.726 458.333 459 365.059 459 250Z" fill="white"/>
|
||||
<path d="M149.257 181.868L182.402 148.722L351.813 318.134L318.667 351.28L149.257 181.868Z" fill="#80848E"/>
|
||||
<path d="M318.801 148.722L351.946 181.868L182.535 351.28L149.389 318.134L318.801 148.722Z" fill="#80848E"/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_162_79">
|
||||
<rect x="0.666687" width="833.333" height="500" rx="250" fill="white"/>
|
||||
</clipPath>
|
||||
<clipPath id="clip1_162_79">
|
||||
<rect width="583.333" height="416.667" fill="white" transform="translate(-41 41.6666)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 942 B |
37
project/assets/Unchecked.svg.import
Normal file
37
project/assets/Unchecked.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://compmm3kviqqe"
|
||||
path="res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Unchecked.svg"
|
||||
dest_files=["res://.godot/imported/Unchecked.svg-766fb74b3cafb9a423726f8edb81f7ad.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
@@ -1,6 +1,12 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
set_activity()
|
||||
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
||||
discord_sdk.connect("activity_join",_on_activity_join)
|
||||
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
||||
|
||||
func set_activity():
|
||||
discord_sdk.app_id = 1099618430065324082
|
||||
discord_sdk.details = "A demo activity by vaporvee#1231"
|
||||
discord_sdk.state = "Checkpoint 23/23"
|
||||
@@ -16,8 +22,8 @@ func _ready():
|
||||
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
|
||||
discord_sdk.current_party_size = 1
|
||||
discord_sdk.max_party_size = 4
|
||||
discord_sdk.match_secret = "m_" + my_secret + ",discord_sdk.current_party_size" #better use seeds with 1 to 1 range instead of just chars
|
||||
discord_sdk.join_secret = "j_" + my_secret + ",discord_sdk.current_party_size"
|
||||
discord_sdk.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
||||
discord_sdk.join_secret = "j_" + my_secret
|
||||
discord_sdk.spectate_secret = "s_" + my_secret
|
||||
#discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
||||
#discord_sdk.register_command("steam://rungameid/1389990")
|
||||
@@ -32,11 +38,11 @@ func _on_activity_join_request(user_requesting):
|
||||
|
||||
func _on_activity_join(secret):
|
||||
if(discord_sdk.join_secret != secret):
|
||||
discord_sdk.current_party_size = clamp(int(secret.split(",")[1]) + 1, 0, discord_sdk.max_party_size)
|
||||
discord_sdk.party_id = secret.split(",")[0].replace("j_","mylobbycanbeeverything_")
|
||||
discord_sdk.match_secret = secret.split(",")[0].replace("j_","m_")
|
||||
discord_sdk.join_secret = secret.split(",")[0]
|
||||
discord_sdk.spectate_secret = secret.split(",")[0].replace("j_","s_")
|
||||
discord_sdk.current_party_size = clamp(int(secret) + 1, 0, discord_sdk.max_party_size)
|
||||
discord_sdk.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
||||
discord_sdk.match_secret = secret.replace("j_","m_")
|
||||
discord_sdk.join_secret = secret
|
||||
discord_sdk.spectate_secret = secret.replace("j_","s_")
|
||||
discord_sdk.refresh()
|
||||
$Info.text = $Info.text.replace("{ssecret}",discord_sdk.spectate_secret).replace("{jsecret}",discord_sdk.join_secret).replace("{msecret}",discord_sdk.match_secret).replace("{mpartysize}",str(discord_sdk.max_party_size)).replace("{cpartysize}",str(discord_sdk.current_party_size)).replace("{partyid}",discord_sdk.party_id).replace("{discordinfo}",str(discord_sdk.get_is_discord_working())).replace("{id}",str(discord_sdk.app_id)).replace("{details}",discord_sdk.details).replace("{state}",discord_sdk.state).replace("{lkey}",discord_sdk.large_image).replace("{ltext}",discord_sdk.large_image_text).replace("{skey}",discord_sdk.small_image).replace("{stext}",discord_sdk.small_image_text).replace("{stimestamp}",str(discord_sdk.start_timestamp)).replace("{etimestamp}",str(discord_sdk.end_timestamp))
|
||||
print(secret)
|
||||
@@ -45,3 +51,10 @@ func _on_activity_join(secret):
|
||||
|
||||
func _on_activity_spectate(secret):
|
||||
print(secret)
|
||||
|
||||
|
||||
func _on_check_button_toggled(button_pressed):
|
||||
if(button_pressed):
|
||||
set_activity()
|
||||
else:
|
||||
discord_sdk.clear()
|
||||
|
@@ -1,7 +1,11 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dmx2xuigcpvt4"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dmx2xuigcpvt4"]
|
||||
|
||||
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhuttdaet6q1u" path="res://assets/Logo_V2_Clyde.png" id="2_1hv5q"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://assets/Checked.svg" id="3_ny5eu"]
|
||||
[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://assets/Unchecked.svg" id="4_xydmq"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1w3f4"]
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
script = ExtResource("1_kl8ri")
|
||||
@@ -18,20 +22,20 @@ color = Color(0.345098, 0.396078, 0.94902, 1)
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 4
|
||||
position = Vector2(565, 308)
|
||||
position = Vector2(591, 308)
|
||||
scale = Vector2(0.408203, 0.408203)
|
||||
texture = ExtResource("2_1hv5q")
|
||||
|
||||
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -257.0
|
||||
offset_top = 54.0
|
||||
offset_right = 257.0
|
||||
offset_bottom = 150.0
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.296
|
||||
anchor_top = 0.59
|
||||
anchor_right = 0.742
|
||||
anchor_bottom = 0.727
|
||||
offset_left = 0.00799561
|
||||
offset_top = -0.320007
|
||||
offset_right = 0.215942
|
||||
offset_bottom = -0.0960388
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
@@ -67,3 +71,23 @@ Match secret: {msecret}
|
||||
Join secret: {jsecret}
|
||||
Spectate secret: {ssecret}"
|
||||
scroll_active = false
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="."]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.494
|
||||
anchor_top = 0.781
|
||||
anchor_right = 0.531
|
||||
anchor_bottom = 0.82
|
||||
offset_left = -0.0879517
|
||||
offset_top = -0.0879822
|
||||
offset_right = 803.288
|
||||
offset_bottom = 482.64
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
scale = Vector2(0.05, 0.05)
|
||||
theme_override_icons/checked = ExtResource("3_ny5eu")
|
||||
theme_override_icons/unchecked = ExtResource("4_xydmq")
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_1w3f4")
|
||||
button_pressed = true
|
||||
|
||||
[connection signal="toggled" from="CheckButton" to="." method="_on_check_button_toggled"]
|
||||
|
@@ -193,9 +193,28 @@ void discord_sdk::refresh()
|
||||
|
||||
void discord_sdk::clear()
|
||||
{
|
||||
if (result == discord::Result::Ok /*should it be only at ok?*/ && app_id > 0)
|
||||
//
|
||||
;
|
||||
if (result == discord::Result::Ok)
|
||||
{
|
||||
app_id = 0;
|
||||
state = "";
|
||||
details = "";
|
||||
large_image = "";
|
||||
large_image_text = "";
|
||||
small_image = "";
|
||||
small_image_text = "";
|
||||
start_timestamp = 0;
|
||||
end_timestamp = 0;
|
||||
party_id = "-";
|
||||
current_party_size = 0;
|
||||
max_party_size = 0;
|
||||
match_secret = "";
|
||||
join_secret = "";
|
||||
spectate_secret = "";
|
||||
instanced = false;
|
||||
|
||||
delete core;
|
||||
core = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void discord_sdk::set_large_image(String value)
|
||||
|
Reference in New Issue
Block a user