28 lines
721 B
C#
28 lines
721 B
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater.Utility
|
|
{
|
|
public static class JsonHelper
|
|
{
|
|
public static List<T> LoadJsonData<T>(string jsonFilePath)
|
|
{
|
|
if (File.Exists(jsonFilePath))
|
|
{
|
|
string jsonData = File.ReadAllText(jsonFilePath);
|
|
return JsonConvert.DeserializeObject<List<T>>(jsonData);
|
|
}
|
|
|
|
Debug.LogError("Json 파일을 찾을 수 없습니다.\n" + jsonFilePath);
|
|
return new List<T>();
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class Wrapper<T>
|
|
{
|
|
public List<T> Items;
|
|
}
|
|
}
|
|
} |