Normalize white-space
This commit is contained in:
parent
e4b3ef63b7
commit
b1d6a7c0fc
2 changed files with 41 additions and 38 deletions
|
@ -1,6 +1,7 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class DiscordController : MonoBehaviour {
|
public class DiscordController : MonoBehaviour
|
||||||
|
{
|
||||||
public DiscordRpc.RichPresence presence;
|
public DiscordRpc.RichPresence presence;
|
||||||
public string applicationId;
|
public string applicationId;
|
||||||
public string optionalSteamId;
|
public string optionalSteamId;
|
||||||
|
@ -51,18 +52,20 @@ public class DiscordController : MonoBehaviour {
|
||||||
{
|
{
|
||||||
++callbackCalls;
|
++callbackCalls;
|
||||||
Debug.Log(string.Format("Discord: spectate ({0})", secret));
|
Debug.Log(string.Format("Discord: spectate ({0})", secret));
|
||||||
}
|
|
||||||
|
|
||||||
public void RequestCallback(DiscordRpc.JoinRequest request)
|
|
||||||
{
|
|
||||||
++callbackCalls;
|
|
||||||
Debug.Log(string.Format("Discord: join request {0}: {1}", request.username, request.userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start () {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
public void RequestCallback(DiscordRpc.JoinRequest request)
|
||||||
|
{
|
||||||
|
++callbackCalls;
|
||||||
|
Debug.Log(string.Format("Discord: join request {0}: {1}", request.username, request.userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
DiscordRpc.RunCallbacks();
|
DiscordRpc.RunCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +80,7 @@ public class DiscordController : MonoBehaviour {
|
||||||
handlers.errorCallback += ErrorCallback;
|
handlers.errorCallback += ErrorCallback;
|
||||||
handlers.joinCallback += JoinCallback;
|
handlers.joinCallback += JoinCallback;
|
||||||
handlers.spectateCallback += SpectateCallback;
|
handlers.spectateCallback += SpectateCallback;
|
||||||
handlers.requestCallback += RequestCallback;
|
handlers.requestCallback += RequestCallback;
|
||||||
DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
|
DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,18 +17,18 @@ public class DiscordRpc
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate void SpectateCallback(string secret);
|
public delegate void SpectateCallback(string secret);
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate void RequestCallback(JoinRequest request);
|
public delegate void RequestCallback(JoinRequest request);
|
||||||
|
|
||||||
public struct EventHandlers
|
public struct EventHandlers
|
||||||
{
|
{
|
||||||
public ReadyCallback readyCallback;
|
public ReadyCallback readyCallback;
|
||||||
public DisconnectedCallback disconnectedCallback;
|
public DisconnectedCallback disconnectedCallback;
|
||||||
public ErrorCallback errorCallback;
|
public ErrorCallback errorCallback;
|
||||||
public JoinCallback joinCallback;
|
public JoinCallback joinCallback;
|
||||||
public SpectateCallback spectateCallback;
|
public SpectateCallback spectateCallback;
|
||||||
public RequestCallback requestCallback;
|
public RequestCallback requestCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public struct RichPresence
|
public struct RichPresence
|
||||||
|
@ -50,23 +50,23 @@ public class DiscordRpc
|
||||||
public bool instance;
|
public bool instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||||
public struct JoinRequest
|
public struct JoinRequest
|
||||||
{
|
{
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 24)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 24)]
|
||||||
public string userId;
|
public string userId;
|
||||||
[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 avatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Reply
|
public enum Reply
|
||||||
{
|
{
|
||||||
No = 0,
|
No = 0,
|
||||||
Yes = 1,
|
Yes = 1,
|
||||||
Ignore = 2
|
Ignore = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
|
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
|
||||||
|
@ -80,7 +80,7 @@ public class DiscordRpc
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdatePresence(ref RichPresence presence);
|
public static extern void UpdatePresence(ref RichPresence presence);
|
||||||
|
|
||||||
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void Respond(string userId, Reply reply);
|
public static extern void Respond(string userId, Reply reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue