diff --git a/examples/button-clicker/Assets/DiscordController.cs b/examples/button-clicker/Assets/DiscordController.cs index d00b51b..48bf503 100644 --- a/examples/button-clicker/Assets/DiscordController.cs +++ b/examples/button-clicker/Assets/DiscordController.cs @@ -1,5 +1,14 @@ using UnityEngine; +[System.Serializable] +public class DiscordJoinEvent : UnityEngine.Events.UnityEvent { } + +[System.Serializable] +public class DiscordSpectateEvent : UnityEngine.Events.UnityEvent { } + +[System.Serializable] +public class DiscordJoinRequestEvent : UnityEngine.Events.UnityEvent { } + public class DiscordController : MonoBehaviour { public DiscordRpc.RichPresence presence; @@ -9,6 +18,9 @@ public class DiscordController : MonoBehaviour public int clickCounter; public UnityEngine.Events.UnityEvent onConnect; public UnityEngine.Events.UnityEvent onDisconnect; + public DiscordJoinEvent onJoin; + public DiscordJoinEvent onSpectate; + public DiscordJoinRequestEvent onJoinRequest; DiscordRpc.EventHandlers handlers; @@ -46,18 +58,21 @@ public class DiscordController : MonoBehaviour { ++callbackCalls; Debug.Log(string.Format("Discord: join ({0})", secret)); + onJoin.Invoke(secret); } public void SpectateCallback(string secret) { ++callbackCalls; Debug.Log(string.Format("Discord: spectate ({0})", secret)); + onSpectate.Invoke(secret); } public void RequestCallback(DiscordRpc.JoinRequest request) { ++callbackCalls; Debug.Log(string.Format("Discord: join request {0}: {1}", request.username, request.userId)); + onJoinRequest.Invoke(request); } void Start() diff --git a/examples/button-clicker/Assets/DiscordRpc.cs b/examples/button-clicker/Assets/DiscordRpc.cs index 44cbf3f..206504e 100644 --- a/examples/button-clicker/Assets/DiscordRpc.cs +++ b/examples/button-clicker/Assets/DiscordRpc.cs @@ -58,7 +58,7 @@ public class DiscordRpc [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] public string username; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string avatarUrl; + public string avatar; } public enum Reply diff --git a/examples/button-clicker/Assets/Resources/discord-rpc.dll b/examples/button-clicker/Assets/Resources/discord-rpc.dll index 283b98a..5daec3d 100644 Binary files a/examples/button-clicker/Assets/Resources/discord-rpc.dll and b/examples/button-clicker/Assets/Resources/discord-rpc.dll differ diff --git a/examples/button-clicker/Assets/main.unity b/examples/button-clicker/Assets/main.unity index b044ae3..ab1666d 100644 --- a/examples/button-clicker/Assets/main.unity +++ b/examples/button-clicker/Assets/main.unity @@ -703,6 +703,21 @@ MonoBehaviour: m_CallState: 2 m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + onJoin: + m_PersistentCalls: + m_Calls: [] + m_TypeName: DiscordJoinEvent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + onSpectate: + m_PersistentCalls: + m_Calls: [] + m_TypeName: DiscordJoinEvent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + onJoinRequest: + m_PersistentCalls: + m_Calls: [] + m_TypeName: DiscordJoinRequestEvent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null --- !u!4 &1929635630 Transform: m_ObjectHideFlags: 0 diff --git a/examples/button-clicker/ProjectSettings/ProjectVersion.txt b/examples/button-clicker/ProjectSettings/ProjectVersion.txt index ca1aa05..a211ccd 100644 --- a/examples/button-clicker/ProjectSettings/ProjectVersion.txt +++ b/examples/button-clicker/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.0f3 +m_EditorVersion: 2017.1.1f1