using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using System.IO;
public static class Tools {
static StreamWriter mStreamWriter;
static StreamReader mStreamReader;
static FileInfo file;
//读取Json
public static List<T> JsonRead<T>(ref T tmp, string Path)
{
// Resourcesconservation mRe;
string[] mGroup;
StreamReader stream = new StreamReader(Path);
mGroup = stream.ReadToEnd().Split('\n');
List<T> tmps = new List<T>();
for (int i = 0; i < mGroup.Length - 1; i++)
{
tmps.Add(JsonUtility.FromJson<T>(mGroup[i]));
}
CloseRead(stream);
return tmps;
}
//写入Json
public static void JsonWrite<T>(ref T tmp, string Path)
{
Debug.Log(tmp + " " + Path);
file = new FileInfo(Path);
string json = JsonUtility.ToJson(tmp);
mStreamWriter = file.CreateText();
mStreamWriter.WriteLine(json);
Close();
}
static void Close()
{
mStreamWriter.Close();
mStreamWriter.Dispose();
}
static void CloseRead(StreamReader stream)
{
stream.Close();
stream.Dispose();
}
using UnityEngine;
using System.Collections;
usin