From b1d6a7c0fc8eb2e88d06fa7f434c94e1829905a3 Mon Sep 17 00:00:00 2001 From: SK83RJOSH Date: Sat, 14 Oct 2017 06:21:35 -0400 Subject: [PATCH] Normalize white-space --- .../Assets/DiscordController.cs | 33 +++++++------ examples/button-clicker/Assets/DiscordRpc.cs | 46 +++++++++---------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/examples/button-clicker/Assets/DiscordController.cs b/examples/button-clicker/Assets/DiscordController.cs index 80b1f7b..d00b51b 100644 --- a/examples/button-clicker/Assets/DiscordController.cs +++ b/examples/button-clicker/Assets/DiscordController.cs @@ -1,6 +1,7 @@ using UnityEngine; -public class DiscordController : MonoBehaviour { +public class DiscordController : MonoBehaviour +{ public DiscordRpc.RichPresence presence; public string applicationId; public string optionalSteamId; @@ -51,21 +52,23 @@ public class DiscordController : MonoBehaviour { { ++callbackCalls; 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(); } - + void OnEnable() { Debug.Log("Discord: init"); @@ -77,7 +80,7 @@ public class DiscordController : MonoBehaviour { handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; - handlers.requestCallback += RequestCallback; + handlers.requestCallback += RequestCallback; DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId); } @@ -89,6 +92,6 @@ public class DiscordController : MonoBehaviour { void OnDestroy() { - + } } diff --git a/examples/button-clicker/Assets/DiscordRpc.cs b/examples/button-clicker/Assets/DiscordRpc.cs index de34239..44cbf3f 100644 --- a/examples/button-clicker/Assets/DiscordRpc.cs +++ b/examples/button-clicker/Assets/DiscordRpc.cs @@ -17,18 +17,18 @@ public class DiscordRpc [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void SpectateCallback(string secret); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void RequestCallback(JoinRequest request); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void RequestCallback(JoinRequest request); - public struct EventHandlers + public struct EventHandlers { public ReadyCallback readyCallback; public DisconnectedCallback disconnectedCallback; public ErrorCallback errorCallback; public JoinCallback joinCallback; public SpectateCallback spectateCallback; - public RequestCallback requestCallback; - } + public RequestCallback requestCallback; + } [System.Serializable] public struct RichPresence @@ -50,23 +50,23 @@ public class DiscordRpc public bool instance; } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct JoinRequest - { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 24)] - public string userId; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] - public string username; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string avatarUrl; - } + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct JoinRequest + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 24)] + public string userId; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] + public string username; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + public string avatarUrl; + } - public enum Reply - { - No = 0, - Yes = 1, - Ignore = 2 - } + public enum Reply + { + No = 0, + Yes = 1, + Ignore = 2 + } [DllImport("discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)] 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)] public static extern void UpdatePresence(ref RichPresence presence); - [DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)] - public static extern void Respond(string userId, Reply reply); + [DllImport("discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)] + public static extern void Respond(string userId, Reply reply); }