fixed static typing and some other stuff

This commit is contained in:
2024-08-08 22:17:10 +02:00
parent 412aec1210
commit 12e61f30e1
10 changed files with 222 additions and 54 deletions

View File

@@ -1 +1,3 @@
bin/.gdignore
bin/.gdignore
*.TMP
bin/windows/~*.dll

View File

@@ -8,13 +8,16 @@
resource_name = "Debug"
script/source = "extends Node
@onready var animation_player: AnimationPlayer = $Panel/TextureRect/AnimationPlayer
func _ready():
DiscordRPC.connect(\"activity_join_request\",_on_activity_join_request)
func _process(_delta):
func _process(_delta) -> void:
if(DiscordRPC.get_is_discord_working()):
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
if !animation_player.is_playing():
animation_player.play(\"pulsate\")
debug_text_update()
else:
$Panel/TextureRect.self_modulate = Color(\"#797979\")
@@ -22,7 +25,7 @@ func _process(_delta):
debug_text_update()
func debug_text_update():
func debug_text_update() -> void:
$Panel/Info.text = \"Application ID : {id}
Details: {details}
State: {state}
@@ -47,32 +50,32 @@ Is instanced: {instanced}
\"
$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))
var user_request = {};
var user_request: Dictionary = {};
func _on_activity_join_request(user_requesting):
func _on_activity_join_request(user_requesting: Dictionary) -> void:
print(user_requesting)
user_request = user_requesting
func _on_accept_join_request_pressed():
func _on_accept_join_request_pressed() -> void:
if(!user_request.is_empty()):
DiscordRPC.accept_join_request(user_request.id)
func _on_invite_with_user_id_text_submitted(new_text):
func _on_invite_with_user_id_text_submitted(new_text: String) -> void:
DiscordRPC.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
func _on_accept_with_user_id_text_submitted(new_text):
func _on_accept_with_user_id_text_submitted(new_text: String) -> void:
DiscordRPC.accept_invite(int(new_text))
func _on_print_current_user_on_console_pressed():
func _on_print_current_user_on_console_pressed() -> void:
print(DiscordRPC.get_current_user())
func _on_toggle_sdk_toggled(button_pressed):
func _on_toggle_sdk_toggled(button_pressed: bool) -> void:
if(button_pressed):
DiscordRPC.unclear()
else:
DiscordRPC.clear(false)
func _on_print_friends_pressed():
func _on_print_friends_pressed() -> void:
print(DiscordRPC.get_all_relationships())
"
@@ -95,18 +98,19 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_5u02v"]
resource_name = "pulsate"
loop_mode = 1
length = 0.5
loop_mode = 2
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/loop_wrap = false
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0.5, 0.5), Vector2(0.8, 0.8), Vector2(0.5, 0.5)]
"values": [Vector2(0.5, 0.5), Vector2(0.8, 0.8)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_a7ofc"]
@@ -231,9 +235,9 @@ offset_right = 1144.0
offset_bottom = 665.375
grow_vertical = 2
scale = Vector2(0.05, 0.05)
theme_override_styles/focus = SubResource("StyleBoxEmpty_8abo6")
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"]

View File

@@ -3,5 +3,5 @@
name="DiscordRPC"
description="Discord RPC Plugin for GDScript in Godot"
author="vaporvee"
version="1.3.1"
version="1.3.2"
script="plugin.gd"

View File

@@ -1,12 +1,12 @@
@tool
extends EditorPlugin
const DiscordRPCDebug = preload("res://addons/discord-rpc-gd/nodes/debug.gd")
const DiscordRPCDebug_icon = preload("res://addons/discord-rpc-gd/Debug.svg")
var loaded_DiscordRPCDebug = DiscordRPCDebug.new()
const DiscordRPCDebug: GDScript = preload("res://addons/discord-rpc-gd/nodes/debug.gd")
const DiscordRPCDebug_icon: Texture2D = preload("res://addons/discord-rpc-gd/Debug.svg")
var loaded_DiscordRPCDebug: DiscordRPCDebug = DiscordRPCDebug.new()
var restart_window: ConfirmationDialog = preload("res://addons/discord-rpc-gd/restart_window.tscn").instantiate()
var plugin_cfg: ConfigFile = ConfigFile.new()
const plugin_data_filename = "/plugin_data.cfg"
const plugin_data_filename: String = "/plugin_data.cfg"
func _enter_tree() -> void:
add_custom_type("DiscordRPCDebug","Node",DiscordRPCDebug,DiscordRPCDebug_icon)
@@ -18,7 +18,7 @@ func _ready() -> void:
if !get_editor_interface().get_editor_settings().has_setting("DiscordRPC/EditorPresence/enabled"):
get_editor_interface().get_editor_settings().set_setting("DiscordRPC/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false))
func _exit_tree():
func _exit_tree() -> void:
if get_editor_interface().get_editor_settings().has_setting("DiscordRPC/EditorPresence/enabled"):
get_editor_interface().get_editor_settings().erase("DiscordRPC/EditorPresence/enabled")

View File

@@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
[sub_resource type="Image" id="Image_v4whe"]
[sub_resource type="Image" id="Image_f4u3i"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
"format": "RGBA8",
@@ -19,7 +19,7 @@ data = {
}
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
image = SubResource("Image_v4whe")
image = SubResource("Image_f4u3i")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]