Compare commits
119 Commits
Author | SHA1 | Date | |
---|---|---|---|
210555d7a5 | |||
e206b11848 | |||
eea4812afb | |||
b51508fe33 | |||
11896d31ff | |||
27c7fa26f1 | |||
50e717daaa | |||
8927ba76b9 | |||
43198d0e99 | |||
5cac6404b0 | |||
899f8f4b02 | |||
78dbde81fd | |||
8de5c65cdc | |||
|
829e84c5d9 | ||
|
7a237ec460 | ||
e69c514b44 | |||
81eb0e4e45 | |||
1f2dac7a0e | |||
|
1d490a666f | ||
6fd58b0ddf | |||
dba8569ebc | |||
6121ce5418 | |||
|
d744144d6d | ||
|
c7a06b6d9a | ||
|
b24defd292 | ||
|
ae076a6403 | ||
|
a4cf76c323 | ||
|
23b4e05e83 | ||
|
58cbfe9345 | ||
|
245110f103 | ||
|
7389119992 | ||
|
a57c78146e | ||
|
0686fad440 | ||
|
4bda87c54d | ||
8c583b85b1 | |||
52f43b724c | |||
|
253013d0e9 | ||
1b43adba77 | |||
|
aa486d39c9 | ||
|
68cb2ddb44 | ||
|
30af177aa3 | ||
|
cbc0c85c76 | ||
|
ed4149e7a7 | ||
|
3b244f4a91 | ||
|
305d314224 | ||
|
0ee6a3268c | ||
|
b143809744 | ||
|
fab2efb88a | ||
|
063f559624 | ||
|
ce93ed4294 | ||
|
2b19fd9be2 | ||
|
f93fbe4a1b | ||
|
f78e2e9744 | ||
|
ea4324aba8 | ||
|
ffcf4090d6 | ||
|
d3d33216db | ||
|
c8db95e559 | ||
|
1eeec67690 | ||
|
4985d31a03 | ||
|
86ab81aff1 | ||
aedbc03f8c | |||
|
15ce1c0904 | ||
|
3a2ccc84f5 | ||
|
368b60e69c | ||
|
e43fdc7117 | ||
|
d026bbc872 | ||
|
c41396cdbb | ||
|
abb0cdb0c5 | ||
|
35c1895650 | ||
|
548349d9f8 | ||
|
68c8a42826 | ||
|
3e944683a4 | ||
|
6f288564cf | ||
|
aa39fb80e0 | ||
|
980080492e | ||
|
b3ebd2c737 | ||
|
f9134f30f7 | ||
|
da42d6a228 | ||
|
a998076b79 | ||
|
7fd0d25da9 | ||
|
52fcce409a | ||
|
88a855d1da | ||
|
53dafb1da2 | ||
|
9772445870 | ||
|
52ec3392fa | ||
|
3913736a42 | ||
|
ba5eb3316e | ||
|
9929ccbb3a | ||
|
73b915485f | ||
|
fd5a59d1eb | ||
|
7e8c1cc7bb | ||
|
ed67525242 | ||
|
a803ffb9a1 | ||
|
ee4b0567c5 | ||
|
92ec704ddb | ||
|
3bf8ee8d36 | ||
|
3765612588 | ||
|
58a043a885 | ||
|
df556e8a72 | ||
|
5cd13316a0 | ||
|
c62e9af0ef | ||
|
31e3302384 | ||
|
0013c8c788 | ||
|
27498f9e70 | ||
|
54d6cebd5c | ||
|
029111a04f | ||
|
281bdb2cfa | ||
|
0f903dfb6c | ||
|
65fb3b1d0f | ||
|
fa63df6094 | ||
|
edf3e7fab6 | ||
|
5e080bc846 | ||
|
7f586869d7 | ||
|
9eaf340637 | ||
|
0c9e4123b7 | ||
|
274a3ebbed | ||
|
3b921901ee | ||
|
aadd2cb982 | ||
|
f8325c8164 |
47
.github/ISSUE_TEMPLATE/BUG.yml
vendored
@@ -21,12 +21,24 @@ body:
|
|||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
label: Version
|
label: Version
|
||||||
description: What version of our software are you running?
|
description: What version of the Discord Game SDK Godot plugin are you running?
|
||||||
options:
|
options:
|
||||||
- 1.3
|
- 1.0.1
|
||||||
- 1.2
|
- 1.0.0
|
||||||
- 1.1
|
- 0.3.2
|
||||||
- 1.0
|
- 0.3.1
|
||||||
|
- 0.3.0
|
||||||
|
- 0.2.4
|
||||||
|
- 0.2.3
|
||||||
|
- 0.2.2
|
||||||
|
- 0.2.1
|
||||||
|
- 0.2.0
|
||||||
|
- 0.1.5
|
||||||
|
- 0.1.4
|
||||||
|
- 0.1.3
|
||||||
|
- 0.1.2
|
||||||
|
- 0.1.1
|
||||||
|
- 0.1.0
|
||||||
- Custom build
|
- Custom build
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@@ -34,8 +46,15 @@ body:
|
|||||||
id: gd-version
|
id: gd-version
|
||||||
attributes:
|
attributes:
|
||||||
label: Godot Version
|
label: Godot Version
|
||||||
description: This addon is ONLY for 4.0 and above!
|
description: This addon is ONLY for 4.1 and above!
|
||||||
placeholder: e.g. 4.0.2-stable
|
placeholder: e.g. 4.1.0-stable
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: steps_reproduce
|
||||||
|
attributes:
|
||||||
|
label: Exact steps to reproduce this error
|
||||||
|
description: Tell what completely exactly you did from downloading and copying the plugin to the error. You can also drag and drop a zip file of how you would setup a fresh project with it.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@@ -47,6 +66,14 @@ body:
|
|||||||
render: gdscript
|
render: gdscript
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: log
|
||||||
|
attributes:
|
||||||
|
label: Godot output
|
||||||
|
description: The output log from Godot
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: additional
|
id: additional
|
||||||
attributes:
|
attributes:
|
||||||
@@ -61,5 +88,9 @@ body:
|
|||||||
label: Checks
|
label: Checks
|
||||||
description: Common mistakes (Adding more in the future sorry btw)
|
description: Common mistakes (Adding more in the future sorry btw)
|
||||||
options:
|
options:
|
||||||
- label: I tried reinstalling the addon in a new project.
|
- label: I tried reinstalling the addon or tried to fix it myself with other methods.
|
||||||
|
required: true
|
||||||
|
- label: I tried restarting Discord and Godot completely.
|
||||||
|
required: true
|
||||||
|
- label: I did read the documentation https://github.com/vaporvee/discord-sdk-godot/wiki
|
||||||
required: true
|
required: true
|
||||||
|
27
.github/ISSUE_TEMPLATE/FEATURE.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Feature request
|
||||||
|
description: File a feature request
|
||||||
|
title: "[Feature request]: "
|
||||||
|
labels: ["enhancement"]
|
||||||
|
assignees:
|
||||||
|
- vaporvee
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: Thanks for taking the time to fill out this feature request!
|
||||||
|
- type: textarea
|
||||||
|
id: idea
|
||||||
|
attributes:
|
||||||
|
label: What is your idea?
|
||||||
|
description: Tell me what you want to see in the addon.
|
||||||
|
placeholder: Tell me what you want to see!
|
||||||
|
value: "I have a cool new feature!"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: Additional information
|
||||||
|
description: If you have anything else tell me here
|
||||||
|
placeholder: Anything else.
|
||||||
|
validations:
|
||||||
|
required: false
|
65
.github/workflows/auto_wontfix.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: Auto Wontfix Issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto_wontfix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check for specific word in the issue
|
||||||
|
uses: actions/github-script@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.WONTFIX_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const wordToCheck = 'mac';
|
||||||
|
const issue = context.payload.issue;
|
||||||
|
|
||||||
|
if (issue.body && issue.body.toLowerCase().includes(wordToCheck)) {
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const number = issue.number;
|
||||||
|
const issueComment = "macOS is not supported, because loading libraries in Godot from third-party sources requires a paid developer certificate from Apple. You are welcome to compile and sign the library yourself.";
|
||||||
|
|
||||||
|
// Mark the issue as "wontfix"
|
||||||
|
await octokit.issues.update({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
state: 'closed',
|
||||||
|
labels: ['wontfix']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Post a comment on the issue
|
||||||
|
await octokit.issues.createComment({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
body: issueComment
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (issue.title && issue.title.toLowerCase().includes(wordToCheck)) {
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const number = issue.number;
|
||||||
|
const issueComment = "macOS is not supported, because loading libraries in Godot from third-party sources requires a paid developer certificate from Apple. You are welcome to compile and sign the library yourself.";
|
||||||
|
|
||||||
|
// Mark the issue as "wontfix"
|
||||||
|
await octokit.issues.update({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
state: 'closed',
|
||||||
|
labels: ['wontfix']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Post a comment on the issue
|
||||||
|
await octokit.issues.createComment({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
body: issueComment
|
||||||
|
});
|
||||||
|
}
|
3
.gitignore
vendored
@@ -20,3 +20,6 @@ build/
|
|||||||
|
|
||||||
#Clean files from the Game SDK
|
#Clean files from the Game SDK
|
||||||
src/lib/discord_game_sdk/
|
src/lib/discord_game_sdk/
|
||||||
|
|
||||||
|
# release.py
|
||||||
|
release/
|
1
.gitmodules
vendored
@@ -1,3 +1,4 @@
|
|||||||
[submodule "src/lib/godot-cpp"]
|
[submodule "src/lib/godot-cpp"]
|
||||||
path = src/lib/godot-cpp
|
path = src/lib/godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp
|
url = https://github.com/godotengine/godot-cpp
|
||||||
|
branch = 4.2
|
||||||
|
6
.vscode/c_cpp_properties.json
vendored
@@ -3,7 +3,11 @@
|
|||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${default}"
|
"${default}",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/include",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gdextension",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"_DEBUG",
|
"_DEBUG",
|
||||||
|
64
.vscode/settings.json
vendored
@@ -1,11 +1,67 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
"src/lib/godot-cpp/include",
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
||||||
"src/lib/godot-cpp/gen/include",
|
"${workspaceFolder}/src/lib/godot-cpp/include"
|
||||||
"src/lib/godot-cpp/gdextension"
|
|
||||||
],
|
],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"xlocbuf": "cpp"
|
"xlocbuf": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"csignal": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"ios": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"xfacet": "cpp",
|
||||||
|
"xhash": "cpp",
|
||||||
|
"xiosbase": "cpp",
|
||||||
|
"xlocale": "cpp",
|
||||||
|
"xlocinfo": "cpp",
|
||||||
|
"xlocnum": "cpp",
|
||||||
|
"xmemory": "cpp",
|
||||||
|
"xstddef": "cpp",
|
||||||
|
"xstring": "cpp",
|
||||||
|
"xtr1common": "cpp",
|
||||||
|
"xtree": "cpp",
|
||||||
|
"xutility": "cpp"
|
||||||
},
|
},
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
59
README.md
@@ -1,52 +1,27 @@
|
|||||||
<img src="/project/assets/Banner.svg" alt="Project Banner" />
|
<img src="/project/assets/Banner.svg" alt="Project Banner" />
|
||||||
|
|
||||||

|
**Discord Game SDK support for GDScript in Godot Engine 4.1. with the easiest code pattern!**<br><br>
|
||||||
|
|
||||||
### :warning: This is an early version! MacOS support still doesn't work! In future versions there also will be invites, user info etc. very soon!
|
|
||||||
Don't forget to run the following command **if you clone this project** or files will be missing
|
|
||||||
|
|
||||||
```sh
|
|
||||||
python setup.py
|
|
||||||
```
|
|
||||||
# Addon Usage :rocket:
|
|
||||||
1. [Download the addon](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/ADDON-Discord-SDK-Godot.zip/)
|
|
||||||
2. Put the `addons/` folder in your Godot project
|
|
||||||
3. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". (if it doesn't show up restart your project and try again)
|
|
||||||
4. Restart your project
|
|
||||||
5. Create an Application under https://discord.com/developers/applications and get the Application ID
|
|
||||||
6. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
|
|
||||||
```gdscript
|
|
||||||
extends Node
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
Discord_Activity.app_id = 1099618430065324082 # Application ID
|
|
||||||
print("Discord working: " + str(Discord_Activity.get_is_discord_working())) # A boolean if everything worked
|
|
||||||
Discord_Activity.details = "A demo activity by vaporvee#1231"
|
|
||||||
Discord_Activity.state = "Checkpoint 23/23"
|
|
||||||
|
|
||||||
Discord_Activity.large_image = "game" # Image key from "Art Assets"
|
|
||||||
Discord_Activity.large_image_text = "Try it now!"
|
|
||||||
Discord_Activity.small_image = "boss" # Image key from "Art Assets"
|
|
||||||
Discord_Activity.small_image_text = "Fighting the end boss! D:"
|
|
||||||
|
|
||||||
Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed"
|
|
||||||
# Discord_Activity.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00 remaining"
|
|
||||||
|
|
||||||
Discord_Activity.refresh() # Always refresh after changing the values!
|
|
||||||
|
|
||||||
```
|
|
||||||
#### Then it will look similar to this:
|
|
||||||
<img src="/project/assets/ActivityPreview.svg" alt="Activity Preview" />
|
|
||||||
|
|
||||||
### [Try a built demo](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/Demo-Export.zip)
|
|
||||||
:incoming_envelope: Still questions? write an [issue](https://github.com/vaporvee/discord-sdk-godot/issues)! I'll answer very fast :)
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki)
|
||||||
|
<br />
|
||||||
|
|
||||||
|
**A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!**
|
||||||
|
|
||||||
|
# Features
|
||||||
|
- Activities (Make people see what you are playing)
|
||||||
|
- Invites
|
||||||
|
- Steam and launch command registering
|
||||||
|
- User information
|
||||||
|
- Relationship Manager (Get friendlist and its updates)
|
||||||
|
- Overlay management
|
||||||
|
- Editor Presence (optional)
|
||||||
|
<img width="600px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/GodotEditorPresenceBanner.png">
|
||||||
|
<br />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
### Credit
|
### Credit
|
||||||
[@Pukimaa](https://github.com/pukimaa) - Designer<br>
|
[@Pukimaa](https://github.com/pukimaa) - Designer<br>
|
||||||
[@koyuawsmbrtn](https://github.com/koyuawsmbrtn) - Getting it to work on MacOS (shes giving her best)
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
*This project is not endorsed or affiliated with Discord Inc. or the Godot Foundation.*
|
*This project is not endorsed or affiliated with Discord Inc. or the Godot Foundation.*
|
||||||
|
15
SConstruct
@@ -1,10 +1,8 @@
|
|||||||
#!python
|
#!python
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Gets the standard flags CC, CCX, etc.
|
|
||||||
env = SConscript("src/lib/godot-cpp/SConstruct")
|
env = SConscript("src/lib/godot-cpp/SConstruct")
|
||||||
|
|
||||||
# Check our platform specifics
|
|
||||||
if env["platform"] == "macos":
|
if env["platform"] == "macos":
|
||||||
discord_library = "libdiscord_game_sdk.dylib"
|
discord_library = "libdiscord_game_sdk.dylib"
|
||||||
discord_library_second = "libdiscord_game_sdk_aarch64.dylib"
|
discord_library_second = "libdiscord_game_sdk_aarch64.dylib"
|
||||||
@@ -25,17 +23,16 @@ if env["target"] == "template_debug":
|
|||||||
else:
|
else:
|
||||||
debugsuffix = ""
|
debugsuffix = ""
|
||||||
|
|
||||||
# make sure our binding library is properly includes
|
|
||||||
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
||||||
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
||||||
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"]) # this line for some reason doesn't get understanded by most linux distros
|
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"])
|
||||||
env.Append(LIBS=["discord_game_sdk"])
|
env.Append(LIBS=["discord_game_sdk"])
|
||||||
|
|
||||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
|
||||||
env.Append(CPPPATH=["src/"])
|
env.Append(CPPPATH=["src/"])
|
||||||
sources += Glob("src/*.cpp")
|
sources += Glob("src/*.cpp")
|
||||||
|
|
||||||
# The finished exports
|
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])
|
||||||
|
|
||||||
library = env.SharedLibrary(
|
library = env.SharedLibrary(
|
||||||
target="project/addons/discord-sdk-gd/bin/"
|
target="project/addons/discord-sdk-gd/bin/"
|
||||||
+ libexportfolder
|
+ libexportfolder
|
||||||
@@ -51,11 +48,13 @@ env.Depends(
|
|||||||
Copy("$TARGET", "$SOURCE"),
|
Copy("$TARGET", "$SOURCE"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if(discord_library_second != ""):
|
if discord_library_second != "":
|
||||||
env.Depends(
|
env.Depends(
|
||||||
library,
|
library,
|
||||||
Command(
|
Command(
|
||||||
"project/addons/discord-sdk-gd/bin/" + libexportfolder + discord_library_second,
|
"project/addons/discord-sdk-gd/bin/"
|
||||||
|
+ libexportfolder
|
||||||
|
+ discord_library_second,
|
||||||
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
||||||
Copy("$TARGET", "$SOURCE"),
|
Copy("$TARGET", "$SOURCE"),
|
||||||
),
|
),
|
||||||
|
19
build.py
@@ -1,23 +1,28 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
yes = {'yes', 'y', 'ye', ''}
|
yes = {"yes", "y", "ye", ""}
|
||||||
no = {'no', 'n'}
|
no = {"no", "n"}
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
choice = sys.argv[1].removeprefix("-")
|
choice = sys.argv[1].removeprefix("-")
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(
|
sys.stdout.write(
|
||||||
"Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): ")
|
"Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): "
|
||||||
|
)
|
||||||
choice = input().lower()
|
choice = input().lower()
|
||||||
if choice in yes:
|
if choice in yes:
|
||||||
os.system("python -m SCons && python -m SCons target=template_release && cd project && godot")
|
os.system(
|
||||||
|
"python -m SCons && python -m SCons target=template_release && cd project && godot"
|
||||||
|
)
|
||||||
elif choice in no:
|
elif choice in no:
|
||||||
if os.name == 'nt':
|
if os.name == "nt":
|
||||||
os.system(
|
os.system(
|
||||||
"python -m SCons && python -m SCons target=template_release && godot project\project.godot")
|
"python -m SCons && python -m SCons target=template_release && godot project\project.godot"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
os.system(
|
os.system(
|
||||||
"python -m SCons && python -m SCons target=template_release && godot project/project.godot")
|
"python -m SCons && python -m SCons target=template_release && godot project/project.godot"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
sys.stdout.write("Please respond with 'yes' or 'no'")
|
sys.stdout.write("Please respond with 'yes' or 'no'")
|
||||||
|
10
project/addons/discord-sdk-gd/Debug.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_110_26)">
|
||||||
|
<path d="M13.3334 5.33333H11.4601C11.1594 4.81182 10.7446 4.36512 10.2467 4.02667L11.3334 2.94L10.3934 2L8.94675 3.44667C8.64008 3.37333 8.32675 3.33333 8.00008 3.33333C7.67341 3.33333 7.36008 3.37333 7.06008 3.44667L5.60675 2L4.66675 2.94L5.74675 4.02667C5.25341 4.36667 4.84008 4.81333 4.54008 5.33333H2.66675V6.66667H4.06008C4.02675 6.88667 4.00008 7.10667 4.00008 7.33333V8H2.66675V9.33333H4.00008V10C4.00008 10.2267 4.02675 10.4467 4.06008 10.6667H2.66675V12H4.54008C5.23341 13.1933 6.52008 14 8.00008 14C9.48008 14 10.7667 13.1933 11.4601 12H13.3334V10.6667H11.9401C11.9734 10.4467 12.0001 10.2267 12.0001 10V9.33333H13.3334V8H12.0001V7.33333C12.0001 7.10667 11.9734 6.88667 11.9401 6.66667H13.3334V5.33333ZM9.33341 10.6667H6.66675V9.33333H9.33341V10.6667ZM9.33341 8H6.66675V6.66667H9.33341V8Z" fill="#5865F2"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_110_26">
|
||||||
|
<rect width="16" height="16" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://d1dntlgjiapde"
|
uid="uid://ufh1hha1ehui"
|
||||||
path="res://.godot/imported/Debug.svg-dbd0299514a2ed7480404c509868c103.ctex"
|
path="res://.godot/imported/Debug.svg-97b25f5d09dbf04212867cd1a46cf368.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/Debug.svg"
|
source_file="res://addons/discord-sdk-gd/Debug.svg"
|
||||||
dest_files=["res://.godot/imported/Debug.svg-dbd0299514a2ed7480404c509868c103.ctex"]
|
dest_files=["res://.godot/imported/Debug.svg-97b25f5d09dbf04212867cd1a46cf368.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
BIN
project/addons/discord-sdk-gd/Logo_V2_No_Bg.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
34
project/addons/discord-sdk-gd/Logo_V2_No_Bg.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://csl0e2px0cwc1"
|
||||||
|
path="res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png"
|
||||||
|
dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.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
|
7
project/addons/discord-sdk-gd/READ_ME_PLEASE.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
MINIMUM GODOT VERSION: 4.2
|
||||||
|
|
||||||
|
PLEASE ACTIVATE THE PLUGIN UNDER Project -> Project Settings... -> Plugins -> DiscordSDK -> Status
|
||||||
|
IGNORE THE RED ERRORS ON THE FIRST 2 RESTARTS
|
||||||
|
READ THE TUTORIAL LINKED IN THE WINDOW THAT WILL OPEN ON PLUGIN ENABLE
|
||||||
|
|
||||||
|
If nothing works, enable the plugin and delete /addons/discord-sdk-gd/bin/.gdignore
|
30
project/addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
[configuration]
|
||||||
|
|
||||||
|
entry_symbol = "discordsdkgd_library_init"
|
||||||
|
compatibility_minimum = 4.2
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
|
||||||
|
macos.debug = "macos/libdiscord_game_sdk_binding_debug.dylib"
|
||||||
|
macos.release = "macos/libdiscord_game_sdk_binding.dylib"
|
||||||
|
windows.debug.x86_64 = "windows/discord_game_sdk_binding_debug.dll"
|
||||||
|
windows.release.x86_64 = "windows/discord_game_sdk_binding.dll"
|
||||||
|
linux.debug.x86_64 = "linux/libdiscord_game_sdk_binding_debug.so"
|
||||||
|
linux.release.x86_64 = "linux/libdiscord_game_sdk_binding.so"
|
||||||
|
linux.debug.arm64 = "linux/libdiscord_game_sdk_binding_debug.so"
|
||||||
|
linux.release.arm64 = "linux/libdiscord_game_sdk_binding.so"
|
||||||
|
linux.debug.rv64 = "linux/libdiscord_game_sdk_binding_debug.so"
|
||||||
|
linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
|
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||||
|
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||||
|
windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" }
|
||||||
|
windows.release.x86_64 = { "windows/discord_game_sdk.dll": "" }
|
||||||
|
linux.debug.x86_64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
linux.release.x86_64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
linux.debug.arm64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
linux.release.arm64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
linux.debug.rv64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
linux.release.rv64 = { "linux/libdiscord_game_sdk.so": "" }
|
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so
Executable file → Normal file
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so
Executable file → Normal file
@@ -1,4 +0,0 @@
|
|||||||
Version: 1.2
|
|
||||||
Windows: build-1
|
|
||||||
Linux: build-1
|
|
||||||
MacOS: build-1
|
|
@@ -1,29 +0,0 @@
|
|||||||
[configuration]
|
|
||||||
|
|
||||||
entry_symbol = "discordsdkgd_library_init"
|
|
||||||
|
|
||||||
[libraries]
|
|
||||||
|
|
||||||
macos.debug = "bin/macos/libdiscord_game_sdk_binding_debug.dylib"
|
|
||||||
macos.release = "bin/macos/libdiscord_game_sdk_binding.dylib"
|
|
||||||
windows.debug.x86_64 = "bin/windows/discord_game_sdk_binding_debug.dll"
|
|
||||||
windows.release.x86_64 = "bin/windows/discord_game_sdk_binding.dll"
|
|
||||||
linux.debug.x86_64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
|
|
||||||
linux.release.x86_64 = "bin/linux/libdiscord_game_sdk_binding.so"
|
|
||||||
linux.debug.arm64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
|
|
||||||
linux.release.arm64 = "bin/linux/libdiscord_game_sdk_binding.so"
|
|
||||||
linux.debug.rv64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
|
|
||||||
linux.release.rv64 = "bin/linux/libdiscord_game_sdk_binding.so"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
|
|
||||||
macos.debug = "bin/macos/libdiscord_game_sdk.dylib"
|
|
||||||
macos.release = "bin/macos/libdiscord_game_sdk.dylib"
|
|
||||||
windows.debug.x86_64 = "bin/windows/discord_game_sdk.dll"
|
|
||||||
windows.release.x86_64 = "bin/windows/discord_game_sdk.dll"
|
|
||||||
linux.debug.x86_64 = "bin/linux/libdiscord_game_sdk.so"
|
|
||||||
linux.release.x86_64 = "bin/linux/libdiscord_game_sdk.so"
|
|
||||||
linux.debug.arm64 = "bin/linux/libdiscord_game_sdk.so"
|
|
||||||
linux.release.arm64 = "bin/linux/libdiscord_game_sdk.so"
|
|
||||||
linux.debug.rv64 = "bin/linux/libdiscord_game_sdk.so"
|
|
||||||
linux.release.rv64 = "bin/linux/libdiscord_game_sdk.so"
|
|
@@ -1,25 +1,38 @@
|
|||||||
|
class_name DiscordSDKTutorial
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
# 1. Put the addons/ folder in your Godot project
|
## 1. Put the addons/ folder in your Godot project[br]
|
||||||
# 2. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". (if it doesn't show up restart your project and try again)
|
## 2. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". [br](if it doesn't show up restart your project and try again)[br]
|
||||||
# 3. Restart your project
|
## 3. Restart your project[br]
|
||||||
# 4. Create an Application under https://discord.com/developers/applications and get the Application ID
|
## 4. Create an Application under https://discord.com/developers/applications and get the Application ID br]
|
||||||
# 5. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
|
## 5. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys[br]
|
||||||
|
##
|
||||||
#SELECT THE TEXT WITH YOUR MOUSE AND CTR + K TO UNCOMMENT THE FOLLOWING
|
## This is your [code]_ready()[/code] function wich could be anywhere
|
||||||
|
## [codeblock]
|
||||||
#func _ready():
|
## func _ready():
|
||||||
# Discord_Activity.app_id = 1099618430065324082 # Application ID
|
## # Application ID
|
||||||
# print("Discord working: " + str(Discord_Activity.get_is_discord_working())) # A boolean if everything worked
|
## DiscordSDK.app_id = 1099618430065324082
|
||||||
# Discord_Activity.details = "A demo activity by vaporvee#1231"
|
## # this is boolean if everything worked
|
||||||
# Discord_Activity.state = "Checkpoint 23/23"
|
## print("Discord working: " + str(DiscordSDK.get_is_discord_working()))
|
||||||
#
|
## # Set the first custom text row of the activity here
|
||||||
# Discord_Activity.large_image = "game" # Image key from "Art Assets"
|
## DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||||
# Discord_Activity.large_image_text = "Try it now!"
|
## # Set the second custom text row of the activity here
|
||||||
# Discord_Activity.small_image = "boss" # Image key from "Art Assets"
|
## DiscordSDK.state = "Checkpoint 23/23"
|
||||||
# Discord_Activity.small_image_text = "Fighting the end boss! D:"
|
## # Image key for small image from "Art Assets" from the Discord Developer website
|
||||||
#
|
## DiscordSDK.large_image = "game"
|
||||||
# Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system()) # "02:41 elapsed"
|
## # Tooltip text for the large image
|
||||||
# Discord_Activity.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
## DiscordSDK.large_image_text = "Try it now!"
|
||||||
#
|
## # Image key for large image from "Art Assets" from the Discord Developer website
|
||||||
# Discord_Activity.refresh() # Always refresh after changing the values!
|
## DiscordSDK.small_image = "boss"
|
||||||
|
## # Tooltip text for the small image
|
||||||
|
## DiscordSDK.small_image_text = "Fighting the end boss! D:"
|
||||||
|
## # "02:41 elapsed" timestamp for the activity
|
||||||
|
## DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||||
|
## # "59:59 remaining" timestamp for the activity
|
||||||
|
## DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
|
||||||
|
## # Always refresh after changing the values!
|
||||||
|
## DiscordSDK.refresh()
|
||||||
|
## [/codeblock]
|
||||||
|
##
|
||||||
|
## @tutorial(More information here): https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start
|
||||||
|
## @tutorial(Make your Application ID and else here): https://discord.com/developers/applications
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
@tool
|
|
||||||
extends EditorExportPlugin
|
|
||||||
|
|
||||||
func _export_file(path, type, features):
|
|
||||||
if features[2] == "windows":
|
|
||||||
if features[4] == "x86_64":
|
|
||||||
add_shared_object("bin/windows/discord_game_sdk.dll",[],"/")
|
|
||||||
elif features[4] == "x86":
|
|
||||||
add_shared_object("bin/windows/discord_game_sdk_x86.dll",[],"/")
|
|
||||||
elif features[2] == "linux":
|
|
||||||
add_shared_object("bin/linux/libdiscord_game_sdk.so",[],"/")
|
|
||||||
elif features[2] == "macos":
|
|
||||||
add_shared_object("bin/macos/libdiscord_game_sdk.dylib",[],"/")
|
|
||||||
add_shared_object("bin/macos/libdiscord_game_sdk_aarch64.dylib",[],"/")
|
|
BIN
project/addons/discord-sdk-gd/logo.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://cm3gqnd84wbvu"
|
uid="uid://csl0e2px0cwc1"
|
||||||
path="res://.godot/imported/Core Updater.png-3bb461d6b6e9b42b926c572ac9a4a10f.ctex"
|
path="res://.godot/imported/logo.png-b59b4861dc0c64616d78af30082b08b5.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/Core Updater.png"
|
source_file="res://addons/discord-sdk-gd/logo.png"
|
||||||
dest_files=["res://.godot/imported/Core Updater.png-3bb461d6b6e9b42b926c572ac9a4a10f.ctex"]
|
dest_files=["res://.godot/imported/logo.png-b59b4861dc0c64616d78af30082b08b5.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
267
project/addons/discord-sdk-gd/nodes/Debug.tscn
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
[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():
|
||||||
|
DiscordSDK.connect(\"activity_join_request\",_on_activity_join_request)
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
if(DiscordSDK.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(DiscordSDK.is_public_party)).replace(\"{instanced}\",str(DiscordSDK.instanced)).replace(\"{ssecret}\",DiscordSDK.spectate_secret).replace(\"{jsecret}\",DiscordSDK.join_secret).replace(\"{msecret}\",DiscordSDK.match_secret).replace(\"{mpartysize}\",str(DiscordSDK.max_party_size)).replace(\"{cpartysize}\",str(DiscordSDK.current_party_size)).replace(\"{partyid}\",DiscordSDK.party_id).replace(\"{id}\",str(DiscordSDK.app_id)).replace(\"{details}\",DiscordSDK.details).replace(\"{state}\",DiscordSDK.state).replace(\"{lkey}\",DiscordSDK.large_image).replace(\"{ltext}\",DiscordSDK.large_image_text).replace(\"{skey}\",DiscordSDK.small_image).replace(\"{stext}\",DiscordSDK.small_image_text).replace(\"{stimestamp}\",str(DiscordSDK.start_timestamp)).replace(\"{etimestamp}\",str(DiscordSDK.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()):
|
||||||
|
DiscordSDK.accept_join_request(user_request.id)
|
||||||
|
|
||||||
|
func _on_invite_with_user_id_text_submitted(new_text):
|
||||||
|
DiscordSDK.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
|
||||||
|
|
||||||
|
func _on_accept_with_user_id_text_submitted(new_text):
|
||||||
|
DiscordSDK.accept_invite(int(new_text))
|
||||||
|
|
||||||
|
func _on_print_current_user_on_console_pressed():
|
||||||
|
print(DiscordSDK.get_current_user())
|
||||||
|
|
||||||
|
func _on_toggle_sdk_toggled(button_pressed):
|
||||||
|
if(button_pressed):
|
||||||
|
DiscordSDK.unclear()
|
||||||
|
else:
|
||||||
|
DiscordSDK.clear(false)
|
||||||
|
|
||||||
|
func _on_print_friends_pressed():
|
||||||
|
print(DiscordSDK.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"]
|
18
project/addons/discord-sdk-gd/nodes/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 |
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dnfq6kug4x6o2"
|
||||||
|
path="res://.godot/imported/Checked.svg-152467b95b56fa0b9944b5cc25700916.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/discord-sdk-gd/nodes/assets/Checked.svg"
|
||||||
|
dest_files=["res://.godot/imported/Checked.svg-152467b95b56fa0b9944b5cc25700916.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/addons/discord-sdk-gd/nodes/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 |
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://compmm3kviqqe"
|
||||||
|
path="res://.godot/imported/Unchecked.svg-91cff67e13e7a1508fbc6a949f5f5f52.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg"
|
||||||
|
dest_files=["res://.godot/imported/Unchecked.svg-91cff67e13e7a1508fbc6a949f5f5f52.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
|
11
project/addons/discord-sdk-gd/nodes/assets/circle.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.72 44.72">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<circle class="cls-1" cx="22.36" cy="22.36" r="22.36"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 290 B |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://2no2ced378ds"
|
uid="uid://dtc6ckladq0td"
|
||||||
path="res://.godot/imported/Core Updater.svg-75aabb825d7cf085efdd2bf5760ba312.ctex"
|
path="res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/Core Updater.svg"
|
source_file="res://addons/discord-sdk-gd/nodes/assets/circle.svg"
|
||||||
dest_files=["res://.godot/imported/Core Updater.svg-75aabb825d7cf085efdd2bf5760ba312.ctex"]
|
dest_files=["res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
11
project/addons/discord-sdk-gd/nodes/debug.gd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
## This is a Debug Node wich will show some usefull info and buttons/input
|
||||||
|
##
|
||||||
|
## The DiscordSDK Debug Node will show info about the current values of its variables and some buttons to change them.
|
||||||
|
##
|
||||||
|
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
|
||||||
|
@tool
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
const DebugNodeGroup: PackedScene = preload("res://addons/discord-sdk-gd/nodes/Debug.tscn")
|
||||||
|
add_child(DebugNodeGroup.instantiate())
|
22
project/addons/discord-sdk-gd/nodes/discord_autoload.gd
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## This is a GDscript Node wich gets automatically added as Autoload while installing the addon.
|
||||||
|
##
|
||||||
|
## It can run in the background to comunicate with Discord.
|
||||||
|
## You don't need to use it unless you are using EditorPresence. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function.
|
||||||
|
##
|
||||||
|
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
|
||||||
|
@tool
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _process(_delta) -> void:
|
||||||
|
if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"):
|
||||||
|
if ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled",false) && Engine.is_editor_hint():
|
||||||
|
if DiscordSDK.app_id != 1108142249990176808:
|
||||||
|
DiscordSDK.app_id = 1108142249990176808
|
||||||
|
DiscordSDK.details = ProjectSettings.get_setting("application/config/name")
|
||||||
|
DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
|
||||||
|
DiscordSDK.large_image = "godot"
|
||||||
|
DiscordSDK.large_image_text = str(Engine.get_version_info().string)
|
||||||
|
DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||||
|
DiscordSDK.refresh()
|
||||||
|
if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint():
|
||||||
|
DiscordSDK.run_callbacks()
|
@@ -3,5 +3,5 @@
|
|||||||
name="DiscordSDK"
|
name="DiscordSDK"
|
||||||
description="Discord Game SDK support for GDScript in Godot"
|
description="Discord Game SDK support for GDScript in Godot"
|
||||||
author="vaporvee"
|
author="vaporvee"
|
||||||
version="1.3"
|
version="1.0.1"
|
||||||
script="plugin.gd"
|
script="plugin.gd"
|
||||||
|
@@ -1,13 +1,36 @@
|
|||||||
@tool
|
@tool
|
||||||
extends EditorPlugin
|
extends EditorPlugin
|
||||||
|
|
||||||
const ExportPlugin = preload("export.gd")
|
const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
|
||||||
var loaded_exportplugin = ExportPlugin.new()
|
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg")
|
||||||
|
var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
|
||||||
|
var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate()
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree() -> void:
|
||||||
add_autoload_singleton("updater_discordsdk", "sdk_utility.gd")
|
add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
|
||||||
add_export_plugin(loaded_exportplugin)
|
ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false)
|
||||||
|
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
|
||||||
|
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
|
||||||
|
|
||||||
func disable_plugin():
|
func _enable_plugin() -> void:
|
||||||
remove_autoload_singleton("updater_discordsdk")
|
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
|
||||||
remove_export_plugin(loaded_exportplugin)
|
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
|
||||||
|
add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd")
|
||||||
|
restart_window.connect("confirmed", save_no_restart)
|
||||||
|
restart_window.connect("canceled", save_and_restart)
|
||||||
|
EditorInterface.popup_dialog_centered(restart_window)
|
||||||
|
print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
|
||||||
|
|
||||||
|
func _disable_plugin() -> void:
|
||||||
|
remove_autoload_singleton("DiscordSDKLoader")
|
||||||
|
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
|
||||||
|
remove_custom_type("DiscordSDKDebug")
|
||||||
|
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")
|
||||||
|
push_warning("Please restart the editor to fully disable the DiscordSDK plugin")
|
||||||
|
|
||||||
|
func save_and_restart() -> void:
|
||||||
|
EditorInterface.save_all_scenes()
|
||||||
|
EditorInterface.restart_editor(true)
|
||||||
|
|
||||||
|
func save_no_restart() -> void:
|
||||||
|
EditorInterface.restart_editor(false)
|
||||||
|
111
project/addons/discord-sdk-gd/restart_window.tscn
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
[gd_scene load_steps=8 format=3 uid="uid://byc4c6d5tpomq"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png" id="1_0svbg"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1t7mm"]
|
||||||
|
|
||||||
|
[sub_resource type="Theme" id="Theme_swwco"]
|
||||||
|
Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
||||||
|
|
||||||
|
[sub_resource type="Image" id="Image_6icdx"]
|
||||||
|
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",
|
||||||
|
"height": 16,
|
||||||
|
"mipmaps": false,
|
||||||
|
"width": 16
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
||||||
|
image = SubResource("Image_6icdx")
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||||
|
|
||||||
|
[node name="RestartWindow" type="ConfirmationDialog"]
|
||||||
|
title = "Restart required"
|
||||||
|
initial_position = 2
|
||||||
|
size = Vector2i(430, 500)
|
||||||
|
visible = true
|
||||||
|
transient = false
|
||||||
|
unresizable = true
|
||||||
|
theme = SubResource("Theme_swwco")
|
||||||
|
ok_button_text = "Restart"
|
||||||
|
cancel_button_text = "Save and restart"
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -207.0
|
||||||
|
offset_top = 8.0
|
||||||
|
offset_right = 207.0
|
||||||
|
offset_bottom = 451.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||||
|
custom_minimum_size = Vector2(400, 0)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -200.0
|
||||||
|
offset_right = 200.0
|
||||||
|
offset_bottom = 389.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
theme_override_constants/separation = 15
|
||||||
|
theme_override_styles/separator = SubResource("StyleBoxEmpty_5vqdt")
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
|
[node name="DocsIcon" type="TextureRect" parent="Panel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
size_flags_vertical = 4
|
||||||
|
texture = SubResource("ImageTexture_gdtpn")
|
||||||
|
stretch_mode = 2
|
||||||
|
|
||||||
|
[node name="LinkButton" type="LinkButton" parent="Panel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 8
|
||||||
|
mouse_default_cursor_shape = 16
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
text = "HOW TO USE"
|
||||||
|
uri = "https://github.com/vaporvee/discord-sdk-godot/wiki"
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(128, 128)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 0
|
||||||
|
texture = ExtResource("1_0svbg")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 250)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 0
|
||||||
|
mouse_filter = 1
|
||||||
|
theme_override_font_sizes/normal_font_size = 16
|
||||||
|
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]Thanks for enabling the
|
||||||
|
[rainbow][b]Discord Game SDK Plugin[/b][/rainbow]
|
||||||
|
made by vaporvee. ❤️
|
||||||
|
|
||||||
|
|
||||||
|
You need to [wave][b]restart[/b][/wave] the editor to fully enable this plugin!
|
||||||
|
Do you want to [wave][b]save[/b][/wave] your project before restarting?
|
||||||
|
(Error messages after the first restart are normal. Please ignore them)"
|
@@ -1,4 +0,0 @@
|
|||||||
extends Node
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
Discord_Activity.coreupdate()
|
|
BIN
project/assets/1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://b5dn3rnp5eqqp"
|
uid="uid://ht210p8vs8s7"
|
||||||
path="res://.godot/imported/Debug.png-81b23c4a8a55e89d458626f08de3d2fb.ctex"
|
path="res://.godot/imported/1.png-c9a8e694d0d275633d567702fb508122.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://assets/Debug.png"
|
source_file="res://assets/1.png"
|
||||||
dest_files=["res://.godot/imported/Debug.png-81b23c4a8a55e89d458626f08de3d2fb.ctex"]
|
dest_files=["res://.godot/imported/1.png-c9a8e694d0d275633d567702fb508122.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 444 KiB |
Before Width: | Height: | Size: 6.4 KiB |
@@ -1,6 +0,0 @@
|
|||||||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<g id="Discord Other">
|
|
||||||
<path id="Vector" d="M389.77 149.331V469.331H335.043V149.331L273.052 212.264L234.665 173.064L362.534 42.664L490.666 173.064L452.278 213.064L389.77 149.331Z" fill="#5865F2"/>
|
|
||||||
<path id="Vector_2" d="M122.228 362.666V42.664H176.955L176.955 362.666L238.945 299.731L277.332 338.931L149.462 469.331L21.332 338.931L59.719 298.931L122.228 362.666Z" fill="#5865F2"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 5.2 KiB |
@@ -1,5 +0,0 @@
|
|||||||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<g id="Discord Other">
|
|
||||||
<path id="Vector" d="M426.667 170.667H366.72C357.098 153.978 343.824 139.684 327.893 128.853L362.667 94.08L332.587 64L286.293 110.293C276.48 107.947 266.453 106.667 256 106.667C245.547 106.667 235.52 107.947 225.92 110.293L179.413 64L149.333 94.08L183.893 128.853C168.107 139.733 154.88 154.027 145.28 170.667H85.3333V213.333H129.92C128.853 220.373 128 227.413 128 234.667V256H85.3333V298.667H128V320C128 327.253 128.853 334.293 129.92 341.333H85.3333V384H145.28C167.467 422.187 208.64 448 256 448C303.36 448 344.533 422.187 366.72 384H426.667V341.333H382.08C383.147 334.293 384 327.253 384 320V298.667H426.667V256H384V234.667C384 227.413 383.147 220.373 382.08 213.333H426.667V170.667ZM298.667 341.333H213.333V298.667H298.667V341.333ZM298.667 256H213.333V213.333H298.667V256Z" fill="#5865F2"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 930 B |
BIN
project/assets/GodotEditorPresenceBanner.png
Normal file
After Width: | Height: | Size: 367 KiB |
34
project/assets/GodotEditorPresenceBanner.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dp4u0g6gvyt0a"
|
||||||
|
path="res://.godot/imported/GodotEditorPresenceBanner.png-5d1b012e64655706e9686e0163b65d30.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/GodotEditorPresenceBanner.png"
|
||||||
|
dest_files=["res://.godot/imported/GodotEditorPresenceBanner.png-5d1b012e64655706e9686e0163b65d30.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
|
184
project/assets/GodotEditorPresenceBanner.svg
Normal file
After Width: | Height: | Size: 350 KiB |
37
project/assets/GodotEditorPresenceBanner.svg.import
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://08bj2tfacvhm"
|
||||||
|
path="res://.godot/imported/GodotEditorPresenceBanner.svg-e0420faa20460520008caa2101993296.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/GodotEditorPresenceBanner.svg"
|
||||||
|
dest_files=["res://.godot/imported/GodotEditorPresenceBanner.svg-e0420faa20460520008caa2101993296.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
|
34
project/assets/Logo_V2_No_Bg_Small.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bjns3n0prshdy"
|
||||||
|
path="res://.godot/imported/Logo_V2_No_Bg_Small.png-6c9c0ba88b8e0a9cb7aa1acb948a1191.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/Logo_V2_No_Bg_Small.png"
|
||||||
|
dest_files=["res://.godot/imported/Logo_V2_No_Bg_Small.png-6c9c0ba88b8e0a9cb7aa1acb948a1191.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
|
@@ -8,18 +8,17 @@ custom_features=""
|
|||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../../demo/Discord_Activity.exe"
|
export_path="../../eexport/windows/discord-sdk-godot-demo.exe"
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
encrypt_directory=false
|
encrypt_directory=false
|
||||||
script_encryption_key=""
|
|
||||||
|
|
||||||
[preset.0.options]
|
[preset.0.options]
|
||||||
|
|
||||||
custom_template/debug=""
|
custom_template/debug=""
|
||||||
custom_template/release=""
|
custom_template/release=""
|
||||||
debug/export_console_script=1
|
debug/export_console_wrapper=1
|
||||||
binary_format/embed_pck=true
|
binary_format/embed_pck=true
|
||||||
texture_format/bptc=true
|
texture_format/bptc=true
|
||||||
texture_format/s3tc=true
|
texture_format/s3tc=true
|
||||||
@@ -27,23 +26,20 @@ texture_format/etc=false
|
|||||||
texture_format/etc2=false
|
texture_format/etc2=false
|
||||||
binary_format/architecture="x86_64"
|
binary_format/architecture="x86_64"
|
||||||
codesign/enable=false
|
codesign/enable=false
|
||||||
codesign/identity_type=0
|
|
||||||
codesign/identity=""
|
|
||||||
codesign/password=""
|
|
||||||
codesign/timestamp=true
|
codesign/timestamp=true
|
||||||
codesign/timestamp_server_url=""
|
codesign/timestamp_server_url=""
|
||||||
codesign/digest_algorithm=1
|
codesign/digest_algorithm=1
|
||||||
codesign/description=""
|
codesign/description=""
|
||||||
codesign/custom_options=PackedStringArray()
|
codesign/custom_options=PackedStringArray()
|
||||||
application/modify_resources=false
|
application/modify_resources=true
|
||||||
application/icon=""
|
application/icon="res://assets/Logo_V2.png"
|
||||||
application/console_wrapper_icon=""
|
application/console_wrapper_icon=""
|
||||||
application/icon_interpolation=4
|
application/icon_interpolation=4
|
||||||
application/file_version=""
|
application/file_version=""
|
||||||
application/product_version=""
|
application/product_version=""
|
||||||
application/company_name=""
|
application/company_name=""
|
||||||
application/product_name=""
|
application/product_name=""
|
||||||
application/file_description=""
|
application/file_description="Discord SDK Godot Test"
|
||||||
application/copyright=""
|
application/copyright=""
|
||||||
application/trademarks=""
|
application/trademarks=""
|
||||||
ssh_remote_deploy/enabled=false
|
ssh_remote_deploy/enabled=false
|
||||||
@@ -63,3 +59,43 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
|
|||||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Linux/X11"
|
||||||
|
platform="Linux/X11"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="../../eexport/linux/discord-sdk-godot-demo.x86_64"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
binary_format/embed_pck=true
|
||||||
|
texture_format/bptc=true
|
||||||
|
texture_format/s3tc=true
|
||||||
|
texture_format/etc=false
|
||||||
|
texture_format/etc2=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||||
|
export DISPLAY=:0
|
||||||
|
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
|
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||||
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
|
rm -rf \"{temp_dir}\""
|
||||||
|
@@ -1,18 +1,63 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
func _ready():
|
func _ready() -> void:
|
||||||
Discord_Activity.app_id = 1099618430065324082
|
set_activity()
|
||||||
Discord_Activity.details = "A demo activity by vaporvee#1231"
|
DiscordSDK.connect("activity_join_request",_on_activity_join_request)
|
||||||
Discord_Activity.state = "Checkpoint 23/23"
|
DiscordSDK.connect("activity_join",_on_activity_join)
|
||||||
|
DiscordSDK.connect("activity_spectate",_on_activity_spectate)
|
||||||
|
DiscordSDK.connect("relationships_init",_on_relationship_init)
|
||||||
|
DiscordSDK.connect("updated_relationship", _on_updated_relationship)
|
||||||
|
|
||||||
Discord_Activity.large_image = "game"
|
func set_activity() -> void:
|
||||||
Discord_Activity.large_image_text = "Try it now!"
|
DiscordSDK.clear(false)
|
||||||
Discord_Activity.small_image = "boss"
|
DiscordSDK.app_id = 1099618430065324082
|
||||||
Discord_Activity.small_image_text = "Fighting the end boss! D:"
|
DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||||
|
DiscordSDK.state = "Checkpoint 23/23"
|
||||||
|
|
||||||
#Discord_Activity.start_timestamp = int(Time.get_unix_time_from_system())
|
DiscordSDK.large_image = "example_game"
|
||||||
Discord_Activity.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
DiscordSDK.large_image_text = "Try it now!"
|
||||||
|
DiscordSDK.small_image = "boss"
|
||||||
|
DiscordSDK.small_image_text = "Fighting the end boss! D:"
|
||||||
|
DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
|
||||||
|
|
||||||
Discord_Activity.refresh()
|
# It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server understands and
|
||||||
|
# returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others.
|
||||||
|
var my_secret: String = str(randi_range(0,999999))
|
||||||
|
|
||||||
|
DiscordSDK.party_id = "mylobbycanbeeverything_" + my_secret
|
||||||
|
DiscordSDK.current_party_size = 1
|
||||||
|
DiscordSDK.max_party_size = 4
|
||||||
|
DiscordSDK.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
||||||
|
DiscordSDK.join_secret = "j_" + my_secret
|
||||||
|
DiscordSDK.spectate_secret = "s_" + my_secret
|
||||||
|
DiscordSDK.is_public_party = true
|
||||||
|
DiscordSDK.instanced = true #required for spectate
|
||||||
|
#DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||||
|
DiscordSDK.register_command(r"C:\Users\yanni\Desktop\demo\DiscordSDK.exe")
|
||||||
|
#DiscordSDK.register_steam(1389990)
|
||||||
|
DiscordSDK.refresh()
|
||||||
|
|
||||||
|
var user_request: Dictionary;
|
||||||
|
|
||||||
|
func _on_activity_join_request(user_requesting) -> void:
|
||||||
|
print(user_requesting)
|
||||||
|
user_request = user_requesting
|
||||||
|
|
||||||
|
func _on_activity_join(secret) -> void:
|
||||||
|
if(DiscordSDK.join_secret != secret):
|
||||||
|
DiscordSDK.current_party_size = clamp(int(secret) + 1, 0, DiscordSDK.max_party_size)
|
||||||
|
DiscordSDK.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
||||||
|
DiscordSDK.match_secret = secret.replace("j_","m_")
|
||||||
|
DiscordSDK.join_secret = secret
|
||||||
|
DiscordSDK.spectate_secret = secret.replace("j_","s_")
|
||||||
|
DiscordSDK.refresh()
|
||||||
|
|
||||||
|
func _on_activity_spectate(secret) -> void:
|
||||||
|
print(secret)
|
||||||
|
|
||||||
|
func _on_relationship_init():
|
||||||
|
print("initialized")
|
||||||
|
|
||||||
|
func _on_updated_relationship(relationship):
|
||||||
|
print(relationship)
|
||||||
|
|
||||||
$Info.text = $Info.text.replace("{discordinfo}",str(Discord_Activity.get_is_discord_working())).replace("{id}",str(Discord_Activity.app_id)).replace("{details}",Discord_Activity.details).replace("{state}",Discord_Activity.state).replace("{lkey}",Discord_Activity.large_image).replace("{ltext}",Discord_Activity.large_image_text).replace("{skey}",Discord_Activity.small_image).replace("{stext}",Discord_Activity.small_image_text).replace("{stimestamp}",str(Discord_Activity.start_timestamp)).replace("{etimestamp}",str(Discord_Activity.end_timestamp))
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://dmx2xuigcpvt4"]
|
[gd_scene load_steps=4 format=3 uid="uid://dyc3kseph4el7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
|
[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://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"]
|
||||||
|
[ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/debug.gd" id="6_ujijw"]
|
||||||
|
|
||||||
[node name="Node" type="Node"]
|
[node name="Node" type="Node"]
|
||||||
script = ExtResource("1_kl8ri")
|
script = ExtResource("1_kl8ri")
|
||||||
@@ -18,45 +19,26 @@ color = Color(0.345098, 0.396078, 0.94902, 1)
|
|||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
texture_filter = 4
|
texture_filter = 4
|
||||||
position = Vector2(565, 308)
|
position = Vector2(789, 330.5)
|
||||||
scale = Vector2(0.408203, 0.408203)
|
scale = Vector2(0.408203, 0.408203)
|
||||||
texture = ExtResource("2_1hv5q")
|
texture = ExtResource("2_gd222")
|
||||||
|
|
||||||
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
|
[node name="DiscordSDK Test" type="RichTextLabel" parent="."]
|
||||||
anchors_preset = 8
|
anchors_preset = -1
|
||||||
anchor_left = 0.5
|
anchor_left = 0.293
|
||||||
anchor_top = 0.5
|
anchor_top = 0.59
|
||||||
anchor_right = 0.5
|
anchor_right = 0.736
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.727
|
||||||
offset_left = -257.0
|
offset_left = 208.464
|
||||||
offset_top = 54.0
|
offset_top = 22.18
|
||||||
offset_right = 257.0
|
offset_right = 209.128
|
||||||
offset_bottom = 150.0
|
offset_bottom = 22.4039
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
theme_override_colors/font_outline_color = Color(1, 1, 1, 1)
|
|
||||||
theme_override_constants/outline_size = 10
|
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center][font s=60][rainbow]DiscordSDK Test[/rainbow][/font]"
|
text = "[center][font s=60]DiscordSDK Test"
|
||||||
|
|
||||||
[node name="Info" type="RichTextLabel" parent="."]
|
[node name="DiscordSDKDebug" type="Node" parent="."]
|
||||||
offset_left = 7.0
|
script = ExtResource("6_ujijw")
|
||||||
offset_top = 6.0
|
|
||||||
offset_right = 514.0
|
|
||||||
offset_bottom = 722.0
|
|
||||||
text = "Discord working: {discordinfo}
|
|
||||||
|
|
||||||
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}"
|
|
||||||
scroll_active = false
|
|
||||||
|
@@ -11,8 +11,9 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="GDExtension DiscordSDK Test Project"
|
config/name="GDExtension DiscordSDK Test Project"
|
||||||
|
config/tags=PackedStringArray("vaporvee")
|
||||||
run/main_scene="res://main.tscn"
|
run/main_scene="res://main.tscn"
|
||||||
config/features=PackedStringArray("4.0")
|
config/features=PackedStringArray("4.2")
|
||||||
boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1)
|
boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1)
|
||||||
boot_splash/image="res://assets/Banner_v1.png"
|
boot_splash/image="res://assets/Banner_v1.png"
|
||||||
boot_splash/fullsize=false
|
boot_splash/fullsize=false
|
||||||
@@ -20,7 +21,11 @@ config/icon="res://assets/Logo_V2.png"
|
|||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
updater_discordsdk="*res://addons/discord-sdk-gd/sdk_utility.gd"
|
DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/discord_autoload.gd"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/resizable=false
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
|
26
release.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import os
|
||||||
|
from distutils.dir_util import copy_tree
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
folder_path = "project/addons/discord-sdk-gd/bin/windows"
|
||||||
|
|
||||||
|
# Filter files that end with 'TMP' or 'exp' or 'lib'
|
||||||
|
matching_files = [
|
||||||
|
file for file in os.listdir(folder_path) if file.endswith(("TMP", "exp", "lib"))
|
||||||
|
]
|
||||||
|
|
||||||
|
for file in matching_files:
|
||||||
|
file_path = os.path.join(folder_path, file)
|
||||||
|
os.remove(file_path)
|
||||||
|
|
||||||
|
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
|
||||||
|
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
|
||||||
|
|
||||||
|
copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons")
|
||||||
|
open(
|
||||||
|
"release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/bin/.gdignore", "a"
|
||||||
|
).close()
|
||||||
|
|
||||||
|
shutil.make_archive("release/ADDON-Discord-SDK-Godot", "zip", "release/temp/")
|
||||||
|
|
||||||
|
shutil.rmtree("release/temp/")
|
8
setup.py
@@ -6,6 +6,12 @@ import os
|
|||||||
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
|
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
|
||||||
zip_ref.extractall("src/lib/discord_game_sdk/")
|
zip_ref.extractall("src/lib/discord_game_sdk/")
|
||||||
|
|
||||||
|
# Patch the SDK to actually build, since it's missing an include
|
||||||
|
with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f:
|
||||||
|
s = f.read()
|
||||||
|
f.seek(0)
|
||||||
|
f.write("#include <cstdint>\n" + s)
|
||||||
|
|
||||||
copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/")
|
copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/")
|
||||||
os.rename(
|
os.rename(
|
||||||
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",
|
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",
|
||||||
@@ -41,4 +47,4 @@ shutil.rmtree("src/lib/discord_game_sdk/bin/x86/", ignore_errors=True)
|
|||||||
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
|
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
|
||||||
os.remove("src/lib/discord_game_sdk/README.md")
|
os.remove("src/lib/discord_game_sdk/README.md")
|
||||||
|
|
||||||
os.system("git submodule update --init")
|
os.system("git submodule update --init --remote")
|
||||||
|
@@ -1,86 +1,113 @@
|
|||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
#include "lib/discord_game_sdk/cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
#include <godot_cpp/classes/editor_plugin.hpp>
|
|
||||||
#include <godot_cpp/variant/utility_functions.hpp>
|
#include <godot_cpp/variant/utility_functions.hpp>
|
||||||
#include <godot_cpp/classes/time.hpp>
|
|
||||||
|
|
||||||
using namespace godot;
|
#define BIND_METHOD(method, ...) godot::ClassDB::bind_method(D_METHOD(#method, ##__VA_ARGS__), &DiscordSDK::method)
|
||||||
|
#define BIND_SET_GET(property_name, variant_type) \
|
||||||
Discord_Activity *Discord_Activity::singleton = nullptr;
|
godot::ClassDB::bind_method(D_METHOD("get_" #property_name), &DiscordSDK::get_##property_name); \
|
||||||
|
godot::ClassDB::bind_method(D_METHOD("set_" #property_name, #variant_type), &DiscordSDK::set_##property_name); \
|
||||||
|
godot::ClassDB::add_property(get_class_static(), PropertyInfo(variant_type, #property_name), "set_" #property_name, "get_" #property_name)
|
||||||
|
#define BIND_SIGNAL(signal_name, ...) godot::ClassDB::add_signal(get_class_static(), MethodInfo(#signal_name, ##__VA_ARGS__))
|
||||||
|
#define SET_GET(variable, setter, ...) /*getter isn't mandatory for this project*/ \
|
||||||
|
decltype(DiscordSDK::variable) DiscordSDK::get_##variable() { return variable; } \
|
||||||
|
void DiscordSDK::set_##variable(decltype(DiscordSDK::variable) value) \
|
||||||
|
{ \
|
||||||
|
variable = value; \
|
||||||
|
setter; \
|
||||||
|
}
|
||||||
|
|
||||||
|
DiscordSDK *DiscordSDK::singleton = nullptr;
|
||||||
discord::Core *core{};
|
discord::Core *core{};
|
||||||
discord::Result result;
|
discord::Result result;
|
||||||
discord::Activity activity{};
|
discord::Activity activity{};
|
||||||
discord::User user{};
|
discord::User user{};
|
||||||
|
|
||||||
void Discord_Activity::_bind_methods()
|
void DiscordSDK::_bind_methods()
|
||||||
{
|
{
|
||||||
ClassDB::bind_method(D_METHOD("debug"), &Discord_Activity::debug);
|
BIND_SET_GET(app_id, Variant::INT);
|
||||||
ClassDB::bind_method(D_METHOD("coreupdate"), &Discord_Activity::coreupdate);
|
BIND_SET_GET(state, Variant::STRING);
|
||||||
|
BIND_SET_GET(details, Variant::STRING);
|
||||||
|
BIND_SET_GET(large_image, Variant::STRING);
|
||||||
|
BIND_SET_GET(large_image_text, Variant::STRING);
|
||||||
|
BIND_SET_GET(small_image, Variant::STRING);
|
||||||
|
BIND_SET_GET(small_image_text, Variant::STRING);
|
||||||
|
BIND_SET_GET(start_timestamp, Variant::INT);
|
||||||
|
BIND_SET_GET(end_timestamp, Variant::INT);
|
||||||
|
BIND_SET_GET(party_id, Variant::STRING);
|
||||||
|
BIND_SET_GET(current_party_size, Variant::INT);
|
||||||
|
BIND_SET_GET(max_party_size, Variant::INT);
|
||||||
|
BIND_SET_GET(match_secret, Variant::STRING);
|
||||||
|
BIND_SET_GET(join_secret, Variant::STRING);
|
||||||
|
BIND_SET_GET(spectate_secret, Variant::STRING);
|
||||||
|
BIND_SET_GET(instanced, Variant::BOOL);
|
||||||
|
BIND_SET_GET(is_public_party, Variant::BOOL);
|
||||||
|
BIND_SIGNAL(activity_join, PropertyInfo(Variant::STRING, "join_secret"));
|
||||||
|
BIND_SIGNAL(activity_spectate, PropertyInfo(Variant::STRING, "spectate_secret"));
|
||||||
|
BIND_SIGNAL(activity_join_request, PropertyInfo(Variant::DICTIONARY, "user_requesting"));
|
||||||
|
BIND_SIGNAL(updated_relationship, PropertyInfo(Variant::DICTIONARY, "relationship"));
|
||||||
|
BIND_SIGNAL(overlay_toggle, PropertyInfo(Variant::BOOL, "is_locked"));
|
||||||
|
BIND_SIGNAL(relationships_init);
|
||||||
|
BIND_METHOD(debug);
|
||||||
|
BIND_METHOD(run_callbacks);
|
||||||
|
BIND_METHOD(refresh);
|
||||||
|
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &DiscordSDK::clear, DEFVAL(false));
|
||||||
|
BIND_METHOD(unclear);
|
||||||
|
BIND_METHOD(register_command, "command");
|
||||||
|
BIND_METHOD(register_steam, "steam_id");
|
||||||
|
BIND_METHOD(accept_join_request, "user_id");
|
||||||
|
BIND_METHOD(send_invite, "user_id", "is_spectate", "message_content");
|
||||||
|
BIND_METHOD(accept_invite, "user_id");
|
||||||
|
BIND_METHOD(get_current_user);
|
||||||
|
BIND_METHOD(get_all_relationships);
|
||||||
|
BIND_METHOD(get_is_overlay_enabled);
|
||||||
|
BIND_METHOD(get_is_overlay_locked);
|
||||||
|
BIND_METHOD(open_invite_overlay, "is_spectate");
|
||||||
|
BIND_METHOD(open_server_invite_overlay, "invite_code");
|
||||||
|
BIND_METHOD(open_voice_settings);
|
||||||
|
BIND_METHOD(get_is_discord_working);
|
||||||
|
BIND_METHOD(get_result_int);
|
||||||
|
}
|
||||||
|
SET_GET(state, activity.SetState(value.utf8().get_data()))
|
||||||
|
SET_GET(details, activity.SetDetails(value.utf8().get_data()))
|
||||||
|
SET_GET(large_image, activity.GetAssets().SetLargeImage(value.utf8().get_data()))
|
||||||
|
SET_GET(large_image_text, activity.GetAssets().SetLargeText(value.utf8().get_data()))
|
||||||
|
SET_GET(small_image, activity.GetAssets().SetSmallImage(value.utf8().get_data()))
|
||||||
|
SET_GET(small_image_text, activity.GetAssets().SetSmallText(value.utf8().get_data()))
|
||||||
|
SET_GET(start_timestamp, activity.GetTimestamps().SetStart(value))
|
||||||
|
SET_GET(end_timestamp, activity.GetTimestamps().SetEnd(value))
|
||||||
|
SET_GET(party_id, activity.GetParty().SetId(value.utf8().get_data()))
|
||||||
|
SET_GET(current_party_size, activity.GetParty().GetSize().SetCurrentSize(value))
|
||||||
|
SET_GET(max_party_size, activity.GetParty().GetSize().SetMaxSize(value))
|
||||||
|
SET_GET(match_secret, activity.GetSecrets().SetMatch(value.utf8().get_data()))
|
||||||
|
SET_GET(join_secret, activity.GetSecrets().SetJoin(value.utf8().get_data()))
|
||||||
|
SET_GET(spectate_secret, activity.GetSecrets().SetSpectate(value.utf8().get_data()))
|
||||||
|
SET_GET(instanced, activity.SetInstance(value))
|
||||||
|
SET_GET(is_public_party, activity.GetParty().SetPrivacy(static_cast<discord::ActivityPartyPrivacy>(value)))
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_app_id"), &Discord_Activity::get_app_id);
|
DiscordSDK::DiscordSDK()
|
||||||
ClassDB::bind_method(D_METHOD("set_app_id", "app_id"), &Discord_Activity::set_app_id);
|
{
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "app_id"), "set_app_id", "get_app_id");
|
singleton = this;
|
||||||
ClassDB::bind_method(D_METHOD("get_state"), &Discord_Activity::get_state);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_state", "state"), &Discord_Activity::set_state);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "state"), "set_state", "get_state");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_details"), &Discord_Activity::get_details);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_details", "details"), &Discord_Activity::set_details);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "details"), "set_details", "get_details");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image"), &Discord_Activity::get_large_image);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image", "large_image"), &Discord_Activity::set_large_image);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image"), "set_large_image", "get_large_image");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image_text"), &Discord_Activity::get_large_image_text);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image_text", "large_image_text"), &Discord_Activity::set_large_image_text);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image_text"), "set_large_image_text", "get_large_image_text");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image"), &Discord_Activity::get_small_image);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image", "small_image"), &Discord_Activity::set_small_image);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image"), "set_small_image", "get_small_image");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image_text"), &Discord_Activity::get_small_image_text);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image_text", "large_small_text"), &Discord_Activity::set_small_image_text);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image_text"), "set_small_image_text", "get_small_image_text");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_start_timestamp"), &Discord_Activity::get_start_timestamp);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_start_timestamp", "start_timestamp"), &Discord_Activity::set_start_timestamp);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_timestamp"), "set_start_timestamp", "get_start_timestamp");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_end_timestamp"), &Discord_Activity::get_end_timestamp);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_end_timestamp", "end_timestamp"), &Discord_Activity::set_end_timestamp);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "end_timestamp"), "set_end_timestamp", "get_end_timestamp");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("refresh"), &Discord_Activity::refresh);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_is_discord_working"), &Discord_Activity::get_is_discord_working);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_result_int"), &Discord_Activity::get_result_int);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord_Activity *Discord_Activity::get_singleton()
|
DiscordSDK::~DiscordSDK()
|
||||||
|
{
|
||||||
|
singleton = nullptr;
|
||||||
|
delete core; // couldn't use destructor because it would not compile on linux
|
||||||
|
core = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiscordSDK *DiscordSDK::get_singleton()
|
||||||
{
|
{
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord_Activity::Discord_Activity()
|
void DiscordSDK::run_callbacks()
|
||||||
{
|
|
||||||
ERR_FAIL_COND(singleton != nullptr);
|
|
||||||
singleton = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Discord_Activity::~Discord_Activity()
|
|
||||||
{
|
|
||||||
ERR_FAIL_COND(singleton != this);
|
|
||||||
singleton = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Discord_Activity::coreupdate()
|
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
{
|
|
||||||
::core->RunCallbacks();
|
::core->RunCallbacks();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void Discord_Activity::debug()
|
void DiscordSDK::debug()
|
||||||
{
|
{
|
||||||
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
||||||
activity.SetState("Test from Godot!");
|
activity.SetState("Test from Godot!");
|
||||||
@@ -93,116 +120,307 @@ void Discord_Activity::debug()
|
|||||||
if (result == discord::Result::Ok)
|
if (result == discord::Result::Ok)
|
||||||
{
|
{
|
||||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
|
||||||
{ core->UserManager().GetCurrentUser(&user); });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_app_id(int64_t value)
|
void DiscordSDK::set_app_id(int64_t value)
|
||||||
{
|
{
|
||||||
app_id = value;
|
app_id = value;
|
||||||
result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core);
|
if (app_id > 0)
|
||||||
}
|
|
||||||
int64_t Discord_Activity::get_app_id()
|
|
||||||
{
|
|
||||||
return app_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Discord_Activity::set_state(String value)
|
|
||||||
{
|
|
||||||
state = value;
|
|
||||||
activity.SetState(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String Discord_Activity::get_state()
|
|
||||||
{
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
void Discord_Activity::set_details(String value)
|
|
||||||
{
|
|
||||||
details = value;
|
|
||||||
activity.SetDetails(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String Discord_Activity::get_details()
|
|
||||||
{
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Discord_Activity::refresh()
|
|
||||||
{
|
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
|
||||||
{
|
{
|
||||||
|
result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything
|
||||||
|
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
{
|
||||||
|
// initialize currentuser
|
||||||
|
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
||||||
|
{discord::User user{};
|
||||||
|
core->UserManager().GetCurrentUser(&user); });
|
||||||
|
// signals
|
||||||
|
core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("activity_join", secret); });
|
||||||
|
core->ActivityManager().OnActivitySpectate.Connect([](const char *secret)
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("activity_spectate", secret); });
|
||||||
|
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("activity_join_request", user2dict(user)); });
|
||||||
|
core->OverlayManager().OnToggle.Connect([](bool is_locked)
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("overlay_toggle", is_locked); });
|
||||||
|
core->RelationshipManager().OnRefresh.Connect([&]()
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("relationships_init"); });
|
||||||
|
core->RelationshipManager().OnRelationshipUpdate.Connect([&](discord::Relationship const &relationship)
|
||||||
|
{ DiscordSDK::get_singleton()
|
||||||
|
->emit_signal("updated_relationship", relationship2dict(relationship)); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int64_t DiscordSDK::get_app_id()
|
||||||
|
{
|
||||||
|
if (app_id != 0)
|
||||||
|
return app_id;
|
||||||
|
return old_app_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiscordSDK::refresh()
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
{
|
||||||
|
activity.GetParty().SetPrivacy(discord::ActivityPartyPrivacy::Public);
|
||||||
|
activity.SetType(discord::ActivityType::Playing);
|
||||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
|
||||||
{ core->UserManager().GetCurrentUser(&user); });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_large_image(String value)
|
void DiscordSDK::clear(bool reset_values = false)
|
||||||
{
|
{
|
||||||
large_image = value;
|
if (get_is_discord_working())
|
||||||
activity.GetAssets().SetLargeImage(value.utf8().get_data());
|
{
|
||||||
}
|
if (reset_values)
|
||||||
String Discord_Activity::get_large_image()
|
{
|
||||||
{
|
old_app_id = 0;
|
||||||
return large_image;
|
set_state("");
|
||||||
}
|
set_details("");
|
||||||
void Discord_Activity::set_large_image_text(String value)
|
set_large_image("");
|
||||||
{
|
set_large_image_text("");
|
||||||
large_image_text = value;
|
set_small_image("");
|
||||||
activity.GetAssets().SetLargeText(value.utf8().get_data());
|
set_small_image_text("");
|
||||||
}
|
set_start_timestamp(0);
|
||||||
String Discord_Activity::get_large_image_text()
|
set_end_timestamp(0);
|
||||||
{
|
set_party_id("");
|
||||||
return large_image_text;
|
set_current_party_size(0);
|
||||||
}
|
set_max_party_size(0);
|
||||||
void Discord_Activity::set_small_image(String value)
|
set_match_secret("");
|
||||||
{
|
set_join_secret("");
|
||||||
small_image = value;
|
set_spectate_secret("");
|
||||||
activity.GetAssets().SetSmallImage(value.utf8().get_data());
|
set_instanced(false);
|
||||||
}
|
set_is_public_party(false);
|
||||||
String Discord_Activity::get_small_image()
|
set_is_overlay_locked(false);
|
||||||
{
|
core->ActivityManager().ClearActivity([](discord::Result result) {});
|
||||||
return small_image;
|
}
|
||||||
}
|
else
|
||||||
void Discord_Activity::set_small_image_text(String value)
|
old_app_id = app_id;
|
||||||
{
|
delete core;
|
||||||
small_image_text = value;
|
core = nullptr;
|
||||||
activity.GetAssets().SetSmallText(value.utf8().get_data());
|
}
|
||||||
}
|
|
||||||
String Discord_Activity::get_small_image_text()
|
|
||||||
{
|
|
||||||
return small_image_text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Discord_Activity::set_start_timestamp(int64_t value)
|
void DiscordSDK::unclear()
|
||||||
{
|
{
|
||||||
start_timestamp = value;
|
if (old_app_id > 0)
|
||||||
activity.GetTimestamps().SetStart(value);
|
{
|
||||||
}
|
set_app_id(old_app_id);
|
||||||
int64_t Discord_Activity::get_start_timestamp()
|
refresh();
|
||||||
{
|
old_app_id = 0;
|
||||||
return activity.GetTimestamps().GetStart();
|
}
|
||||||
}
|
else
|
||||||
void Discord_Activity::set_end_timestamp(int64_t value)
|
UtilityFunctions::push_warning("Discord Activity couldn't be uncleared. Maybe it didn't get cleared before?");
|
||||||
{
|
|
||||||
end_timestamp = value;
|
|
||||||
activity.GetTimestamps().SetEnd(value);
|
|
||||||
}
|
|
||||||
int64_t Discord_Activity::get_end_timestamp()
|
|
||||||
{
|
|
||||||
return activity.GetTimestamps().GetEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Discord_Activity::get_is_discord_working()
|
bool DiscordSDK::get_is_overlay_enabled()
|
||||||
{
|
{
|
||||||
return result == discord::Result::Ok && app_id > 0;
|
bool ie;
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().IsEnabled(&ie);
|
||||||
|
return ie;
|
||||||
|
}
|
||||||
|
bool DiscordSDK::get_is_overlay_locked()
|
||||||
|
{
|
||||||
|
bool il;
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().IsLocked(&il);
|
||||||
|
return il;
|
||||||
|
}
|
||||||
|
void DiscordSDK::set_is_overlay_locked(bool value)
|
||||||
|
{
|
||||||
|
is_overlay_locked = value;
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().SetLocked(value, {});
|
||||||
|
}
|
||||||
|
void DiscordSDK::open_invite_overlay(bool is_spectate)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().OpenActivityInvite(static_cast<discord::ActivityActionType>(is_spectate + 1), {});
|
||||||
|
}
|
||||||
|
void DiscordSDK::open_server_invite_overlay(String invite_code)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().OpenGuildInvite(invite_code.utf8().get_data(), {});
|
||||||
|
}
|
||||||
|
void DiscordSDK::open_voice_settings()
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->OverlayManager().OpenVoiceSettings({});
|
||||||
}
|
}
|
||||||
|
|
||||||
int Discord_Activity::get_result_int()
|
void DiscordSDK::accept_join_request(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->ActivityManager().SendRequestReply(user_id, static_cast<discord::ActivityJoinRequestReply>(1), {});
|
||||||
|
}
|
||||||
|
void DiscordSDK::send_invite(int64_t user_id, bool is_spectate = false, String message_content = "")
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->ActivityManager().SendInvite(user_id, static_cast<discord::ActivityActionType>(is_spectate + 1), message_content.utf8().get_data(), {});
|
||||||
|
}
|
||||||
|
void DiscordSDK::accept_invite(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->ActivityManager().AcceptInvite(user_id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiscordSDK::register_command(String value)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->ActivityManager().RegisterCommand(value.utf8().get_data());
|
||||||
|
}
|
||||||
|
void DiscordSDK::register_steam(int32_t value)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
core->ActivityManager().RegisterSteam(value);
|
||||||
|
}
|
||||||
|
Dictionary DiscordSDK::get_current_user()
|
||||||
|
{
|
||||||
|
Dictionary userdict;
|
||||||
|
if (get_is_discord_working())
|
||||||
|
{
|
||||||
|
discord::User user{};
|
||||||
|
core->UserManager().GetCurrentUser(&user);
|
||||||
|
return user2dict(user);
|
||||||
|
}
|
||||||
|
return userdict;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary DiscordSDK::get_relationship(int64_t user_id)
|
||||||
|
{
|
||||||
|
if (get_is_discord_working())
|
||||||
|
{
|
||||||
|
discord::Relationship relationship{};
|
||||||
|
core->RelationshipManager().Get(user_id, &relationship);
|
||||||
|
return relationship2dict(relationship);
|
||||||
|
}
|
||||||
|
Dictionary dict;
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
Array DiscordSDK::get_all_relationships()
|
||||||
|
{
|
||||||
|
Array all_relationships;
|
||||||
|
core->RelationshipManager().Filter(
|
||||||
|
[](discord::Relationship const &relationship) -> bool
|
||||||
|
{ return true; });
|
||||||
|
int32_t friendcount{0};
|
||||||
|
core->RelationshipManager().Count(&friendcount);
|
||||||
|
for (int i = 0; i < friendcount; i++)
|
||||||
|
{
|
||||||
|
discord::Relationship relationship{};
|
||||||
|
core->RelationshipManager().GetAt(i, &relationship);
|
||||||
|
all_relationships.append(relationship2dict(relationship));
|
||||||
|
}
|
||||||
|
return all_relationships;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DiscordSDK::get_result_int()
|
||||||
{
|
{
|
||||||
return static_cast<int>(result);
|
return static_cast<int>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary DiscordSDK::user2dict(discord::User user)
|
||||||
|
{
|
||||||
|
Dictionary userdict;
|
||||||
|
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
|
||||||
|
userdict["is_bot"] = user.GetBot();
|
||||||
|
userdict["discriminator"] = user.GetDiscriminator();
|
||||||
|
userdict["id"] = user.GetId();
|
||||||
|
userdict["username"] = user.GetUsername();
|
||||||
|
if (String(userdict["avatar"]).is_empty())
|
||||||
|
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str());
|
||||||
|
else
|
||||||
|
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png").c_str());
|
||||||
|
userdict.make_read_only();
|
||||||
|
return userdict;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary DiscordSDK::relationship2dict(discord::Relationship relationship)
|
||||||
|
{
|
||||||
|
Dictionary dict_relationship;
|
||||||
|
Dictionary presence;
|
||||||
|
Dictionary presence_activity;
|
||||||
|
switch (static_cast<int>(relationship.GetPresence().GetStatus()))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
presence["status"] = "Offline";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
presence["status"] = "Online";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
presence["status"] = "Idle";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
presence["status"] = "DoNotDisturb";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
presence["status"] = "NotAvailable";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
presence_activity["application_id"] = relationship.GetPresence().GetActivity().GetApplicationId();
|
||||||
|
presence_activity["name"] = relationship.GetPresence().GetActivity().GetName();
|
||||||
|
presence_activity["state"] = relationship.GetPresence().GetActivity().GetState();
|
||||||
|
presence_activity["details"] = relationship.GetPresence().GetActivity().GetDetails();
|
||||||
|
presence_activity["large_image"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeImage();
|
||||||
|
presence_activity["large_text"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeText();
|
||||||
|
presence_activity["small_image"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallImage();
|
||||||
|
presence_activity["small_text"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallText();
|
||||||
|
presence_activity["timestamps_start"] = relationship.GetPresence().GetActivity().GetTimestamps().GetStart();
|
||||||
|
presence_activity["timestamps_end"] = relationship.GetPresence().GetActivity().GetTimestamps().GetEnd();
|
||||||
|
presence_activity["instance"] = relationship.GetPresence().GetActivity().GetInstance();
|
||||||
|
presence_activity["party_id"] = relationship.GetPresence().GetActivity().GetParty().GetId();
|
||||||
|
presence_activity["current_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetCurrentSize();
|
||||||
|
presence_activity["max_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetMaxSize();
|
||||||
|
presence_activity["join_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetJoin();
|
||||||
|
presence_activity["spectate_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetSpectate();
|
||||||
|
presence_activity["match_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetMatch();
|
||||||
|
presence["activity"] = presence_activity;
|
||||||
|
presence.make_read_only();
|
||||||
|
switch (relationship.GetType())
|
||||||
|
{
|
||||||
|
case discord::RelationshipType::None:
|
||||||
|
dict_relationship["type"] = "None";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Friend:
|
||||||
|
dict_relationship["type"] = "Friend";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Blocked:
|
||||||
|
dict_relationship["type"] = "Blocked";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::PendingIncoming:
|
||||||
|
dict_relationship["type"] = "PendingIncoming";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::PendingOutgoing:
|
||||||
|
dict_relationship["type"] = "PendingOutgoing";
|
||||||
|
break;
|
||||||
|
case discord::RelationshipType::Implicit:
|
||||||
|
dict_relationship["type"] = "Implicit";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dict_relationship["type"] = "NotAvailable";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dict_relationship["user"] = user2dict(relationship.GetUser());
|
||||||
|
dict_relationship["presence"] = presence;
|
||||||
|
dict_relationship.make_read_only();
|
||||||
|
return dict_relationship;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiscordSDK::get_is_discord_working()
|
||||||
|
{
|
||||||
|
return result == discord::Result::Ok && app_id > 0;
|
||||||
|
}
|
@@ -6,63 +6,72 @@
|
|||||||
#include <godot_cpp/classes/object.hpp>
|
#include <godot_cpp/classes/object.hpp>
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
#define H_SET_GET(variable_type, property_name) \
|
||||||
|
variable_type property_name; \
|
||||||
|
variable_type get_##property_name(); \
|
||||||
|
void set_##property_name(variable_type value);
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
class Discord_Activity : public Object
|
class DiscordSDK : public Object
|
||||||
{
|
{
|
||||||
GDCLASS(Discord_Activity, Object);
|
GDCLASS(DiscordSDK, Object);
|
||||||
|
|
||||||
static Discord_Activity *singleton;
|
static DiscordSDK *singleton;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t app_id;
|
|
||||||
|
|
||||||
String state;
|
|
||||||
String details;
|
|
||||||
|
|
||||||
String large_image;
|
|
||||||
String large_image_text;
|
|
||||||
String small_image;
|
|
||||||
String small_image_text;
|
|
||||||
|
|
||||||
int64_t start_timestamp;
|
|
||||||
int64_t end_timestamp;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Discord_Activity *get_singleton();
|
static DiscordSDK *
|
||||||
|
get_singleton();
|
||||||
|
|
||||||
Discord_Activity();
|
DiscordSDK();
|
||||||
~Discord_Activity();
|
~DiscordSDK();
|
||||||
|
|
||||||
|
// INTERBNAL
|
||||||
|
int64_t old_app_id;
|
||||||
|
Dictionary relationship2dict(discord::Relationship relationship);
|
||||||
|
Dictionary user2dict(discord::User user);
|
||||||
|
///
|
||||||
|
void set_app_id(int64_t value);
|
||||||
|
int64_t get_app_id();
|
||||||
|
int64_t app_id = 0; // needs to be directly setted to 0 or it will crash randomly
|
||||||
|
H_SET_GET(String, state)
|
||||||
|
H_SET_GET(String, details)
|
||||||
|
H_SET_GET(String, large_image)
|
||||||
|
H_SET_GET(String, large_image_text)
|
||||||
|
H_SET_GET(String, small_image)
|
||||||
|
H_SET_GET(String, small_image_text)
|
||||||
|
H_SET_GET(int64_t, start_timestamp)
|
||||||
|
H_SET_GET(int64_t, end_timestamp)
|
||||||
|
H_SET_GET(String, party_id)
|
||||||
|
H_SET_GET(int32_t, current_party_size)
|
||||||
|
H_SET_GET(int32_t, max_party_size)
|
||||||
|
H_SET_GET(String, match_secret)
|
||||||
|
H_SET_GET(String, join_secret)
|
||||||
|
H_SET_GET(String, spectate_secret)
|
||||||
|
H_SET_GET(bool, is_public_party)
|
||||||
|
H_SET_GET(bool, instanced)
|
||||||
|
H_SET_GET(bool, is_overlay_locked)
|
||||||
|
|
||||||
void debug();
|
void debug();
|
||||||
void coreupdate();
|
void run_callbacks();
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void clear(bool reset_values);
|
||||||
int64_t get_app_id();
|
void unclear();
|
||||||
|
bool get_is_overlay_enabled();
|
||||||
void set_app_id(int64_t value);
|
void open_invite_overlay(bool is_spectate);
|
||||||
String get_state();
|
void open_server_invite_overlay(String invite_code);
|
||||||
void set_state(String value);
|
void open_voice_settings();
|
||||||
String get_details();
|
void accept_join_request(int64_t user_id);
|
||||||
void set_details(String value);
|
void send_invite(int64_t user_id, bool is_spectate, String message_content);
|
||||||
|
void accept_invite(int64_t user_id);
|
||||||
String get_large_image();
|
void register_command(String value);
|
||||||
void set_large_image(String value);
|
void register_steam(int32_t value);
|
||||||
String get_large_image_text();
|
Dictionary get_current_user();
|
||||||
void set_large_image_text(String value);
|
Dictionary get_relationship(int64_t user_id);
|
||||||
String get_small_image();
|
Array get_all_relationships();
|
||||||
void set_small_image(String value);
|
|
||||||
String get_small_image_text();
|
|
||||||
void set_small_image_text(String value);
|
|
||||||
|
|
||||||
int64_t get_start_timestamp();
|
|
||||||
void set_start_timestamp(int64_t value);
|
|
||||||
int64_t get_end_timestamp();
|
|
||||||
void set_end_timestamp(int64_t value);
|
|
||||||
|
|
||||||
bool get_is_discord_working();
|
bool get_is_discord_working();
|
||||||
int get_result_int();
|
int get_result_int();
|
||||||
};
|
};
|
||||||
|
@@ -9,35 +9,34 @@
|
|||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
static Discord_Activity *discordsdk;
|
static DiscordSDK *discordsdk;
|
||||||
|
|
||||||
void gdextension_initialize(ModuleInitializationLevel p_level)
|
void initialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
ClassDB::register_class<Discord_Activity>();
|
ClassDB::register_class<DiscordSDK>();
|
||||||
discordsdk = memnew(Discord_Activity);
|
discordsdk = memnew(DiscordSDK);
|
||||||
Engine::get_singleton()->register_singleton("Discord_Activity", Discord_Activity::get_singleton());
|
Engine::get_singleton()->register_singleton("DiscordSDK", DiscordSDK::get_singleton());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdextension_terminate(ModuleInitializationLevel p_level)
|
void uninitialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
Engine::get_singleton()->unregister_singleton("Discord_Activity");
|
Engine::get_singleton()->unregister_singleton("DiscordSDK");
|
||||||
memdelete(discordsdk);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
GDExtensionBool GDE_EXPORT discordsdkgd_library_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization)
|
GDExtensionBool GDE_EXPORT discordsdkgd_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization)
|
||||||
{
|
{
|
||||||
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||||
|
|
||||||
init_obj.register_initializer(gdextension_initialize);
|
init_obj.register_initializer(initialize_discordsdk_module);
|
||||||
init_obj.register_terminator(gdextension_terminate);
|
init_obj.register_terminator(uninitialize_discordsdk_module);
|
||||||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||||
|
|
||||||
return init_obj.init();
|
return init_obj.init();
|
||||||
|