From 0f7e3ced25ee1138980f4ddfcb37e45fbc54bead Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sat, 5 Dec 2020 13:18:39 -0500 Subject: Discord RPC; Removed jumping function for now --- Assets/Scripts/DiscordController.cs | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Assets/Scripts/DiscordController.cs (limited to 'Assets/Scripts/DiscordController.cs') diff --git a/Assets/Scripts/DiscordController.cs b/Assets/Scripts/DiscordController.cs new file mode 100644 index 0000000..db0eec1 --- /dev/null +++ b/Assets/Scripts/DiscordController.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +public class DiscordController : MonoBehaviour +{ + + public Discord.Discord discord; + + // Use this for initialization + void Start () { + System.Environment.SetEnvironmentVariable("DISCORD_INSTANCE_ID", "0"); + discord = new Discord.Discord(784835227338932244, (System.UInt64)Discord.CreateFlags.Default); + var activityManager = discord.GetActivityManager(); + var activity = new Discord.Activity + { + State = "In Development...", + Details = "An upcoming Unity game by Alee!", + Assets = + { + LargeImage = "wip", + LargeText = "Work in Progress!" + } + }; + activityManager.UpdateActivity(activity, (res) => + { + if (res == Discord.Result.Ok) + { + Debug.LogWarning("Everything is fine!"); + } + }); + + activityManager.ClearActivity((result) => + { + if (result == Discord.Result.Ok) + { + Debug.Log("Success!"); + } + else + { + Debug.LogError("Failed"); + } + }); + } + + // Update is called once per frame + void Update () { + discord.RunCallbacks(); + } +} -- cgit v1.2.3