mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update
Update
This commit is contained in:
9
Assets/GameScripts/DotNet/Logic/Config~/Core/BeanBase.cs
Normal file
9
Assets/GameScripts/DotNet/Logic/Config~/Core/BeanBase.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Bright.Serialization;
|
||||
|
||||
namespace Bright.Config
|
||||
{
|
||||
public abstract class BeanBase : ITypeId
|
||||
{
|
||||
public abstract int GetTypeId();
|
||||
}
|
||||
}
|
1545
Assets/GameScripts/DotNet/Logic/Config~/Core/ByteBuf.cs
Normal file
1545
Assets/GameScripts/DotNet/Logic/Config~/Core/ByteBuf.cs
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/GameScripts/DotNet/Logic/Config~/Core/ITypeId.cs
Normal file
7
Assets/GameScripts/DotNet/Logic/Config~/Core/ITypeId.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Bright.Serialization
|
||||
{
|
||||
public interface ITypeId
|
||||
{
|
||||
int GetTypeId();
|
||||
}
|
||||
}
|
52
Assets/GameScripts/DotNet/Logic/Config~/Core/StringUtil.cs
Normal file
52
Assets/GameScripts/DotNet/Logic/Config~/Core/StringUtil.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Bright.Common
|
||||
{
|
||||
public static class StringUtil
|
||||
{
|
||||
public static string ToStr(object o)
|
||||
{
|
||||
return ToStr(o, new StringBuilder());
|
||||
}
|
||||
|
||||
public static string ToStr(object o, StringBuilder sb)
|
||||
{
|
||||
foreach (var p in o.GetType().GetFields())
|
||||
{
|
||||
|
||||
sb.Append($"{p.Name} = {p.GetValue(o)},");
|
||||
}
|
||||
|
||||
foreach (var p in o.GetType().GetProperties())
|
||||
{
|
||||
sb.Append($"{p.Name} = {p.GetValue(o)},");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string ArrayToString<T>(T[] arr)
|
||||
{
|
||||
return "[" + string.Join(",", arr) + "]";
|
||||
}
|
||||
|
||||
|
||||
public static string CollectionToString<T>(IEnumerable<T> arr)
|
||||
{
|
||||
return "[" + string.Join(",", arr) + "]";
|
||||
}
|
||||
|
||||
|
||||
public static string CollectionToString<TK, TV>(IDictionary<TK, TV> dic)
|
||||
{
|
||||
var sb = new StringBuilder('{');
|
||||
foreach (var e in dic)
|
||||
{
|
||||
sb.Append(e.Key).Append(':');
|
||||
sb.Append(e.Value).Append(',');
|
||||
}
|
||||
sb.Append('}');
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user