mergemilitary/Assets/Scripts/Storage/LevelOnlineData.cs

27 lines
724 B
C#

using System;
using System.Collections.Generic;
using UnityEngine;
using System.Text.RegularExpressions;
[Serializable]
public class LevelOnlineData
{
public string Version;
public List<string> Formations;
public static LevelOnlineData JsonToData(string pJson)
{
LevelOnlineData tData = JsonUtility.FromJson<LevelOnlineData>(pJson);
return tData;
}
public static string DataToJson(LevelOnlineData pData)
{
string tJson = JsonUtility.ToJson(pData);
Regex tReg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
tJson = tReg.Replace(tJson, delegate (Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
return tJson;
}
}