Просмотр исходного кода

Merge branch 'master' of http://git.dashgame.com/gsgundam/garden_client

LiuQilin 8 лет назад
Родитель
Сommit
488c4c52c5

+ 9 - 0
Assets/Resource/Plugins/ConsolePro.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0710b6f02717e524c8be7b422a8e8a24
+folderAsset: yes
+timeCreated: 1491487721
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 192 - 0
Assets/Resource/Plugins/ConsolePro/ConsoleProRemoteServer.cs

@@ -0,0 +1,192 @@
+using UnityEngine;
+using System;
+using System.Net;
+using System.Collections.Generic;
+
+namespace FlyingWormConsole3
+{
+public class ConsoleProRemoteServer : MonoBehaviour
+{
+	#if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_WP8 && !UNITY_METRO
+	public class HTTPContext
+	{
+		public HttpListenerContext context;
+		public string path;
+
+		public string Command
+		{
+			get
+			{
+				return WWW.UnEscapeURL(context.Request.Url.AbsolutePath);
+			}
+		}
+
+		public HttpListenerRequest Request
+		{
+			get
+			{
+				return context.Request;
+			}
+		}
+
+		public HttpListenerResponse Response
+		{
+			get
+			{
+				return context.Response;
+			}
+		}
+
+		public HTTPContext(HttpListenerContext inContext)
+		{
+			context = inContext;
+		}
+
+		public void RespondWithString(string inString)
+		{
+			Response.StatusDescription = "OK";
+			Response.StatusCode = (int)HttpStatusCode.OK;
+
+			if (!string.IsNullOrEmpty(inString))
+			{
+				Response.ContentType = "text/plain";
+
+				byte[] buffer = System.Text.Encoding.UTF8.GetBytes(inString);
+				Response.ContentLength64 = buffer.Length;
+				Response.OutputStream.Write(buffer,0,buffer.Length);
+			}
+		}
+	}
+
+	[System.SerializableAttribute]
+	public class QueuedLog
+	{
+		public string message;
+		public string stackTrace;
+		public LogType type;
+	}
+
+	public int port = 51000;
+
+	private static HttpListener listener = new HttpListener();
+	
+	[NonSerializedAttribute]
+	public List<QueuedLog> logs = new List<QueuedLog>();
+
+	void Awake()
+	{
+		DontDestroyOnLoad(gameObject);
+
+		Debug.Log("Starting Console Pro Server on port : " + port);
+		listener.Prefixes.Add("http://*:"+port+"/");
+		listener.Start();
+		listener.BeginGetContext(ListenerCallback, null);
+	}
+
+	#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
+
+	void OnEnable()
+	{
+		Application.RegisterLogCallback(LogCallback);
+	}
+
+	void Update()
+	{
+		Application.RegisterLogCallback(LogCallback);
+	}
+
+	void LateUpdate()
+	{
+		Application.RegisterLogCallback(LogCallback);
+	}
+
+	void OnDisable()
+	{
+		Application.RegisterLogCallback(null);
+	}
+
+	#else
+
+	void OnEnable()
+	{
+		Application.logMessageReceived += LogCallback;
+	}
+
+	void OnDisable()
+	{
+		Application.logMessageReceived -= LogCallback;
+	}
+
+	#endif
+
+	public void LogCallback(string logString, string stackTrace, LogType type)
+	{
+		if(!logString.StartsWith("CPIGNORE"))
+		{
+			QueueLog(logString, stackTrace, type);
+		}
+	}
+
+	void QueueLog(string logString, string stackTrace, LogType type)
+	{
+		logs.Add(new QueuedLog() { message = logString, stackTrace = stackTrace, type = type } );
+	}
+
+	void ListenerCallback(IAsyncResult result)
+	{
+		HTTPContext context = new HTTPContext(listener.EndGetContext(result));
+
+		HandleRequest(context);
+		
+		listener.BeginGetContext(new AsyncCallback(ListenerCallback), null);
+	}
+
+	void HandleRequest(HTTPContext context)
+	{
+		// Debug.LogError("HANDLE " + context.Request.HttpMethod);
+		// Debug.LogError("HANDLE " + context.path);
+
+		bool foundCommand = false;
+
+		switch(context.Command)
+		{
+			case "/NewLogs":
+			{
+				foundCommand = true;
+
+				if(logs.Count > 0)
+				{
+					string response = "";
+
+					//  foreach(QueuedLog cLog in logs)
+					for(int i = 0; i < logs.Count; i++)
+					{					
+						QueuedLog cLog = logs[i];
+						response += "::::" + cLog.type;
+						response += "||||" + cLog.message;
+						response += ">>>>" + cLog.stackTrace + ">>>>";
+					}
+
+					context.RespondWithString(response);
+
+					logs.Clear();
+				}
+				else
+				{
+					context.RespondWithString("");
+				}
+				break;
+			}
+		}
+
+		if(!foundCommand)
+		{
+			context.Response.StatusCode = (int)HttpStatusCode.NotFound;
+			context.Response.StatusDescription = "Not Found";
+		}
+
+		context.Response.OutputStream.Close();
+	}
+	#endif
+}
+}

