using System; namespace BestHTTP.Examples { // Token: 0x0200022D RID: 557 public static class DGAOEIOPBPK { // Token: 0x04000E17 RID: 3607 public static string DGLMGBDNEKB = "
using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP;\r\n\r\npublic sealed class TextureDownloadSample : MonoBehaviour\r\n{\r\n /// <summary>\r\n /// The URL of the server that will serve the image resources\r\n /// </summary>\r\n const string BaseURL = "http://besthttp.azurewebsites.net/Content/";\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// The downloadable images\r\n /// </summary>\r\n string[] Images = new string[9] { "One.png", "Two.png", "Three.png", "Four.png", "Five.png", "Six.png", "Seven.png", "Eight.png", "Nine.png" };\r\n\r\n /// <summary>\r\n /// The downloaded images will be stored as textures in this array\r\n /// </summary>\r\n Texture2D[] Textures = new Texture2D[9];\r\n\r\n /// <summary>\r\n /// True if all images are loaded from the local cache instead of the server\r\n /// </summary>\r\n bool allDownloadedFromLocalCache;\r\n\r\n /// <summary>\r\n /// How many sent requests are finished\r\n /// </summary>\r\n int finishedCount;\r\n\r\n /// <summary>\r\n /// GUI scroll position\r\n /// </summary>\r\n Vector2 scrollPos;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void Awake()\r\n {\r\n // Set a well observable value\r\n // This is how many concurrent requests can be made to a server\r\n HTTPManager.MaxConnectionPerServer = 1;\r\n\r\n // Create placeholder textures\r\n for (int i = 0; i < Images.Length; ++i)\r\n Textures[i] = new Texture2D(100, 150);\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Set back to its defualt value.\r\n HTTPManager.MaxConnectionPerServer = 4;\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n scrollPos = GUILayout.BeginScrollView(scrollPos);\r\n\r\n // Draw out the textures\r\n GUILayout.SelectionGrid(0, Textures, 3);\r\n\r\n if (finishedCount == Images.Length && allDownloadedFromLocalCache)\r\n GUIHelper.DrawCenteredText("All images loaded from the local cache!");\r\n\r\n GUILayout.FlexibleSpace();\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Label("Max Connection/Server: ", GUILayout.Width(150));\r\n GUILayout.Label(HTTPManager.MaxConnectionPerServer.ToString(), GUILayout.Width(20));\r\n HTTPManager.MaxConnectionPerServer = (byte)GUILayout.HorizontalSlider(HTTPManager.MaxConnectionPerServer, 1, 10);\r\n GUILayout.EndHorizontal();\r\n\r\n if (GUILayout.Button("Start Download"))\r\n DownloadImages();\r\n\r\n GUILayout.EndScrollView();\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n #region Private Helper Functions\r\n\r\n void DownloadImages()\r\n {\r\n // Set these metadatas to its initial values\r\n allDownloadedFromLocalCache = true;\r\n finishedCount = 0;\r\n\r\n for (int i = 0; i < Images.Length; ++i)\r\n {\r\n // Set a blank placeholder texture, overriding previously downloaded texture\r\n Textures[i] = new Texture2D(100, 150);\r\n\r\n // Construct the request\r\n var request = new HTTPRequest(new Uri(BaseURL + Images[i]), ImageDownloaded);\r\n\r\n // Set the Tag property, we can use it as a general storage bound to the request\r\n request.Tag = Textures[i];\r\n\r\n // Send out the request\r\n request.Send();\r\n }\r\n }\r\n\r\n /// <summary>\r\n /// Callback function of the image download http requests\r\n /// </summary>\r\n void ImageDownloaded(HTTPRequest req, HTTPResponse resp)\r\n {\r\n // Increase the finished count regardless of the state of our request\r\n finishedCount++;\r\n\r\n switch (req.State)\r\n {\r\n // The request finished without any problem.\r\n case HTTPRequestStates.Finished:\r\n if (resp.IsSuccess)\r\n {\r\n // Get the Texture from the Tag property\r\n Texture2D tex = req.Tag as Texture2D;\r\n\r\n // Load the texture\r\n tex.LoadImage(resp.Data);\r\n\r\n // Update the cache-info variable\r\n allDownloadedFromLocalCache = allDownloadedFromLocalCache && resp.IsFromCache;\r\n }\r\n else\r\n {\r\n Debug.LogWarning(string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",\r\n resp.StatusCode,\r\n resp.Message,\r\n resp.DataAsText));\r\n }\r\n break;\r\n\r\n // The request finished with an unexpected error. The request's Exception property may contain more info about the error.\r\n case HTTPRequestStates.Error:\r\n Debug.LogError("Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\\n" + req.Exception.StackTrace) : "No Exception"));\r\n break;\r\n\r\n // The request aborted, initiated by the user.\r\n case HTTPRequestStates.Aborted:\r\n using System;\r\nusing UnityEngine;\r\nusing BestHTTP;\r\nusing BestHTTP.WebSocket;\r\n\r\npublic class WebSocketSample : MonoBehaviour\r\n{\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// The WebSocket address to connect\r\n /// </summary>\r\n string address = "ws://echo.websocket.org";\r\n\r\n /// <summary>\r\n /// Default text to send\r\n /// </summary>\r\n string msgToSend = "Hello World!";\r\n\r\n /// <summary>\r\n /// Debug text to draw on the gui\r\n /// </summary>\r\n string Text = string.Empty;\r\n\r\n /// <summary>\r\n /// Saved WebSocket instance\r\n /// </summary>\r\n WebSocket webSocket;\r\n\r\n /// <summary>\r\n /// GUI scroll position\r\n /// </summary>\r\n Vector2 scrollPos;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void OnDestroy()\r\n {\r\n if (webSocket != null)\r\n webSocket.Close();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n scrollPos = GUILayout.BeginScrollView(scrollPos);\r\n GUILayout.Label(Text);\r\n GUILayout.EndScrollView();\r\n\r\n GUILayout.Space(5);\r\n\r\n GUILayout.FlexibleSpace();\r\n\r\n address = GUILayout.TextField(address);\r\n\r\n if (webSocket == null && GUILayout.Button("Open Web Socket"))\r\n {\r\n // Create the WebSocket instance\r\n webSocket = new WebSocket(new Uri(address));\r\n\r\n if (HTTPManager.Proxy != null)\r\n webSocket.InternalRequest.Proxy = new HTTPProxy(HTTPManager.Proxy.Address, HTTPManager.Proxy.Credentials, false);\r\n\r\n // Subscribe to the WS events\r\n webSocket.OnOpen += OnOpen;\r\n webSocket.OnMessage += OnMessageReceived;\r\n webSocket.OnClosed += OnClosed;\r\n webSocket.OnError += OnError;\r\n\r\n // Start connecting to the server\r\n webSocket.Open();\r\n\r\n Text += "Opening Web Socket...\\n";\r\n }\r\n\r\n if (webSocket != null && webSocket.IsOpen)\r\n {\r\n GUILayout.Space(10);\r\n\r\n GUILayout.BeginHorizontal();\r\n msgToSend = GUILayout.TextField(msgToSend);\r\n\r\n if (GUILayout.Button("Send", GUILayout.MaxWidth(70)))\r\n {\r\n Text += "Sending message...\\n";\r\n\r\n // Send message to the server\r\n webSocket.Send(msgToSend);\r\n }\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.Space(10);\r\n\r\n if (GUILayout.Button("Close"))\r\n {\r\n // Close the connection\r\n webSocket.Close(1000, "Bye!");\r\n }\r\n }\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n #region WebSocket Event Handlers\r\n\r\n /// <summary>\r\n /// Called when the web socket is open, and we are ready to send and receive data\r\n /// </summary>\r\n void OnOpen(WebSocket ws)\r\n {\r\n Text += string.Format("-WebSocket Open!\\n");\r\n }\r\n\r\n /// <summary>\r\n /// Called when we received a text message from the server\r\n /// </summary>\r\n void OnMessageReceived(WebSocket ws, string message)\r\n {\r\n Text += string.Format("-Message received: {0}\\n", message);\r\n }\r\n\r\n /// <summary>\r\n /// Called when the web socket closed\r\n /// </summary>\r\n void OnClosed(WebSocket ws, UInt16 code, string message)\r\n {\r\n Text += string.Format("-WebSocket closed! Code: {0} Message: {1}\\n", code, message);\r\n webSocket = null;\r\n }\r\n\r\n /// <summary>\r\n /// Called when an error occured on client side\r\n /// </summary>\r\n void OnError(WebSocket ws, Exception ex)\r\n {\r\n string errorMsg = string.Empty;\r\n if (ws.InternalRequest.Response != null)\r\n errorMsg = string.Format("Status Code from Server: {0} and Message: {1}", ws.InternalRequest.Response.StatusCode, ws.InternalRequest.Response.Message);\r\n\r\n Text += string.Format("-An error occured: {0}\\n", (ex != null ? ex.Message : "Unknown Error " + errorMsg));\r\n\r\n webSocket = null;\r\n }\r\n\r\n #endregion\r\n}"; // Token: 0x04000E19 RID: 3609 public static string ADDHAKPGEGE = "
using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP;\r\n\r\npublic sealed class AssetBundleSample : MonoBehaviour\r\n{\r\n /// <summary>\r\n /// The url of the resource to download\r\n /// </summary>\r\n const string URL = "http://besthttp.azurewebsites.net/Content/AssetBundle.html";\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// Debug status text\r\n /// </summary>\r\n string status = "Waiting for user interaction";\r\n\r\n /// <summary>\r\n /// The downloaded and cached AssetBundle\r\n /// </summary>\r\n AssetBundle cachedBundle;\r\n\r\n /// <summary>\r\n /// The loaded texture from the AssetBundle\r\n /// </summary>\r\n Texture2D texture;\r\n\r\n /// <summary>\r\n /// A flag that indicates that we are processing the request/bundle to hide the "Start Download" button.\r\n /// </summary>\r\n bool downloading;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.Label("Status: " + status);\r\n\r\n // Draw the texture from the downloaded bundle\r\n if (texture != null)\r\n GUILayout.Box(texture, GUILayout.MaxHeight(256));\r\n\r\n if (!downloading && GUILayout.Button("Start Download"))\r\n {\r\n UnloadBundle();\r\n\r\n StartCoroutine(DownloadAssetBundle());\r\n }\r\n });\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n UnloadBundle();\r\n }\r\n\r\n #endregion\r\n\r\n #region Private Helper Functions\r\n\r\n IEnumerator DownloadAssetBundle()\r\n {\r\n downloading = true;\r\n\r\n // Create and send our request\r\n var request = new HTTPRequest(new Uri(URL)).Send();\r\n\r\n status = "Download started";\r\n\r\n // Wait while it's finishes and add some fancy dots to display something while the user waits for it.\r\n // A simple "yield return StartCoroutine(request);" would do the job too.\r\n while(request.State < HTTPRequestStates.Finished)\r\n {\r\n yield return new WaitForSeconds(0.1f);\r\n\r\n status += ".";\r\n }\r\n\r\n // Check the outcome of our request.\r\n switch (request.State)\r\n {\r\n // The request finished without any problem.\r\n case HTTPRequestStates.Finished:\r\n\r\n if (request.Response.IsSuccess)\r\n {\r\n status = string.Format("AssetBundle downloaded! Loaded from local cache: {0}", request.Response.IsFromCache.ToString());\r\n\r\n // Start creating the downloaded asset bundle\r\n AssetBundleCreateRequest async = AssetBundle.CreateFromMemory(request.Response.Data);\r\n\r\n // wait for it\r\n yield return async;\r\n\r\n // And process the bundle\r\n yield return StartCoroutine(ProcessAssetBundle(async.assetBundle));\r\n }\r\n else\r\n {\r\n status = string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",\r\n request.Response.StatusCode,\r\n request.Response.Message,\r\n request.Response.DataAsText);\r\n Debug.LogWarning(status);\r\n }\r\n\r\n break;\r\n\r\n // The request finished with an unexpected error. The request's Exception property may contain more info about the error.\r\n case HTTPRequestStates.Error:\r\n status = "Request Finished with Error! " + (request.Exception != null ? (request.Exception.Message + "\\n" + request.Exception.StackTrace) : "No Exception");\r\n Debug.LogError(status);\r\n break;\r\n\r\n // The request aborted, initiated by the user.\r\n case HTTPRequestStates.Aborted:\r\n status = "Request Aborted!";\r\n Debug.LogWarning(status);\r\n break;\r\n\r\n // Ceonnecting to the server is timed out.\r\n case HTTPRequestStates.ConnectionTimedOut:\r\n status = "Connection Timed Out!";\r\n Debug.LogError(status);\r\n break;\r\n\r\n // The request didn't finished in the given time.\r\n case HTTPRequestStates.TimedOut:\r\n status = "Processing the request Timed Out!";\r\n Debug.LogError(status);\r\n break;\r\n }\r\n\r\n downloading = false;\r\n }\r\n\r\n /// <summary>\r\n /// In this function we can do whatever we want with the freshly downloaded bundle.\r\n /// In this example we will cache it for later use, and we will load a texture from it.\r\n /// </summary>\r\n IEnumerator ProcessAssetBundle(AssetBundle bundle)\r\n {\r\n if (bundle == null)\r\n yield break;\r\n\r\n // Save the bundle for future use\r\n cachedBundle = bundle;\r\n\r\n // Start loading the asset from the bundle\r\n var asyncAsset = cachedBundle.LoadAsync("9443182_orig", typeof(Texture2D));\r\n\r\n // wait til load\r\n yield return asyncAsset;\r\n\r\n // get the texture\r\n &nb[...string is too long...]"; // Token: 0x04000E1A RID: 3610 public static string DKNFJADGPLL = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP;\r\n\r\npublic sealed class LargeFileDownloadSample : MonoBehaviour\r\n{\r\n /// <summary>\r\n /// The url of the resource to download\r\n /// </summary>\r\n const string URL = "http://ipv4.download.thinkbroadband.com/100MB.zip";\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// Cached request to be able to abort it\r\n /// </summary>\r\n HTTPRequest request;\r\n\r\n /// <summary>\r\n /// Debug status of the request\r\n /// </summary>\r\n string status = string.Empty;\r\n\r\n /// <summary>\r\n /// Download(processing) progress. Its range is between [0..1]\r\n /// </summary>\r\n float progress;\r\n\r\n /// <summary>\r\n /// The fragment size that we will set to the request\r\n /// </summary>\r\n int fragmentSize = HTTPResponse.MinBufferSize;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void Awake()\r\n {\r\n // If we have a non-finished download, set the progress to the value where we left it\r\n if (PlayerPrefs.HasKey("DownloadLength"))\r\n progress = PlayerPrefs.GetInt("DownloadProgress") / (float)PlayerPrefs.GetInt("DownloadLength");\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Stop the download if we are leaving this example\r\n if (request != null && request.State < HTTPRequestStates.Finished)\r\n {\r\n request.OnProgress = null;\r\n request.Callback = null;\r\n request.Abort();\r\n }\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n // Draw the current status\r\n GUILayout.Label("Request status: " + status);\r\n\r\n GUILayout.Space(5);\r\n\r\n // Draw the current progress\r\n GUILayout.Label(string.Format("Progress: {0:P2} of {1:N0}Mb", progress, PlayerPrefs.GetInt("DownloadLength") / 1048576 /*1 Mb*/));\r\n GUILayout.HorizontalSlider(progress, 0, 1);\r\n\r\n GUILayout.Space(50);\r\n\r\n if (request == null)\r\n {\r\n // Draw a slider to be able to change the fragment size\r\n GUILayout.Label(string.Format("Desired Fragment Size: {0:N} KBytes", fragmentSize / 1024f));\r\n fragmentSize = (int)GUILayout.HorizontalSlider(fragmentSize, HTTPResponse.MinBufferSize, 10 * 1024 * 1024);\r\n\r\n GUILayout.Space(5);\r\n\r\n string buttonStr = PlayerPrefs.HasKey("DownloadProgress") ? "Continue Download" : "Start Download";\r\n if (GUILayout.Button(buttonStr))\r\n StreamLargeFileTest();\r\n }\r\n else if (request.State == HTTPRequestStates.Processing && GUILayout.Button("Abort Download"))\r\n {\r\n // Simulate a connection lost\r\n request.Abort();\r\n }\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n #region Private Helper Functions\r\n\r\n // Calling this function again when the "DownloadProgress" key in the PlayerPrefs present will \r\n //\tcontinue the download\r\n void StreamLargeFileTest()\r\n {\r\n request = new HTTPRequest(new Uri(URL), (req, resp) =>\r\n {\r\n switch (req.State)\r\n {\r\n // The request is currently processed. With UseStreaming == true, we can get the streamed fragments here\r\n case HTTPRequestStates.Processing:\r\n\r\n // Set the DownloadLength, so we can display the progress\r\n if (!PlayerPrefs.HasKey("DownloadLength"))\r\n {\r\n string value = resp.GetFirstHeaderValue("content-length");\r\n if (!string.IsNullOrEmpty(value))\r\n PlayerPrefs.SetInt("DownloadLength", int.Parse(value));\r\n }\r\n\r\n // Get the fragments, and save them\r\n ProcessFragments(resp.GetStreamedFragments());\r\n\r\n status = "Processing";\r\n break;\r\n\r\n // The request finished without any problem.\r\n case HTTPRequestStates.Finished:\r\n if (resp.IsSuccess)\r\n {\r\n // Save any remaining fragments\r\n ProcessFragments(resp.GetStreamedFragments());\r\n\r\n // Completly finished\r\n if (resp.IsStreamingFinished)\r\n {\r\n status = "Streaming finished!";\r\n\r\n // We are done, delete the progress key\r\n PlayerPrefs.DeleteKey("DownloadProgress");\r\n PlayerPrefs.Save();\r\n\r\n request = null;\r\n }\r\n else\r\n status = "Processing";\r\n }\r\n else\r\n {\r\n status = string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",\r[...string is too long...]"; // Token: 0x04000E1B RID: 3611 public static string HAGONKOIKJB = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP;\r\nusing BestHTTP.SocketIO;\r\nusing BestHTTP.JSON;\r\nusing BestHTTP.SocketIO.Events;\r\n\r\npublic sealed class SocketIOChatSample : MonoBehaviour\r\n{\r\n private readonly TimeSpan TYPING_TIMER_LENGTH = TimeSpan.FromMilliseconds(700);\r\n\r\n private enum ChatStates\r\n {\r\n Login,\r\n Chat\r\n }\r\n\r\n #region Fields\r\n\r\n /// <summary>\r\n /// The Socket.IO manager instance.\r\n /// </summary>\r\n private SocketManager Manager;\r\n\r\n /// <summary>\r\n /// Current state of the chat demo.\r\n /// </summary>\r\n private ChatStates State;\r\n\r\n /// <summary>\r\n /// The selected nickname\r\n /// </summary>\r\n private string userName = string.Empty;\r\n\r\n /// <summary>\r\n /// Currently typing message\r\n /// </summary>\r\n private string message = string.Empty;\r\n\r\n /// <summary>\r\n /// Sent and received messages.\r\n /// </summary>\r\n private string chatLog = string.Empty;\r\n\r\n /// <summary>\r\n /// Position of the scroller\r\n /// </summary>\r\n private Vector2 scrollPos;\r\n\r\n /// <summary>\r\n /// True if the user is currently typing\r\n /// </summary>\r\n private bool typing;\r\n\r\n /// <summary>\r\n /// When the message changed.\r\n /// </summary>\r\n private DateTime lastTypingTime = DateTime.MinValue;\r\n\r\n /// <summary>\r\n /// Users that typing.\r\n /// </summary>\r\n private List<string> typingUsers = new List<string>();\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n \r\n void Start()\r\n {\r\n // The current state is Login\r\n State = ChatStates.Login;\r\n\r\n // Change an option to show how it should be done\r\n SocketOptions options = new SocketOptions();\r\n options.AutoConnect = false;\r\n \r\n // Create the Socket.IO manager\r\n Manager = new SocketManager(new Uri("http://chat.socket.io/socket.io/"), options);\r\n\r\n // Set up custom chat events\r\n Manager.Socket.On("login", OnLogin);\r\n Manager.Socket.On("new message", OnNewMessage);\r\n Manager.Socket.On("user joined", OnUserJoined);\r\n Manager.Socket.On("user left", OnUserLeft);\r\n Manager.Socket.On("typing", OnTyping);\r\n Manager.Socket.On("stop typing", OnStopTyping);\r\n\r\n // The argument will be an Error object.\r\n Manager.Socket.On(SocketIOEventTypes.Error, (socket, packet, args) => Debug.LogError(string.Format("Error: {0}", args[0].ToString())));\r\n\r\n // We set SocketOptions' AutoConnect to false, so we have to call it manually.\r\n Manager.Open();\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Leaving this sample, close the socket\r\n Manager.Close();\r\n }\r\n\r\n void Update()\r\n {\r\n // Go back to the demo selector\r\n if (Input.GetKeyDown(KeyCode.Escape))\r\n SampleSelector.SelectedSample.DestroyUnityObject();\r\n\r\n // Stop typing if some time passed without typing\r\n if (typing)\r\n {\r\n var typingTimer = DateTime.UtcNow;\r\n var timeDiff = typingTimer - lastTypingTime;\r\n if (timeDiff >= TYPING_TIMER_LENGTH)\r\n {\r\n Manager.Socket.Emit("stop typing");\r\n typing = false;\r\n }\r\n }\r\n }\r\n\r\n void OnGUI()\r\n {\r\n switch(State)\r\n {\r\n case ChatStates.Login: DrawLoginScreen(); break;\r\n case ChatStates.Chat: DrawChatScreen(); break;\r\n }\r\n }\r\n\r\n #endregion\r\n\r\n #region Chat Logic\r\n\r\n /// <summary>\r\n /// Called from an OnGUI event to draw the Login Screen.\r\n /// </summary>\r\n void DrawLoginScreen()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginVertical();\r\n GUILayout.FlexibleSpace();\r\n\r\n GUIHelper.DrawCenteredText("What's your nickname?");\r\n userName = GUILayout.TextField(userName);\r\n\r\n if (GUILayout.Button("Join"))\r\n SetUserName();\r\n\r\n GUILayout.FlexibleSpace();\r\n GUILayout.EndVertical();\r\n });\r\n }\r\n\r\n /// <summary>\r\n /// Called from an OnGUI event to draw the Chat Screen.\r\n /// </summary>\r\n void DrawChatScreen()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginVertical();\r\n scrollPos = GUILayout.BeginScrollView(scrollPos);\r\n GUILayout.Label(chatLog, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));\r\n GUILayout.EndScrollView();\r\n\r\n string typing = string.Empty;\r\n\r\n if (typingUsers.Count > 0)\r\n {\r\n typing += string.Format("{0}", typingUsers[0]);\r\n\r\n for (int i = 1; i < typingUsers.Count; ++i)\r\n typing += string.Format(", {0}", typingUsers[i]);\r\n\r\n &nbs[...string is too long...]"; // Token: 0x04000E1C RID: 3612 public static string AHJNOOLNJOF = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP.SocketIO;\r\nusing BestHTTP.SocketIO.Events;\r\n\r\npublic sealed class SocketIOWePlaySample : MonoBehaviour\r\n{\r\n /// <summary>\r\n /// Possible states of the game.\r\n /// </summary>\r\n enum States\r\n {\r\n Connecting,\r\n WaitForNick,\r\n Joined\r\n }\r\n\r\n /// <summary>\r\n /// Controls that the server understands as a parameter in the move event.\r\n /// </summary>\r\n private string[] controls = new string[] { "left", "right", "a", "b", "up", "down", "select", "start" };\r\n\r\n /// <summary>\r\n /// Ratio of the drawn GUI texture from the screen\r\n /// </summary>\r\n private const float ratio = 1.5f;\r\n\r\n /// <summary>\r\n /// How many messages to keep.\r\n /// </summary>\r\n private int MaxMessages = 50;\r\n \r\n /// <summary>\r\n /// Current state of the game.\r\n /// </summary>\r\n private States State;\r\n\r\n /// <summary>\r\n /// The root("/") Socket instance.\r\n /// </summary>\r\n private Socket Socket;\r\n\r\n /// <summary>\r\n /// The user-selected nickname.\r\n /// </summary>\r\n private string Nick = string.Empty;\r\n\r\n /// <summary>\r\n /// The message that the user want to send to the chat.\r\n /// </summary>\r\n private string messageToSend = string.Empty;\r\n\r\n /// <summary>\r\n /// How many user connected to the server.\r\n /// </summary>\r\n private int connections;\r\n\r\n /// <summary>\r\n /// Local and server sent messages.\r\n /// </summary>\r\n private List<string> messages = new List<string>();\r\n \r\n /// <summary>\r\n /// The chat scroll position.\r\n /// </summary>\r\n private Vector2 scrollPos;\r\n\r\n /// <summary>\r\n /// The decoded texture from the server sent binary data\r\n /// </summary>\r\n private Texture2D FrameTexture;\r\n\r\n #region Unity Events\r\n\r\n void Start()\r\n {\r\n // Change an option to show how it should be done\r\n SocketOptions options = new SocketOptions();\r\n options.AutoConnect = false;\r\n\r\n // Create the SocketManager instance\r\n var manager = new SocketManager(new Uri("http://io.weplay.io/socket.io/"), options);\r\n\r\n // Keep a reference to the root namespace\r\n Socket = manager.Socket;\r\n\r\n // Set up our event handlers.\r\n Socket.On(SocketIOEventTypes.Connect, OnConnected);\r\n Socket.On("joined", OnJoined);\r\n Socket.On("connections", OnConnections);\r\n Socket.On("join", OnJoin);\r\n Socket.On("move", OnMove);\r\n Socket.On("message", OnMessage);\r\n Socket.On("reload", OnReload);\r\n\r\n // Don't waste cpu cycles on decoding the payload, we are expecting only binary data with this event,\r\n // and we can access it through the packet's Attachments property.\r\n Socket.On("frame", OnFrame, /*autoDecodePayload:*/ false);\r\n\r\n // Add error handler, so we can display it\r\n Socket.On(SocketIOEventTypes.Error, OnError);\r\n\r\n // We set SocketOptions' AutoConnect to false, so we have to call it manually.\r\n manager.Open();\r\n\r\n // We are connecting to the server.\r\n State = States.Connecting;\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Leaving this sample, close the socket\r\n Socket.Manager.Close();\r\n }\r\n\r\n void Update()\r\n {\r\n // Go back to the demo selector\r\n if (Input.GetKeyDown(KeyCode.Escape))\r\n SampleSelector.SelectedSample.DestroyUnityObject();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n switch(State)\r\n {\r\n case States.Connecting:\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginVertical();\r\n GUILayout.FlexibleSpace();\r\n GUIHelper.DrawCenteredText("Connecting to the server...");\r\n GUILayout.FlexibleSpace();\r\n GUILayout.EndVertical();\r\n });\r\n break;\r\n \r\n case States.WaitForNick:\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n DrawLoginScreen();\r\n });\r\n break;\r\n\r\n case States.Joined:\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n // Draw Texture\r\n if (FrameTexture != null)\r\n GUILayout.Box(FrameTexture);\r\n\r\n DrawControls();\r\n DrawChat();\r\n });\r\n break;\r\n }\r\n }\r\n\r\n #endregion\r\n\r\n #region Helper Functions\r\n\r\n /// <summary>\r\n /// Called from an OnGUI event&nb[...string is too long...]"; // Token: 0x04000E1D RID: 3613 public static string IILMNAIIPKP = "using System;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP.SignalR;\r\n\r\nsealed class SimpleStreamingSample : MonoBehaviour\r\n{\r\n readonly Uri URI = new Uri("http://besthttpsignalr.azurewebsites.net/streaming-connection");\r\n\r\n /// <summary>\r\n /// Reference to the SignalR Connection\r\n /// </summary>\r\n Connection signalRConnection;\r\n\r\n /// <summary>\r\n /// Helper GUI class to handle and display a string-list\r\n /// </summary>\r\n GUIMessageList messages = new GUIMessageList();\r\n\r\n #region Unity Events\r\n\r\n void Start()\r\n {\r\n // Create the SignalR connection\r\n signalRConnection = new Connection(URI);\r\n\r\n // set event handlers\r\n signalRConnection.OnNonHubMessage += signalRConnection_OnNonHubMessage;\r\n signalRConnection.OnStateChanged += signalRConnection_OnStateChanged;\r\n signalRConnection.OnError += signalRConnection_OnError;\r\n\r\n // Start connecting to the server\r\n signalRConnection.Open();\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Close the connection when the sample is closed\r\n signalRConnection.Close();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.Label("Messages");\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Space(20);\r\n messages.Draw(Screen.width - 20, 0);\r\n GUILayout.EndHorizontal();\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n #region SignalR Events\r\n\r\n /// <summary>\r\n /// Handle Server-sent messages\r\n /// </summary>\r\n void signalRConnection_OnNonHubMessage(Connection connection, object data)\r\n {\r\n messages.Add("[Server Message] " + data.ToString());\r\n }\r\n\r\n /// <summary>\r\n /// Display state changes\r\n /// </summary>\r\n void signalRConnection_OnStateChanged(Connection connection, ConnectionStates oldState, ConnectionStates newState)\r\n {\r\n messages.Add(string.Format("[State Change] {0} => {1}", oldState, newState));\r\n }\r\n\r\n /// <summary>\r\n /// Display errors.\r\n /// </summary>\r\n void signalRConnection_OnError(Connection connection, string error)\r\n {\r\n messages.Add("[Error] " + error);\r\n }\r\n\r\n #endregion\r\n}"; // Token: 0x04000E1E RID: 3614 public static string IPKEONAHFEK = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP.SignalR;\r\nusing BestHTTP.Cookies;\r\n\r\npublic sealed class ConnectionAPISample : MonoBehaviour\r\n{\r\n readonly Uri URI = new Uri("http://besthttpsignalr.azurewebsites.net/raw-connection/");\r\n\r\n /// <summary>\r\n /// Possible message types that the client can send to the server\r\n /// </summary>\r\n enum MessageTypes\r\n {\r\n Send, // 0\r\n Broadcast, // 1\r\n Join, // 2\r\n PrivateMessage, // 3\r\n AddToGroup, // 4\r\n RemoveFromGroup, // 5\r\n SendToGroup, // 6\r\n BroadcastExceptMe, // 7\r\n }\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// Reference to the SignalR Connection\r\n /// </summary>\r\n Connection signalRConnection;\r\n\r\n // Input strings\r\n string ToEveryBodyText = string.Empty;\r\n string ToMeText = string.Empty;\r\n string PrivateMessageText = string.Empty;\r\n string PrivateMessageUserOrGroupName = string.Empty;\r\n\r\n GUIMessageList messages = new GUIMessageList();\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void Start()\r\n {\r\n // Set a "user" cookie if we previously used the 'Enter Name' button.\r\n // The server will set this username to the new connection.\r\n if (PlayerPrefs.HasKey("userName"))\r\n CookieJar.Set(URI, new Cookie("user", PlayerPrefs.GetString("userName")));\r\n\r\n signalRConnection = new Connection(URI);\r\n\r\n // to serialize the Message class, set a more advanced json encoder\r\n signalRConnection.JsonEncoder = new BestHTTP.SignalR.JsonEncoders.LitJsonEncoder();\r\n\r\n // set up event handlers\r\n signalRConnection.OnStateChanged += signalRConnection_OnStateChanged;\r\n signalRConnection.OnNonHubMessage += signalRConnection_OnGeneralMessage;\r\n\r\n // Start to connect to the server.\r\n signalRConnection.Open();\r\n }\r\n\r\n /// <summary>\r\n /// Draw the gui.\r\n /// Get input strings.\r\n /// Handle function calls.\r\n /// </summary>\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginVertical();\r\n\r\n #region To Everybody\r\n GUILayout.Label("To Everybody");\r\n\r\n GUILayout.BeginHorizontal();\r\n \r\n ToEveryBodyText = GUILayout.TextField(ToEveryBodyText, GUILayout.MinWidth(100));\r\n\r\n if (GUILayout.Button("Broadcast"))\r\n Broadcast(ToEveryBodyText);\r\n\r\n if (GUILayout.Button("Broadcast (All Except Me)"))\r\n BroadcastExceptMe(ToEveryBodyText);\r\n\r\n if (GUILayout.Button("Enter Name"))\r\n EnterName(ToEveryBodyText);\r\n\r\n if (GUILayout.Button("Join Group"))\r\n JoinGroup(ToEveryBodyText);\r\n\r\n if (GUILayout.Button("Leave Group"))\r\n LeaveGroup(ToEveryBodyText);\r\n\r\n GUILayout.EndHorizontal();\r\n #endregion\r\n\r\n #region To Me\r\n GUILayout.Label("To Me");\r\n\r\n GUILayout.BeginHorizontal();\r\n\r\n ToMeText = GUILayout.TextField(ToMeText, GUILayout.MinWidth(100));\r\n\r\n if (GUILayout.Button("Send to me"))\r\n SendToMe(ToMeText);\r\n\r\n GUILayout.EndHorizontal();\r\n #endregion\r\n\r\n #region Private Message\r\n GUILayout.Label("Private Message");\r\n\r\n GUILayout.BeginHorizontal();\r\n\r\n GUILayout.Label("Message:");\r\n PrivateMessageText = GUILayout.TextField(PrivateMessageText, GUILayout.MinWidth(100));\r\n\r\n GUILayout.Label("User or Group name:");\r\n PrivateMessageUserOrGroupName = GUILayout.TextField(PrivateMessageUserOrGroupName, GUILayout.MinWidth(100));\r\n\r\n if (GUILayout.Button("Send to user"))\r\n SendToUser(PrivateMessageUserOrGroupName, PrivateMessageText);\r\n\r\n if (GUILayout.Button("Send to group"))\r\n SendToGroup(PrivateMessageUserOrGroupName, PrivateMessageText);\r\n\r\n GUILayout.EndHorizontal();\r\n #endregion\r\n\r\n GUILayout.Space(20);\r\n\r\n if (signalRConnection.State == ConnectionStates.Closed)\r\n {\r\n if (GUILayout.Button("Start Connection"))\r\n signalRConnection.Open();\r\n }\r\n else if (GUILayout.Button("Stop Connection"))\r\n signalRConnection.Close();\r\n\r\n GUILayout.Space(20);\r\n\r\n // Draw the messages\r\n GUILayout.Label("Messages");\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Space(20);\r\n messages.Draw(Screen.width - 20, 0);\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.EndVertical();\r\n });\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Close the connection when the sample is closed\r\n signalRConnection.Close();\r\n }\r\n\r\n #endregion\r\n\r\n #region SignalR Events\r\n\r\n /// <summary>\r\n /// Handle non-hub messages\r\n [...string is too long...]"; // Token: 0x04000E1F RID: 3615 public static string HIIHNKPKKPA = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP.SignalR;\r\nusing BestHTTP.SignalR.Hubs;\r\n\r\nsealed class ConnectionStatusSample : MonoBehaviour\r\n{\r\n readonly Uri URI = new Uri("http://besthttpsignalr.azurewebsites.net/signalr");\r\n\r\n /// <summary>\r\n /// Reference to the SignalR Connection\r\n /// </summary>\r\n Connection signalRConnection;\r\n\r\n GUIMessageList messages = new GUIMessageList();\r\n\r\n #region Unity Events\r\n\r\n void Start()\r\n {\r\n // Connect to the StatusHub hub\r\n signalRConnection = new Connection(URI, "StatusHub");\r\n\r\n // General events\r\n signalRConnection.OnNonHubMessage += signalRConnection_OnNonHubMessage;\r\n signalRConnection.OnError += signalRConnection_OnError;\r\n signalRConnection.OnStateChanged += signalRConnection_OnStateChanged;\r\n\r\n // Set up a callback for Hub events\r\n signalRConnection["StatusHub"].OnMethodCall += statusHub_OnMethodCall;\r\n\r\n // Connect to the server\r\n signalRConnection.Open();\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Close the connection when we are closing the sample\r\n signalRConnection.Close();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginHorizontal();\r\n\r\n if (GUILayout.Button("START") && signalRConnection.State != ConnectionStates.Connected)\r\n signalRConnection.Open();\r\n\r\n if (GUILayout.Button("STOP") && signalRConnection.State == ConnectionStates.Connected)\r\n {\r\n signalRConnection.Close();\r\n messages.Clear();\r\n }\r\n\r\n if (GUILayout.Button("PING") && signalRConnection.State == ConnectionStates.Connected)\r\n {\r\n // Call a Hub-method on the server.\r\n signalRConnection["StatusHub"].Call("Ping");\r\n }\r\n\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.Space(20);\r\n\r\n GUILayout.Label("Connection Status Messages");\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Space(20);\r\n messages.Draw(Screen.width - 20, 0);\r\n GUILayout.EndHorizontal();\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n #region SignalR Events\r\n\r\n /// <summary>\r\n /// Called on server-sent non-hub messages.\r\n /// </summary>\r\n void signalRConnection_OnNonHubMessage(Connection manager, object data)\r\n {\r\n messages.Add("[Server Message] " + data.ToString());\r\n }\r\n\r\n /// <summary>\r\n /// Called when the SignalR Connection's state changes.\r\n /// </summary>\r\n void signalRConnection_OnStateChanged(Connection manager, ConnectionStates oldState, ConnectionStates newState)\r\n {\r\n messages.Add(string.Format("[State Change] {0} => {1}", oldState, newState));\r\n }\r\n\r\n /// <summary>\r\n /// Called when an error occures. The plugin may close the connection after this event.\r\n /// </summary>\r\n void signalRConnection_OnError(Connection manager, string error)\r\n {\r\n messages.Add("[Error] " + error);\r\n }\r\n\r\n /// <summary>\r\n /// Called when the "StatusHub" hub wants to call a method on this client.\r\n /// </summary>\r\n void statusHub_OnMethodCall(Hub hub, string method, params object[] args)\r\n {\r\n string id = args.Length > 0 ? args[0] as string : string.Empty;\r\n string when = args.Length > 1 ? args[1].ToString() : string.Empty;\r\n\r\n switch (method)\r\n {\r\n case "joined":\r\n messages.Add(string.Format("[{0}] {1} joined at {2}", hub.Name, id, when));\r\n break;\r\n\r\n case "rejoined":\r\n messages.Add(string.Format("[{0}] {1} reconnected at {2}", hub.Name, id, when));\r\n break;\r\n\r\n case "leave":\r\n messages.Add(string.Format("[{0}] {1} leaved at {2}", hub.Name, id, when));\r\n break;\r\n\r\n default: // pong\r\n messages.Add(string.Format("[{0}] {1}", hub.Name, method));\r\n break;\r\n }\r\n }\r\n\r\n #endregion\r\n}"; // Token: 0x04000E20 RID: 3616 public static string GOPJEHFMGFA = "using System;\r\n\r\nusing UnityEngine;\r\n\r\nusing BestHTTP.SignalR;\r\nusing BestHTTP.SignalR.Hubs;\r\nusing BestHTTP.SignalR.Messages;\r\nusing BestHTTP.SignalR.JsonEncoders;\r\n\r\nclass DemoHubSample : MonoBehaviour\r\n{\r\n readonly Uri URI = new Uri("http://besthttpsignalr.azurewebsites.net/signalr");\r\n\r\n /// <summary>\r\n /// The SignalR connection instance\r\n /// </summary>\r\n Connection signalRConnection;\r\n \r\n /// <summary>\r\n /// DemoHub client side implementation\r\n /// </summary>\r\n DemoHub demoHub;\r\n\r\n /// <summary>\r\n /// TypedDemoHub client side implementation\r\n /// </summary>\r\n TypedDemoHub typedDemoHub;\r\n\r\n /// <summary>\r\n /// VB .NET Hub\r\n /// </summary>\r\n Hub vbDemoHub;\r\n\r\n /// <summary>\r\n /// Result of the VB demo's ReadStateValue call\r\n /// </summary>\r\n string vbReadStateResult = string.Empty;\r\n\r\n Vector2 scrollPos; \r\n\r\n void Start()\r\n {\r\n // Create the hubs\r\n demoHub = new DemoHub();\r\n typedDemoHub = new TypedDemoHub();\r\n vbDemoHub = new Hub("vbdemo");\r\n\r\n // Create the SignalR connection, passing all the three hubs to it\r\n signalRConnection = new Connection(URI, demoHub, typedDemoHub, vbDemoHub);\r\n\r\n // Switch from the default encoder to the LitJson Encoder becouse it can handle the complex types too.\r\n signalRConnection.JsonEncoder = new LitJsonEncoder();\r\n\r\n // Call the demo functions when we successfully connect to the server\r\n signalRConnection.OnConnected += (connection) =>\r\n {\r\n var person = new { Name = "Foo", Age = 20, Address = new { Street = "One Microsoft Way", Zip = "98052" } };\r\n\r\n // Call the demo functions\r\n\r\n demoHub.ReportProgress("Long running job!");\r\n demoHub.AddToGroups();\r\n demoHub.GetValue();\r\n demoHub.TaskWithException();\r\n demoHub.GenericTaskWithException();\r\n demoHub.SynchronousException();\r\n demoHub.DynamicTask();\r\n demoHub.PassingDynamicComplex(person);\r\n demoHub.SimpleArray(new int[] { 5, 5, 6 });\r\n demoHub.ComplexType(person);\r\n demoHub.ComplexArray(new object[] { person, person, person });\r\n\r\n demoHub.Overload();\r\n\r\n // set some state\r\n demoHub.State["name"] = "Testing state!";\r\n demoHub.ReadStateValue();\r\n\r\n demoHub.PlainTask();\r\n demoHub.GenericTaskWithContinueWith();\r\n\r\n typedDemoHub.Echo("Typed echo callback");\r\n\r\n // vbDemo is not wrapped in a hub class, it would contain only one function\r\n vbDemoHub.Call("readStateValue", (hub, msg, result) => vbReadStateResult = string.Format("Read some state from VB.NET! => {0}", result.ReturnValue == null ? "undefined" : result.ReturnValue.ToString()));\r\n };\r\n\r\n // Start opening the signalR connection\r\n signalRConnection.Open();\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Close the connection when we are closing this sample\r\n signalRConnection.Close();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n scrollPos = GUILayout.BeginScrollView(scrollPos, false, false);\r\n GUILayout.BeginVertical();\r\n\r\n demoHub.Draw();\r\n\r\n typedDemoHub.Draw();\r\n\r\n GUILayout.Label("Read State Value");\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Space(20);\r\n GUILayout.Label(vbReadStateResult);\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.Space(10);\r\n\r\n GUILayout.EndVertical();\r\n GUILayout.EndScrollView();\r\n });\r\n\r\n }\r\n}\r\n\r\n/// <summary>\r\n/// Wrapper class of the 'TypedDemoHub' hub\r\n/// </summary>\r\nclass TypedDemoHub : Hub\r\n{\r\n string typedEchoResult = string.Empty;\r\n string typedEchoClientResult = string.Empty;\r\n\r\n public TypedDemoHub()\r\n :base("typeddemohub")\r\n {\r\n\r\n }\r\n\r\n /// <summary>\r\n /// Called by the Connection class to be able to set up mappings.\r\n /// </summary>\r\n public override void Setup()\r\n {\r\n // Setup server-called functions\r\n base.On("Echo", Echo);\r\n }\r\n\r\n #region Server Called Functions\r\n\r\n /// <summary>\r\n /// Server-called, client side implementation of the Echo function\r\n /// </summary>\r\n private void Echo(Hub hub, MethodCallMessage methodCall)\r\n {\r\n typedEchoClientResult = string.Format("{0} #{1} triggered!", methodCall.Arguments[0], methodCall.Arguments[1]);\r\n }\r\n\r\n #endregion\r\n\r\n #region Client Called Function(s)\r\n\r\n /// <summary>\r\n /// Client-called, server side implementation of the Echo function.\r\n /// When the function successfully executed on the server the OnEcho_Done callback function will be called.\r\n /// </summary>\r\n public void Echo(string msg)\r\n {\r\n base.Call("echo", OnEcho_Done, msg);\r\n }\r\n\r\n /// <summary>\r\n /// When the function successfully executed on the server this callback function will be called.\r\n /// </summary>\r\n private void OnEcho_Done(Hub hub, ClientMessage originalMessage, ResultMessage result)\r\n {\r\n typedEchoResult = "TypedDemoHub.Echo(string message) invoked!";\r\n }\r\n\r\n #endregion\r\n\r\n public void Draw()\r\n {\r\n GUILayout.Label("Typed callback");\r\n\r\n &nb[...string is too long...]"; // Token: 0x04000E21 RID: 3617 public static string LEOBHOIMBBM = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP.SignalR;\r\nusing BestHTTP.SignalR.Hubs;\r\nusing BestHTTP.SignalR.Messages;\r\nusing BestHTTP.SignalR.Authentication;\r\n\r\nclass AuthenticationSample : MonoBehaviour\r\n{\r\n readonly Uri URI = new Uri("https://besthttpsignalr.azurewebsites.net/signalr");\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// Reference to the SignalR Connection\r\n /// </summary>\r\n Connection signalRConnection;\r\n\r\n string userName = string.Empty;\r\n string role = string.Empty;\r\n\r\n Vector2 scrollPos;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void Start()\r\n {\r\n // Create the SignalR connection, and pass the hubs that we want to connect to\r\n signalRConnection = new Connection(URI, new BaseHub("noauthhub", "Messages"),\r\n new BaseHub("invokeauthhub", "Messages Invoked By Admin or Invoker"),\r\n new BaseHub("authhub", "Messages Requiring Authentication to Send or Receive"),\r\n new BaseHub("inheritauthhub", "Messages Requiring Authentication to Send or Receive Because of Inheritance"),\r\n new BaseHub("incomingauthhub", "Messages Requiring Authentication to Send"),\r\n new BaseHub("adminauthhub", "Messages Requiring Admin Membership to Send or Receive"), \r\n new BaseHub("userandroleauthhub", "Messages Requiring Name to be \\"User\\" and Role to be \\"Admin\\" to Send or Receive"));\r\n \r\n // Set the authenticator if we have valid fields\r\n if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(role))\r\n signalRConnection.AuthenticationProvider = new HeaderAuthenticator(userName, role);\r\n\r\n // Set up event handler\r\n signalRConnection.OnConnected += signalRConnection_OnConnected;\r\n\r\n // Start to connect to the server.\r\n signalRConnection.Open();\r\n }\r\n\r\n void OnDestroy()\r\n {\r\n // Close the connection when we are closing the sample\r\n signalRConnection.Close();\r\n }\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n scrollPos = GUILayout.BeginScrollView(scrollPos, false, false);\r\n GUILayout.BeginVertical();\r\n\r\n if (signalRConnection.AuthenticationProvider == null)\r\n {\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Label("Username (Enter 'User'):");\r\n userName = GUILayout.TextField(userName, GUILayout.MinWidth(100));\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Label("Roles (Enter 'Invoker' or 'Admin'):");\r\n role = GUILayout.TextField(role, GUILayout.MinWidth(100));\r\n GUILayout.EndHorizontal();\r\n\r\n if (GUILayout.Button("Log in"))\r\n Restart();\r\n }\r\n\r\n for (int i = 0; i < signalRConnection.Hubs.Length; ++i)\r\n (signalRConnection.Hubs[i] as BaseHub).Draw();\r\n\r\n GUILayout.EndVertical();\r\n GUILayout.EndScrollView();\r\n });\r\n }\r\n\r\n #endregion\r\n\r\n /// <summary>\r\n /// Called when we successfully connected to the server.\r\n /// </summary>\r\n void signalRConnection_OnConnected(Connection manager)\r\n {\r\n // call 'InvokedFromClient' on all hubs\r\n for (int i = 0; i < signalRConnection.Hubs.Length; ++i)\r\n (signalRConnection.Hubs[i] as BaseHub).InvokedFromClient();\r\n }\r\n\r\n /// <summary>\r\n /// Helper function to do a hard-restart to the server.\r\n /// </summary>\r\n void Restart()\r\n {\r\n // Clean up\r\n signalRConnection.OnConnected -= signalRConnection_OnConnected;\r\n\r\n // Close current connection\r\n signalRConnection.Close();\r\n signalRConnection = null;\r\n\r\n // start again, with authentication if we filled in all input fields\r\n Start();\r\n\r\n }\r\n}\r\n\r\n/// <summary>\r\n/// Hub implementation for the authentication demo. All hubs that we connect to has the same server and client side functions.\r\n/// </summary>\r\nclass BaseHub : Hub\r\n{\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// Hub specific title\r\n /// </summary>\r\n private string Title;\r\n\r\n private GUIMessageList messages = new GUIMessageList();\r\n\r\n #endregion\r\n\r\n public BaseHub(string name, string title)\r\n : base(name)\r\n {\r\n this.Title = title;\r\n }\r\n\r\n /// <summary>\r\n /// Called by the Connection class to be able to set up mappings.\r\n /// </summary>\r\n public override void Setup()\r\n {\r\n // Map the server-callable method names to the real functions.\r\n On("joined", Joined);\r\n On("rejoined", Rejoined);\r\n On("left", Left);\r\n On("invoked", Invoked);\r\n }\r\n\r\n #region Server Called Functions\r\n\r\n private void Joined(Hub hub, MethodCallMessage methodCall)\r\n {\r\n Dictionary<string, object> AuthInfo = methodCall.Arguments[2] as Dictionary<string, object>;\r\n messages.Add(string.[...string is too long...]"; // Token: 0x04000E22 RID: 3618 public static string CBOKAMOMBIH = "using System;\r\nusing System.Collections.Generic;\r\n\r\nusing UnityEngine;\r\nusing BestHTTP;\r\nusing BestHTTP.Caching;\r\n\r\npublic sealed class CacheMaintenanceSample : MonoBehaviour\r\n{\r\n /// <summary>\r\n /// An enum for better readability\r\n /// </summary>\r\n enum DeleteOlderTypes\r\n {\r\n Days,\r\n Hours,\r\n Mins,\r\n Secs\r\n };\r\n\r\n #region Private Fields\r\n\r\n /// <summary>\r\n /// What methode to call on the TimeSpan\r\n /// </summary>\r\n DeleteOlderTypes deleteOlderType = DeleteOlderTypes.Secs;\r\n\r\n /// <summary>\r\n /// The value for the TimeSpan.\r\n /// </summary>\r\n int value = 10;\r\n\r\n /// <summary>\r\n /// What's our maximum cache size\r\n /// </summary>\r\n int maxCacheSize = 5 * 1024 * 1024;\r\n\r\n #endregion\r\n\r\n #region Unity Events\r\n\r\n void OnGUI()\r\n {\r\n GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>\r\n {\r\n GUILayout.BeginHorizontal();\r\n \r\n GUILayout.Label("Delete cached entities older then");\r\n\r\n GUILayout.Label(value.ToString(), GUILayout.MinWidth(50));\r\n value = (int)GUILayout.HorizontalSlider(value, 1, 60, GUILayout.MinWidth(100));\r\n\r\n GUILayout.Space(10);\r\n\r\n deleteOlderType = (DeleteOlderTypes)(int)GUILayout.SelectionGrid((int)deleteOlderType, new string[] { "Days", "Hours", "Mins", "Secs" }, 4);\r\n GUILayout.FlexibleSpace();\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.Space(10);\r\n\r\n GUILayout.BeginHorizontal();\r\n GUILayout.Label("Max Cache Size (bytes): ", GUILayout.Width(150));\r\n GUILayout.Label(maxCacheSize.ToString("N0"), GUILayout.Width(70));\r\n maxCacheSize = (int)GUILayout.HorizontalSlider(maxCacheSize, 1024, 10 * 1024 * 1024);\r\n GUILayout.EndHorizontal();\r\n\r\n GUILayout.Space(10);\r\n\r\n if (GUILayout.Button("Maintenance"))\r\n {\r\n TimeSpan deleteOlder = TimeSpan.FromDays(14);\r\n\r\n switch (deleteOlderType)\r\n {\r\n case DeleteOlderTypes.Days: deleteOlder = TimeSpan.FromDays(value); break;\r\n case DeleteOlderTypes.Hours: deleteOlder = TimeSpan.FromHours(value); break;\r\n case DeleteOlderTypes.Mins: deleteOlder = TimeSpan.FromMinutes(value); break;\r\n case DeleteOlderTypes.Secs: deleteOlder = TimeSpan.FromSeconds(value); break;\r\n }\r\n\r\n // Call the BeginMaintainence function. It will run on a thread to do not block the main thread.\r\n HTTPCacheService.BeginMaintainence(new HTTPCacheMaintananceParams(deleteOlder, (ulong)maxCacheSize));\r\n }\r\n });\r\n }\r\n\r\n #endregion\r\n}"; } }