Files
daluandou/.codely.packages/cn.tuanjie.codely.bridge@1.0.85-785dea6a/Editor/Bridge/Helpers/JsonCommandHelper.cs
T
huadexuan c09e15dd0e ```
feat(Materials): 更新CoreBattleGround材质贴图和缩放参数

更换了CoreBattleGround材质的主纹理,将纹理GUID从73e4d6cf089824c0cadfcefa5b15d306
更新为c6af6f473739fb546ac7775e5c957da1,并调整纹理缩放参数从{x: 3, y: 4}修改为
{x: 1, y: 1},同时移除了多余的_MetallicGlossMap配置项。
```
2026-09-28 17:58:15 +08:00

72 lines
2.0 KiB
C#

using System;
using System.Linq;
using Codely.Newtonsoft.Json.Linq;
namespace UnityTcp.Editor.Helpers
{
/// <summary>
/// Helper class for JSON command processing utilities
/// </summary>
public static class JsonCommandHelper
{
/// <summary>
/// Helper method to check if a string is valid JSON
/// </summary>
public static bool IsValidJson(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return false;
}
text = text.Trim();
if (
(text.StartsWith("{") && text.EndsWith("}"))
|| // Object
(text.StartsWith("[") && text.EndsWith("]"))
) // Array
{
try
{
JToken.Parse(text);
return true;
}
catch
{
return false;
}
}
return false;
}
/// <summary>
/// Helper method to get a summary of parameters for error reporting
/// </summary>
public static string GetParamsSummary(JObject @params)
{
try
{
return @params == null || !@params.HasValues
? "No parameters"
: string.Join(
", ",
@params
.Properties()
.Select(p =>
{
string s = p.Value?.ToString();
if (s == null) return $"{p.Name}: ";
int take = Math.Min(20, s.Length);
return $"{p.Name}: {s.Substring(0, take)}";
})
);
}
catch
{
return "Could not summarize parameters";
}
}
}
}