diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2021-05-26 21:43:55 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2021-05-26 21:43:55 -0400 |
| commit | 4d0cfd3641c3a5cb7c4bccfbad0476e366324524 (patch) | |
| tree | db712419558d80a5cc5d0e4dfb386ee7f51fa4a5 /Assets/Scripts | |
| parent | 914e6702935f5b76cbb078117de575dc26e5ef1f (diff) | |
| download | prototype-a-4d0cfd3641c3a5cb7c4bccfbad0476e366324524.tar.gz prototype-a-4d0cfd3641c3a5cb7c4bccfbad0476e366324524.tar.bz2 prototype-a-4d0cfd3641c3a5cb7c4bccfbad0476e366324524.zip | |
Demo house, Discord RPC, Graphy, new models
Diffstat (limited to 'Assets/Scripts')
| -rw-r--r-- | Assets/Scripts/DiscordController.cs | 52 | ||||
| -rw-r--r-- | Assets/Scripts/DiscordController.cs.meta | 11 |
2 files changed, 63 insertions, 0 deletions
diff --git a/Assets/Scripts/DiscordController.cs b/Assets/Scripts/DiscordController.cs new file mode 100644 index 0000000..4812df3 --- /dev/null +++ b/Assets/Scripts/DiscordController.cs @@ -0,0 +1,52 @@ +using UnityEngine;
+
+public class DiscordController : MonoBehaviour
+{
+
+ public Discord.Discord Discord;
+ public long applicationID;
+ public string rpcStatus;
+ public string rpcDetails;
+ public string rpcLargeImage;
+ public string rpcLargeImageText;
+
+ // Use this for initialization
+ void Start () {
+ Discord = new Discord.Discord(applicationID, (System.UInt64)global::Discord.CreateFlags.NoRequireDiscord);
+ var activityManager = Discord.GetActivityManager();
+ var activity = new Discord.Activity
+ {
+ State = rpcStatus,
+ Details = rpcDetails,
+ Assets =
+ {
+ LargeImage = rpcLargeImage,
+ LargeText = rpcLargeImageText
+ }
+ };
+ activityManager.UpdateActivity(activity, (res) =>
+ {
+ if (res == global::Discord.Result.Ok)
+ {
+ Debug.LogWarning("Everything is fine!");
+ }
+ });
+
+ activityManager.ClearActivity((result) =>
+ {
+ if (result == global::Discord.Result.Ok)
+ {
+ Debug.Log("Success!");
+ }
+ else
+ {
+ Debug.LogError("Failed");
+ }
+ });
+ }
+
+ // Update is called once per frame
+ void Update () {
+ Discord.RunCallbacks();
+ }
+}
diff --git a/Assets/Scripts/DiscordController.cs.meta b/Assets/Scripts/DiscordController.cs.meta new file mode 100644 index 0000000..18a2830 --- /dev/null +++ b/Assets/Scripts/DiscordController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88183e77c2589e58e8752a5fe5452fb8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |
