mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-24 01:25:43 +01:00
Unity example working better.
This commit is contained in:
parent
f06b187d2d
commit
f6853fac1b
@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DiscordController : MonoBehaviour {
|
||||
public DiscordRpc.EventHandlers handlers;
|
||||
public DiscordRpc.RichPresence presence;
|
||||
public string applicationId;
|
||||
public int callbackCalls;
|
||||
public int clickCounter;
|
||||
|
||||
DiscordRpc.EventHandlers handlers;
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
Debug.Log("Discord: on click!");
|
||||
@ -50,23 +51,23 @@ public class DiscordController : MonoBehaviour {
|
||||
}
|
||||
|
||||
void Start () {
|
||||
handlers = new DiscordRpc.EventHandlers();
|
||||
handlers.readyCallback = ReadyCallback;
|
||||
handlers.disconnectedCallback = DisconnectedCallback;
|
||||
handlers.errorCallback = ErrorCallback;
|
||||
handlers.joinCallback = JoinCallback;
|
||||
handlers.spectateCallback = SpectateCallback;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
|
||||
DiscordRpc.RunCallbacks();
|
||||
}
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
var p = System.Diagnostics.Process.GetCurrentProcess();
|
||||
Debug.Log(string.Format("Discord: init {0}", p.Id));
|
||||
Debug.Log("Discord: init");
|
||||
callbackCalls = 0;
|
||||
|
||||
handlers = new DiscordRpc.EventHandlers();
|
||||
handlers.readyCallback = ReadyCallback;
|
||||
handlers.disconnectedCallback += DisconnectedCallback;
|
||||
handlers.errorCallback += ErrorCallback;
|
||||
handlers.joinCallback += JoinCallback;
|
||||
handlers.spectateCallback += SpectateCallback;
|
||||
DiscordRpc.Initialize(applicationId, ref handlers, true);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ public class DiscordRpc
|
||||
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
|
||||
public delegate void SpectateCallback(string secret);
|
||||
|
||||
[System.Serializable]
|
||||
public struct EventHandlers
|
||||
{
|
||||
public ReadyCallback readyCallback;
|
||||
|
Binary file not shown.
@ -588,9 +588,9 @@ MonoBehaviour:
|
||||
partyId: abcdefg
|
||||
partySize: 1
|
||||
partyMax: 10
|
||||
matchSecret: asdfasdfsafd
|
||||
joinSecret: klkdkfbnbldknfvb
|
||||
spectateSecret: nwertinvnvldfkvnk
|
||||
matchSecret:
|
||||
joinSecret:
|
||||
spectateSecret:
|
||||
instance: 0
|
||||
applicationId: 338030514596216832
|
||||
callbackCalls: 0
|
||||
|
Loading…
Reference in New Issue
Block a user