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 e16e5be..443b719 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 cde6401..56e0874 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/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index 38c927e..98b7960 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -5,9 +5,9 @@ const ExportPlugin = preload("res://addons/discord-sdk-gd/export.gd") var loaded_exportplugin = ExportPlugin.new() func _enter_tree(): - add_autoload_singleton("DiscordSDK", "res://addons/discord-sdk-gd/sdk_utility.gd") + add_autoload_singleton("updater_discordsdk", "res://addons/discord-sdk-gd/sdk_utility.gd") add_export_plugin(loaded_exportplugin) func disable_plugin(): - remove_autoload_singleton("DiscordSDK") + remove_autoload_singleton("updater_discordsdk") remove_export_plugin(loaded_exportplugin) diff --git a/project/addons/discord-sdk-gd/sdk_utility.gd b/project/addons/discord-sdk-gd/sdk_utility.gd index 734dadd..719b20d 100644 --- a/project/addons/discord-sdk-gd/sdk_utility.gd +++ b/project/addons/discord-sdk-gd/sdk_utility.gd @@ -1,55 +1,4 @@ extends Node -const result: Array[String] = [ - "Ok", - "ServiceUnavailable", - "InvalidVersion", - "LockFailed", - "InternalError", - "InvalidPayload", - "InvalidCommand", - "InvalidPermissions", - "NotFetched", - "NotFound", - "Conflict", - "InvalidSecret", - "InvalidJoinSecret", - "NoEligibleActivity", - "InvalidInvite", - "NotAuthenticated", - "InvalidAccessToken", - "ApplicationMismatch", - "InvalidDataUrl", - "InvalidBase64", - "NotFiltered", - "LobbyFull", - "InvalidLobbySecret", - "InvalidFilename", - "InvalidFileSize", - "InvalidEntitlement", - "NotInstalled", - "NotRunning", - "InsufficientBuffer", - "PurchaseCanceled", - "InvalidGuild", - "InvalidEvent", - "InvalidChannel", - "InvalidOrigin", - "RateLimited", - "OAuth2Error", - "SelectChannelTimeout", - "GetGuildTimeout", - "SelectVoiceForceRequired", - "CaptureShortcutAlreadyListening", - "UnauthorizedForAchievement", - "InvalidGiftCode", - "PurchaseError", - "TransactionAborted", - "DrawingInitFailed" -] - func _process(delta): Discord_SDK.coreupdate() - -func get_sdk_info(): - return result[Discord_SDK.get_result_int()] diff --git a/project/main.gd b/project/main.gd index 80c713a..e430acd 100644 --- a/project/main.gd +++ b/project/main.gd @@ -16,4 +16,4 @@ func _ready(): Discord_SDK.refresh() - $Info.text = $Info.text.replace("{discordinfo}",DiscordSDK.get_sdk_info()).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)) + $Info.text = $Info.text.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)) diff --git a/project/main.tscn b/project/main.tscn index 546b2d2..d803974 100644 --- a/project/main.tscn +++ b/project/main.tscn @@ -46,7 +46,7 @@ offset_left = 7.0 offset_top = 6.0 offset_right = 514.0 offset_bottom = 722.0 -text = "Discord info: {discordinfo} +text = "Discord working: {discordinfo} Application ID : {id} Details: {details} diff --git a/project/project.godot b/project/project.godot index 013594e..89fb48d 100644 --- a/project/project.godot +++ b/project/project.godot @@ -20,7 +20,7 @@ config/icon="res://assets/Logo_V2.png" [autoload] -DiscordSDK="*res://addons/discord-sdk-gd/sdk_utility.gd" +updater_discordsdk="*res://addons/discord-sdk-gd/sdk_utility.gd" [dotnet] diff --git a/src/discordgodot.cpp b/src/discordgodot.cpp index c77e8e4..1cd3dbc 100644 --- a/src/discordgodot.cpp +++ b/src/discordgodot.cpp @@ -51,6 +51,8 @@ void Discord_SDK::_bind_methods() ClassDB::bind_method(D_METHOD("refresh"), &Discord_SDK::refresh); + ClassDB::bind_method(D_METHOD("get_is_discord_working"), &Discord_SDK::get_is_discord_working); + ClassDB::bind_method(D_METHOD("get_result_int"), &Discord_SDK::get_result_int); } @@ -192,7 +194,12 @@ int64_t Discord_SDK::get_end_timestamp() const return activity.GetTimestamps().GetEnd(); } +bool Discord_SDK::get_is_discord_working() const +{ + return result == discord::Result::Ok && app_id > 0; +} + int Discord_SDK::get_result_int() const { return static_cast(result); -} \ No newline at end of file +} diff --git a/src/discordgodot.h b/src/discordgodot.h index 42d2889..fd8557b 100644 --- a/src/discordgodot.h +++ b/src/discordgodot.h @@ -63,6 +63,7 @@ public: int64_t get_end_timestamp() const; void set_end_timestamp(const int64_t &value); + bool get_is_discord_working() const; int get_result_int() const; };