mirror of
https://github.com/yuzu-emu/discord-rpc
synced 2024-11-26 03:17:45 +00:00
Update unity.
This commit is contained in:
parent
dafd85c39f
commit
a089aab53e
5 changed files with 32 additions and 2 deletions
|
@ -1,5 +1,14 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class DiscordJoinEvent : UnityEngine.Events.UnityEvent<string> { }
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class DiscordSpectateEvent : UnityEngine.Events.UnityEvent<string> { }
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class DiscordJoinRequestEvent : UnityEngine.Events.UnityEvent<DiscordRpc.JoinRequest> { }
|
||||||
|
|
||||||
public class DiscordController : MonoBehaviour
|
public class DiscordController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public DiscordRpc.RichPresence presence;
|
public DiscordRpc.RichPresence presence;
|
||||||
|
@ -9,6 +18,9 @@ public class DiscordController : MonoBehaviour
|
||||||
public int clickCounter;
|
public int clickCounter;
|
||||||
public UnityEngine.Events.UnityEvent onConnect;
|
public UnityEngine.Events.UnityEvent onConnect;
|
||||||
public UnityEngine.Events.UnityEvent onDisconnect;
|
public UnityEngine.Events.UnityEvent onDisconnect;
|
||||||
|
public DiscordJoinEvent onJoin;
|
||||||
|
public DiscordJoinEvent onSpectate;
|
||||||
|
public DiscordJoinRequestEvent onJoinRequest;
|
||||||
|
|
||||||
DiscordRpc.EventHandlers handlers;
|
DiscordRpc.EventHandlers handlers;
|
||||||
|
|
||||||
|
@ -46,18 +58,21 @@ public class DiscordController : MonoBehaviour
|
||||||
{
|
{
|
||||||
++callbackCalls;
|
++callbackCalls;
|
||||||
Debug.Log(string.Format("Discord: join ({0})", secret));
|
Debug.Log(string.Format("Discord: join ({0})", secret));
|
||||||
|
onJoin.Invoke(secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpectateCallback(string secret)
|
public void SpectateCallback(string secret)
|
||||||
{
|
{
|
||||||
++callbackCalls;
|
++callbackCalls;
|
||||||
Debug.Log(string.Format("Discord: spectate ({0})", secret));
|
Debug.Log(string.Format("Discord: spectate ({0})", secret));
|
||||||
|
onSpectate.Invoke(secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestCallback(DiscordRpc.JoinRequest request)
|
public void RequestCallback(DiscordRpc.JoinRequest request)
|
||||||
{
|
{
|
||||||
++callbackCalls;
|
++callbackCalls;
|
||||||
Debug.Log(string.Format("Discord: join request {0}: {1}", request.username, request.userId));
|
Debug.Log(string.Format("Discord: join request {0}: {1}", request.username, request.userId));
|
||||||
|
onJoinRequest.Invoke(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class DiscordRpc
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)]
|
||||||
public string username;
|
public string username;
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
public string avatarUrl;
|
public string avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Reply
|
public enum Reply
|
||||||
|
|
Binary file not shown.
|
@ -703,6 +703,21 @@ MonoBehaviour:
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
PublicKeyToken=null
|
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
|
--- !u!4 &1929635630
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
m_EditorVersion: 2017.1.0f3
|
m_EditorVersion: 2017.1.1f1
|
||||||
|
|
Loading…
Reference in a new issue