using LitJson;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AllTool : MonoBehaviour
{
///
/// 获取当前时间戳
///
///
public static long GetTimeStamp()
{
return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
}
///
/// Json 解析
///
///
///
public static Root ToJsonData(String message)
{
try
{
JsonData json = JsonMapper.ToObject(message);
JsonData data = json["projectinfo"]["navLines"];
message = data.ToJson();
//message = message.Substring(1, message.Length - 1);
message = "{\"navLines\":" + message + "}";
Debug.Log(message);
Root root = JsonMapper.ToObject(message);
Debug.Log(root.navLines.Count);
return root;
}
catch (Exception)
{
Debug.LogError("Json 传入格式不正确 无法解析");
return null;
}
}
}