2022-01-30 23:40:12 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace RhythmHeavenMania.DiscordRPC
|
|
|
|
{
|
|
|
|
public class DiscordRPC : MonoBehaviour
|
|
|
|
{
|
2022-02-23 03:23:56 +00:00
|
|
|
public static long clientID = 945877725984477205;
|
2022-01-30 23:40:12 +00:00
|
|
|
|
|
|
|
private static void DiscordControllerCheck()
|
|
|
|
{
|
|
|
|
if (DiscordController.instance == null)
|
|
|
|
{
|
|
|
|
var discordController = new GameObject("DiscordController");
|
|
|
|
var di = discordController.AddComponent<DiscordController>();
|
|
|
|
DiscordController.instance = di;
|
|
|
|
di.Connect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Connect()
|
|
|
|
{
|
|
|
|
DiscordControllerCheck();
|
|
|
|
DiscordController.instance.Connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void UpdateActivity(string state = null, string details = null, bool updateTime = false)
|
|
|
|
{
|
|
|
|
DiscordControllerCheck();
|
|
|
|
DiscordController.instance.UpdateActivity(details, state, updateTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Disconnect()
|
|
|
|
{
|
|
|
|
DiscordControllerCheck();
|
|
|
|
DiscordController.instance.Disconnect();
|
|
|
|
Destroy(DiscordController.instance.gameObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|