update: 修复 ABTest 解析报错的问题

feature/Inventory
胡宇飞 2024-01-30 14:59:00 +08:00
parent dfd4b633b7
commit c0936f094e
1 changed files with 22 additions and 1 deletions

View File

@ -93,6 +93,27 @@ namespace Guru
} }
#endregion #endregion
#region 单元测试
public static void TestConfig(string json)
{
var p = ABParamData.Parse(json);
if (p == null)
{
Debug.LogError($"Could not parse config: {json}");
return;
}
if (!string.IsNullOrEmpty(p.group))
{
Debug.Log($"ID: <color=#88ff00>{p.id}</color>");
Debug.Log($"Group: <color=#88ff00>{p.group}</color>");
Debug.Log($"Value: <color=#88ff00>{p.value}</color>");
}
}
#endregion
} }
[Serializable] [Serializable]
@ -111,7 +132,7 @@ namespace Guru
p.value = value; p.value = value;
// 发现Guru AB测试标志位 // 发现Guru AB测试标志位
var dict = JsonMapper.ToObject<Dictionary<string, object>>(value); var dict = JsonMapper.ToObject<Dictionary<string, JsonData>>(value);
if (null != dict) if (null != dict)
{ {
foreach (var k in dict.Keys) foreach (var k in dict.Keys)