mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 17:34:36 +08:00
update debug utils
This commit is contained in:
parent
de2a0d43ac
commit
12e58ef273
@ -1,5 +1,6 @@
|
||||
using DCFApixels.DragonECS.Internal;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@ -134,6 +135,19 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
|
||||
protected static string AutoConvertObjectToString(object o)
|
||||
{
|
||||
if (o is string str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
if (o is IEnumerable enumerable)
|
||||
{
|
||||
return string.Join(", ", enumerable.Cast<object>());
|
||||
}
|
||||
return o.ToString();
|
||||
}
|
||||
|
||||
public readonly struct MarkerInfo
|
||||
{
|
||||
public readonly string Name;
|
||||
@ -281,7 +295,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (string.IsNullOrEmpty(tag))
|
||||
{
|
||||
Console.WriteLine(v);
|
||||
Console.WriteLine(AutoConvertObjectToString(v));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -298,7 +312,7 @@ namespace DCFApixels.DragonECS
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"[{tag}] {v}");
|
||||
Console.WriteLine($"[{tag}] {AutoConvertObjectToString(v)}");
|
||||
Console.ForegroundColor = color;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace DCFApixels.DragonECS
|
||||
return AutoToString(self, typeof(T), isWriteName);
|
||||
}
|
||||
|
||||
private static string AutoToString(object target, Type type, bool isWriteName)
|
||||
internal static string AutoToString(object target, Type type, bool isWriteName)
|
||||
{
|
||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||
#pragma warning disable IL2070 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations.
|
||||
|
Loading…
Reference in New Issue
Block a user