资源简介
Unity Editor Console Pro 扩展点击定位到外部工程
代码片段和文件信息
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(buffer0buffer.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 logs = new List();
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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3703 2015-07-28 04:44 ConsolePro\ConsoleProRemoteServer.cs
文件 264 2015-07-28 04:44 ConsolePro\ConsoleProRemoteServer.cs.me
文件 182784 2016-11-19 17:22 ConsolePro\Editor\ConsolePro.Editor.dll
文件 467 2016-11-15 20:23 ConsolePro\Editor\ConsolePro.Editor.dll.me
文件 191 2016-11-12 11:26 ConsolePro\Editor.me
文件 2954 2015-07-28 04:44 ConsolePro\Readme.txt
文件 179 2015-07-28 04:44 ConsolePro\Readme.txt.me
目录 0 2016-11-19 17:22 ConsolePro\Editor
目录 0 2016-11-12 11:26 ConsolePro
----------- --------- ---------- ----- ----
190542 9
相关资源
- LC-3 Editor和LC-3 Simulator
- Unity UFFA - Editor Patcher 2020.rar
- UFFA - Editor Patcher 2020.rar
- jsonEditor离线版
- 中兴 交换机 console配置线做法
- tcp协议简单的聊天程序Console
- Delphi2007 IDEFixPack2007Reg44.ra
- eWebEditor在线文本编辑器飞鱼修改版
-
Editor sc
ripting for n00bs Unity编辑器 -
firstob
ject xm l editor-xm l查看器 - 资源文件编辑器ResEditor
- vs2013 color theme editor解决出现:未能安
- usb-console(console口转usb驱动) v1.5 最
- 博达交换机console线序制作
- 百度UEditor编辑器之配置文件ueditor.c
- 老虎吃绵羊 人机对战 lua console
- ABAP Editor Default Theme
- ABAP Editor Dark Theme
- ResEditor.rar
- TinyMDBEditor(微型mdb数据库编辑器)
- WangEditor-3.1.1-本地视频上传.rar
- eWebEditor7.0破解版,实现粘贴图片自
- ckeditor设置行间距插件包
- console屏幕处理程序
- PathEditor环境变量编辑器
- 一个nuxt版的 vue-quill-editor demo
- foxit reader3.1\\foxit creator3.1\\foxit Edito
- MyEclipse10安装PropertiesEditor的插件
- cuteEditor 授权文件
- .NET MVC 中使用 kindeditor 中图片上传和
评论
共有 条评论