+ 12 - 0
Assets/Resource/Plugins/ConsolePro/ConsoleProRemoteServer.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 50c9671d3a0924f63ae71abf82c7f290
+timeCreated: 1437114996
+licenseType: Store
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Resource/Plugins/ConsolePro/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a03b6bb1cd561d64c987a25b6fc60b76
+folderAsset: yes
+timeCreated: 1478921179
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Resource/Plugins/ConsolePro/Editor/ConsolePro.Editor.dll


+ 24 - 0
Assets/Resource/Plugins/ConsolePro/Editor/ConsolePro.Editor.dll.meta

@@ -0,0 +1,24 @@
+fileFormatVersion: 2
+guid: 59448ce4f90e4754e95ec454aede0c69
+timeCreated: 1479212613
+licenseType: Pro
+PluginImporter:
+  serializedVersion: 1
+  iconMap: {}
+  executionOrder: {}
+  isPreloaded: 0
+  platformData:
+    Any:
+      enabled: 0
+      settings: {}
+    Editor:
+      enabled: 1
+      settings:
+        DefaultValueInitialized: true
+    WindowsStoreApps:
+      enabled: 0
+      settings:
+        CPU: AnyCPU
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 55 - 0
Assets/Resource/Plugins/ConsolePro/Readme.txt

@@ -0,0 +1,55 @@
+Version 3.0
+
+Editor Console Pro is a powerful replacement for Unity's editor console.
+
+It is accessed in the Window menu under Console Pro, or by pressing Command + \
+
+# Searching:
+Type a search string in the top left <filter> field to only show entries containing the search text.
+Press the ... button next the field to get more options, such as regex and case sensitive searches.
+
+# Custom filters:
+Custom filters allow you to add more log types to the toolbar next to Errors, Warnings, Logs and to give them a custom color.  You can filter them by type and string.
+You can create and modify these in Prefs\Custom Filters
+
+# Shared filters:
+Shared filters are custom filters in an external file.  These are per project, so you can set a different set of filters for each project you are in, also commit this file to version control if you would like other people to use them.
+You can create and modify these in Prefs\Shared Filters
+
+# Temporary filters:
+Simply start any log with #NAME#, and Console Pro will create a temporary filter button containing these logs.  
+For example:
+Debug.Log("#Player# Player created");
+Debug.Log("#Player# Player destroyed");
+The color is generated by the name.
+
+# Ignore
+When you ignore something, it will not show up in Console Pro.
+You can create and modify these in Prefs\Ignore
+You can quickly ignore a stack entry forever by right clicking it in the stack, and pressing Ignore.
+You can ignore a log forever adding it to the Ignore Logs list.
+
+# Columns
+Columns for the logs can show various things like the file the log came from or the namespace of the method that called it.
+To quickly enable or disable a column, press the ... button to the left of Prefs.
+You can modify column order in Prefs\Columns
+
+# Jumping to stack entries
+Simply click on any line in the stack panel to jump to that line in the source code.  Double clicking a log entry jumps to the top stack entry as normal.
+
+# Remote Logging
+Remote logging allows you to read the logs at runtime on a device like an iPad or Android tablet over WiFi, or on a standalone build.  The steps to use remote logging are as follows:
+Add a GameObject to main scene
+Add the component called "Console Pro Remote Server" to your new GameObject
+Set the port you would like to use on the component
+Build and run your game on the device
+Press the ... button to the left of Prefs, and click Remote Mode.
+Press the button labeled "Remote" in the top right.
+Enter your device's IP address and port with the format IP:Port.  If this is a standalone build on your own machine, just put localhost:port.
+
+# Copying and Exporting
+Right click an entry and press Copy Stack to put a copy of the current stack into the clipboard, or Copy Log to put a copy of the current log into the clipboard.
+Press the ... button to the left of Prefs, and press Export to export a text file of the entire log.
+
+# Support
+Please EMail all support and feature requests to Support@Flyingworm.com

+ 8 - 0
Assets/Resource/Plugins/ConsolePro/Readme.txt.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5ddabb1ad13bd4bdcbc3767854e046d3
+timeCreated: 1437114996
+licenseType: Store
+TextScriptImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: