29 lines
882 B
C#
29 lines
882 B
C#
using Newtonsoft.Json;
|
|
using UnityEngine;
|
|
using Octopus.Simulator.Networks;
|
|
|
|
namespace UVC.Networks
|
|
{
|
|
public class ApiConfigLoader
|
|
{
|
|
public APIEndPointsConfig ApiConfig { get; private set; }
|
|
|
|
public APIEndPointsConfig LoadFromResources(string resourcePath)
|
|
{
|
|
TextAsset jsonAsset = Resources.Load<TextAsset>(resourcePath);
|
|
if (jsonAsset == null)
|
|
{
|
|
Debug.LogError($"ApiConfig 리소스를 찾을 수 없습니다: {resourcePath}");
|
|
return null;
|
|
}
|
|
ApiConfig = JsonConvert.DeserializeObject<APIEndPointsConfig>(jsonAsset.text);
|
|
return ApiConfig;
|
|
}
|
|
|
|
public APIEndPointsConfig LoadFromJsonString(string json)
|
|
{
|
|
ApiConfig = JsonConvert.DeserializeObject<APIEndPointsConfig>(json);
|
|
return ApiConfig;
|
|
}
|
|
}
|
|
} |