modify
This commit is contained in:
parent
583140efdf
commit
7ecd5f3c2d
@ -1,5 +1,5 @@
|
||||
using System.IO;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AlicizaX.Editor
|
||||
|
@ -3,7 +3,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using AlicizaX.Runtime;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using AlicizaX.Runtime;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AlicizaX;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using AlicizaX.Runtime;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,108 +1,194 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Editor
|
||||
{
|
||||
public static class OpenAssetLogLine
|
||||
{
|
||||
[OnOpenAsset(0)]
|
||||
private static bool OnOpenAsset(int instanceID, int line)
|
||||
{
|
||||
if (line <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// 获取资源路径
|
||||
string assetPath = AssetDatabase.GetAssetPath(instanceID);
|
||||
|
||||
// 判断资源类型
|
||||
if (!assetPath.EndsWith(".cs"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool autoFirstMatch = assetPath.Contains("Log.cs");
|
||||
|
||||
var stackTrace = GetStackTrace();
|
||||
if (!string.IsNullOrEmpty(stackTrace) && stackTrace.Contains("Log.cs"))
|
||||
|
||||
{
|
||||
if (!autoFirstMatch)
|
||||
{
|
||||
var fullPath = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Assets", StringComparison.Ordinal));
|
||||
fullPath = $"{fullPath}{assetPath}";
|
||||
// 跳转到目标代码的特定行
|
||||
InternalEditorUtility.OpenFileAtLineExternal(fullPath.Replace('/', '\\'), line);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 使用正则表达式匹配at的哪个脚本的哪一行
|
||||
var matches = Regex.Match(stackTrace, @"\(at (.+)\)",
|
||||
RegexOptions.IgnoreCase);
|
||||
while (matches.Success)
|
||||
{
|
||||
var pathLine = matches.Groups[1].Value;
|
||||
|
||||
if (!pathLine.Contains("Log.cs"))
|
||||
{
|
||||
var splitIndex = pathLine.LastIndexOf(":", StringComparison.Ordinal);
|
||||
// 脚本路径
|
||||
var path = pathLine.Substring(0, splitIndex);
|
||||
// 行号
|
||||
line = Convert.ToInt32(pathLine.Substring(splitIndex + 1));
|
||||
var fullPath = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Assets", StringComparison.Ordinal));
|
||||
fullPath = $"{fullPath}{path}";
|
||||
// 跳转到目标代码的特定行
|
||||
InternalEditorUtility.OpenFileAtLineExternal(fullPath.Replace('/', '\\'), line);
|
||||
break;
|
||||
}
|
||||
|
||||
matches = matches.NextMatch();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前日志窗口选中的日志的堆栈信息。
|
||||
/// </summary>
|
||||
/// <returns>选中日志的堆栈信息实例。</returns>
|
||||
private static string GetStackTrace()
|
||||
{
|
||||
// 通过反射获取ConsoleWindow类
|
||||
var consoleWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow");
|
||||
// 获取窗口实例
|
||||
var fieldInfo = consoleWindowType.GetField("ms_ConsoleWindow",
|
||||
BindingFlags.Static |
|
||||
BindingFlags.NonPublic);
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
var consoleInstance = fieldInfo.GetValue(null);
|
||||
if (consoleInstance != null)
|
||||
if (EditorWindow.focusedWindow == (EditorWindow)consoleInstance)
|
||||
{
|
||||
// 获取m_ActiveText成员
|
||||
fieldInfo = consoleWindowType.GetField("m_ActiveText",
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.NonPublic);
|
||||
// 获取m_ActiveText的值
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
var activeText = fieldInfo.GetValue(consoleInstance).ToString();
|
||||
return activeText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// using System;
|
||||
// using System.Reflection;
|
||||
// using AlicizaX.Runtime;
|
||||
// using UnityEditor;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace AlicizaX.Editor
|
||||
// {
|
||||
// public static class LogEditor
|
||||
// {
|
||||
// private class LogEditorConfig
|
||||
// {
|
||||
// public string logScriptPath = "";
|
||||
// public string logTypeName = "";
|
||||
// public int instanceID = 0;
|
||||
//
|
||||
// public LogEditorConfig(string logScriptPath, System.Type logType)
|
||||
// {
|
||||
// this.logScriptPath = logScriptPath;
|
||||
// this.logTypeName = logType.FullName;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static LogEditorConfig[] _logEditorConfig = new LogEditorConfig[]
|
||||
// {
|
||||
// new LogEditorConfig("Packages/com.alicizax.unity/Runtime/Base/Log/Log.cs", typeof(Log))
|
||||
// };
|
||||
//
|
||||
//
|
||||
// [UnityEditor.Callbacks.OnOpenAssetAttribute(-1)]
|
||||
// private static bool OnOpenAsset(int instanceID, int line)
|
||||
// {
|
||||
// for (int i = _logEditorConfig.Length - 1; i >= 0; --i)
|
||||
// {
|
||||
// var configTmp = _logEditorConfig[i];
|
||||
// UpdateLogInstanceID(configTmp);
|
||||
// if (instanceID == configTmp.instanceID)
|
||||
// {
|
||||
// var statckTrack = GetStackTrace();
|
||||
// if (!string.IsNullOrEmpty(statckTrack))
|
||||
// {
|
||||
// var fileNames = statckTrack.Split('\n');
|
||||
// var fileName = GetCurrentFullFileName(fileNames);
|
||||
// var fileLine = LogFileNameToFileLine(fileName);
|
||||
// fileName = GetRealFileName(fileName);
|
||||
//
|
||||
// AssetDatabase.OpenAsset(AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(fileName), fileLine);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// private static string GetStackTrace()
|
||||
// {
|
||||
// var consoleWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow");
|
||||
// var fieldInfo = consoleWindowType.GetField("ms_ConsoleWindow", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
// var consoleWindowInstance = fieldInfo.GetValue(null);
|
||||
//
|
||||
// if (null != consoleWindowInstance)
|
||||
// {
|
||||
// if ((object)EditorWindow.focusedWindow == consoleWindowInstance)
|
||||
// {
|
||||
// // Get ListViewState in ConsoleWindow
|
||||
// // var listViewStateType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ListViewState");
|
||||
// // fieldInfo = consoleWindowType.GetField("m_ListView", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
// // var listView = fieldInfo.GetValue(consoleWindowInstance);
|
||||
//
|
||||
// // Get row in listViewState
|
||||
// // fieldInfo = listViewStateType.GetField("row", BindingFlags.Instance | BindingFlags.Public);
|
||||
// // int row = (int)fieldInfo.GetValue(listView);
|
||||
//
|
||||
// // Get m_ActiveText in ConsoleWindow
|
||||
// fieldInfo = consoleWindowType.GetField("m_ActiveText", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
// string activeText = fieldInfo.GetValue(consoleWindowInstance).ToString();
|
||||
//
|
||||
// return activeText;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// private static void UpdateLogInstanceID(LogEditorConfig config)
|
||||
// {
|
||||
// if (config.instanceID > 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var assetLoadTmp = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(config.logScriptPath);
|
||||
// if (null == assetLoadTmp)
|
||||
// {
|
||||
// throw new System.Exception("not find asset by path=" + config.logScriptPath);
|
||||
// }
|
||||
//
|
||||
// config.instanceID = assetLoadTmp.GetInstanceID();
|
||||
// }
|
||||
//
|
||||
// private static string GetCurrentFullFileName(string[] fileNames)
|
||||
// {
|
||||
// string retValue = "";
|
||||
// int findIndex = -1;
|
||||
//
|
||||
// for (int i = fileNames.Length - 1; i >= 0; --i)
|
||||
// {
|
||||
// bool isCustomLog = false;
|
||||
// for (int j = _logEditorConfig.Length - 1; j >= 0; --j)
|
||||
// {
|
||||
// if (fileNames[i].Contains(_logEditorConfig[j].logTypeName))
|
||||
// {
|
||||
// isCustomLog = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (isCustomLog)
|
||||
// {
|
||||
// findIndex = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (findIndex >= 0 && findIndex < fileNames.Length - 1)
|
||||
// {
|
||||
// retValue = fileNames[findIndex + 1];
|
||||
// }
|
||||
//
|
||||
// return retValue;
|
||||
// }
|
||||
//
|
||||
// private static string GetRealFileName(string fileName)
|
||||
// {
|
||||
// int indexStart = fileName.IndexOf("(at ") + "(at ".Length;
|
||||
// int indexEnd = ParseFileLineStartIndex(fileName) - 1;
|
||||
//
|
||||
// fileName = fileName.Substring(indexStart, indexEnd - indexStart);
|
||||
// return fileName;
|
||||
// }
|
||||
//
|
||||
// private static int LogFileNameToFileLine(string fileName)
|
||||
// {
|
||||
// int findIndex = ParseFileLineStartIndex(fileName);
|
||||
// string stringParseLine = "";
|
||||
// for (int i = findIndex; i < fileName.Length; ++i)
|
||||
// {
|
||||
// var charCheck = fileName[i];
|
||||
// if (!IsNumber(charCheck))
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// stringParseLine += charCheck;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return int.Parse(stringParseLine);
|
||||
// }
|
||||
//
|
||||
// private static int ParseFileLineStartIndex(string fileName)
|
||||
// {
|
||||
// int retValue = -1;
|
||||
// for (int i = fileName.Length - 1; i >= 0; --i)
|
||||
// {
|
||||
// var charCheck = fileName[i];
|
||||
// bool isNumber = IsNumber(charCheck);
|
||||
// if (isNumber)
|
||||
// {
|
||||
// retValue = i;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (retValue != -1)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return retValue;
|
||||
// }
|
||||
//
|
||||
// private static bool IsNumber(char c)
|
||||
// {
|
||||
// return c >= '0' && c <= '9';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@ -1,6 +1,5 @@
|
||||
using AlicizaX;
|
||||
using System.Diagnostics;
|
||||
using AlicizaX.Runtime;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Editor
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.Editor
|
||||
{
|
||||
|
BIN
Plugins/XLog.dll
Normal file
BIN
Plugins/XLog.dll
Normal file
Binary file not shown.
2
Plugins/XLog.dll.meta
Normal file
2
Plugins/XLog.dll.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d54020f8ad5378144bdeef5bb9b7a769
|
@ -3,7 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架链表类。
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架链表范围。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架单例
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架多值字典类。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架序列化器基类。
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架单例
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 标记物体对象为不可销毁
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型和名称的组合值。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public interface IEvent
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件基类。
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public sealed partial class EventPool<T> where T : BaseEventArgs
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件池。
|
||||
@ -283,7 +283,7 @@ namespace AlicizaX.Runtime
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Fatal(exception);
|
||||
Log.Exception(exception);
|
||||
}
|
||||
|
||||
current = _cachedNodes[e];
|
||||
@ -299,7 +299,7 @@ namespace AlicizaX.Runtime
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Fatal(exception);
|
||||
Log.Exception(exception);
|
||||
}
|
||||
}
|
||||
else if ((_eventPoolMode & EventPoolMode.AllowNoHandler) == 0)
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 事件池模式。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架中包含事件数据的类的基类。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架异常类。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架异常静态方法
|
||||
|
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 916bb4a512dc940daa99fa6c51b4179e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,34 +0,0 @@
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏框架日志等级。
|
||||
/// </summary>
|
||||
public enum GameFrameworkLogLevel : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// 调试。
|
||||
/// </summary>
|
||||
Debug = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 信息。
|
||||
/// </summary>
|
||||
Info,
|
||||
|
||||
/// <summary>
|
||||
/// 警告。
|
||||
/// </summary>
|
||||
Warning,
|
||||
|
||||
/// <summary>
|
||||
/// 错误。
|
||||
/// </summary>
|
||||
Error,
|
||||
|
||||
/// <summary>
|
||||
/// 严重错误。
|
||||
/// </summary>
|
||||
Fatal
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60514273a67bf47f19bc57d0a81e5d5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dea5e7b095c6d3b4ea334c381fcd16fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,135 +0,0 @@
|
||||
using Cysharp.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
{
|
||||
public static class LogReportUtil
|
||||
{
|
||||
private static LogDetails LastReportedDetails = new LogDetails();
|
||||
|
||||
public static bool ForceDisableReport = true;
|
||||
|
||||
|
||||
internal static void RedirectLog()
|
||||
{
|
||||
Application.logMessageReceived += HandleLog;
|
||||
}
|
||||
|
||||
internal static void UnRedirectLog()
|
||||
{
|
||||
Application.logMessageReceived -= HandleLog;
|
||||
}
|
||||
|
||||
private static void HandleLog(string logMessage, string stackTrace, LogType logType)
|
||||
{
|
||||
GameFrameworkLogLevel logLevel = GameFrameworkLogLevel.Info;
|
||||
|
||||
switch (logType)
|
||||
{
|
||||
case LogType.Error:
|
||||
logLevel = GameFrameworkLogLevel.Error;
|
||||
break;
|
||||
case LogType.Assert:
|
||||
case LogType.Exception:
|
||||
logLevel = GameFrameworkLogLevel.Fatal;
|
||||
break;
|
||||
case LogType.Warning:
|
||||
logLevel = GameFrameworkLogLevel.Warning;
|
||||
break;
|
||||
case LogType.Log:
|
||||
logLevel = GameFrameworkLogLevel.Info;
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessLogMessage(logLevel, logMessage, stackTrace);
|
||||
}
|
||||
|
||||
private static void ProcessLogMessage(GameFrameworkLogLevel logLevel, string message, string stackTrace)
|
||||
{
|
||||
if (logLevel == GameFrameworkLogLevel.Fatal || logLevel == GameFrameworkLogLevel.Error)
|
||||
{
|
||||
string formattedMessage = "";
|
||||
using (var sb = ZString.CreateStringBuilder())
|
||||
{
|
||||
sb.Append(message);
|
||||
sb.Append(GetStackTrace(stackTrace));
|
||||
formattedMessage = sb.ToString();
|
||||
}
|
||||
|
||||
if (!ForceDisableReport && ShouldReport(logLevel, formattedMessage))
|
||||
{
|
||||
_ = WebHookUtils.SendLogToServerAsync(formattedMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string GetStackTrace(string stackTrace)
|
||||
{
|
||||
return string.IsNullOrEmpty(stackTrace) ? string.Empty : $"\nStackTrace:\n{SimplifyStackTrace(stackTrace)}";
|
||||
}
|
||||
|
||||
private static string SimplifyStackTrace(string stackTrace)
|
||||
{
|
||||
var sb = ZString.CreateStringBuilder();
|
||||
var lines = stackTrace.Split('\n');
|
||||
bool skipLine = false;
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.Contains("Log") || line.Contains("Sirenix"))
|
||||
{
|
||||
skipLine = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (skipLine)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(line) && !line.Contains("Log") && !line.Contains("Sirenix"))
|
||||
{
|
||||
skipLine = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(line))
|
||||
{
|
||||
sb.Append(line);
|
||||
sb.Append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string result = sb.ToString().Trim();
|
||||
return !string.IsNullOrEmpty(result) ? result : "Stack trace not available.";
|
||||
}
|
||||
|
||||
|
||||
private static bool ShouldReport(GameFrameworkLogLevel logLevel, string message)
|
||||
{
|
||||
if (LastReportedDetails.Level == logLevel && LastReportedDetails.Message.Equals(message))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LastReportedDetails.Update(logLevel, message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private struct LogDetails
|
||||
{
|
||||
public GameFrameworkLogLevel Level;
|
||||
public string Message;
|
||||
|
||||
public void Update(GameFrameworkLogLevel level, string message)
|
||||
{
|
||||
Level = level;
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b7127ce6c394c43844105d9affeed71
|
||||
timeCreated: 1737509620
|
@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
{
|
||||
public static class WebHookUtils
|
||||
{
|
||||
private static readonly HttpClient httpClient = new HttpClient();
|
||||
private static readonly string WebHookKey = "https://open.feishu.cn/open-apis/bot/v2/hook/e9cdddcb-8ae0-4390-98d7-42e2c29efc00";
|
||||
public static async UniTask SendLogToServerAsync(string logMessage)
|
||||
{
|
||||
string at = @"<at user_id=""all"">所有人</at> ";
|
||||
try
|
||||
{
|
||||
|
||||
// 创建请求体
|
||||
var payload = new
|
||||
{
|
||||
msg_type = "text",
|
||||
content = new
|
||||
{
|
||||
text = at+logMessage
|
||||
}
|
||||
};
|
||||
|
||||
string json = Utility.Json.ToJson(payload);
|
||||
|
||||
using (var content = new StringContent(json, Encoding.UTF8, "application/json"))
|
||||
{
|
||||
HttpResponseMessage response = await httpClient.PostAsync(WebHookKey, content).AsUniTask();
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Failed to send log to server: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 506344a3b774413e85a054a93741fe32
|
||||
timeCreated: 1737461451
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存对象Interface。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class MemoryPool
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存池。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存池对象基类。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存池信息。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存强制检查类型。
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public interface IModule
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static class ModuleSystem
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using AlicizaX.ObjectPool;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 基础组件。
|
||||
@ -138,9 +138,10 @@ namespace AlicizaX.Runtime
|
||||
{
|
||||
_instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
|
||||
Utility.Unity.MakeEntity(transform);
|
||||
|
||||
Log.Init();
|
||||
|
||||
Log.Info("Game Version: {0}, Unity Version: {1}", AppVersion.GameVersion, Application.unityVersion);
|
||||
|
||||
Utility.Converter.ScreenDpi = Screen.dpi;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 变量。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 变量。
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 版本号类。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
[Serializable]
|
||||
public class AppBuilderSetting
|
||||
@ -37,6 +37,6 @@ namespace AlicizaX.Runtime
|
||||
|
||||
public bool DebugMode = false;
|
||||
public int ResMode = 0;
|
||||
public Language Language = Runtime.Language.ChineseSimplified;
|
||||
public Language Language = Language.ChineseSimplified;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 常用设置相关常量。
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 本地化语言。
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AlicizaX;
|
||||
using System;
|
||||
using System.IO;
|
||||
using AlicizaX.Runtime;
|
||||
|
||||
/// <summary>
|
||||
/// 对 BinaryReader 和 BinaryWriter 的扩展方法。
|
||||
|
@ -10,7 +10,7 @@ using System.Buffers;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public ref partial struct SequenceReader<T> where T : unmanaged, IEquatable<T>
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class SequenceReaderExtensions
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用帮助类
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 相机帮助类
|
||||
|
@ -3,7 +3,7 @@ using ICSharpCode.SharpZipLib.GZip;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认压缩解压缩辅助器。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 去重。帮助类
|
||||
|
@ -4,7 +4,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件帮助类
|
||||
|
@ -2,7 +2,7 @@ using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏对象帮助类
|
||||
|
@ -1,7 +1,6 @@
|
||||
using AlicizaX;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 辅助器创建器相关的实用函数。
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 数学帮助类
|
||||
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 网络帮助类
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public static class ObjectHelper
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static class PathHelper
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 坐标帮助类
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 随机数帮助类
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏时间帮助类
|
||||
|
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// Unity 渲染帮助类
|
||||
|
@ -5,7 +5,7 @@ using ICSharpCode.SharpZipLib.Zip;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 压缩帮助类
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using AlicizaX.ObjectPool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
/// <summary>
|
||||
/// 对象池组件。
|
||||
@ -23,7 +23,7 @@ namespace AlicizaX.Runtime
|
||||
_mObjectPoolModule = ModuleSystem.RegisterModule<IObjectPoolModule>(typeof(ObjectPoolModule));
|
||||
if (_mObjectPoolModule == null)
|
||||
{
|
||||
Log.Fatal("Object pool manager is invalid.");
|
||||
Log.Error("Object pool manager is invalid.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AlicizaX.Runtime;
|
||||
using AlicizaX;
|
||||
|
||||
namespace AlicizaX.ObjectPool
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public sealed class BindableProperty<T>
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
|
||||
namespace AlicizaX.Runtime
|
||||
namespace AlicizaX
|
||||
{
|
||||
public static partial class Utility
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user