59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
using Newtonsoft.Json;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using static UVC.Util.WindowTools;
|
|
|
|
namespace SampleProject.Config
|
|
{
|
|
/// <summary>
|
|
/// 애플리케이션의 설정을 관리하는 클래스입니다. AppConfig.json 파일에서 설정을 로드합니다.
|
|
/// </summary>
|
|
public class AppConfig
|
|
{
|
|
/// <summary>
|
|
/// 로드된 애플리케이션 설정을 담고 있는 정적 인스턴스입니다.
|
|
/// </summary>
|
|
public static AppConfig Config { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Windows 런타임 환경에서 StreamingAssets 폴더의 AppConfig.json 파일로부터 설정을 로드합니다.
|
|
/// </summary>
|
|
/// <returns>설정 로드 성공 여부를 반환합니다.</returns>
|
|
public static bool LoadConfig()
|
|
{
|
|
string path = Path.Combine(Application.streamingAssetsPath, "AppConfig.json");
|
|
if (File.Exists(path))
|
|
{
|
|
string json = File.ReadAllText(path);
|
|
Config = JsonConvert.DeserializeObject<AppConfig>(json);
|
|
Debug.Log($"AppConfig loaded from {path}");
|
|
return Config != null;
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError($"File not found: {path}");
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 애플리케이션의 언어 설정입니다.
|
|
/// </summary>
|
|
[JsonProperty("language")]
|
|
public string Language { get; set; }
|
|
|
|
/// <summary>
|
|
/// 목표 프레임 레이트 설정입니다.
|
|
/// </summary>
|
|
[JsonProperty("targetFrameRate")]
|
|
public int TargetFrameRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 애플리케이션의 창 관련 설정입니다.
|
|
/// </summary>
|
|
[JsonProperty("window")]
|
|
public WindowInfoData Window { get; set; }
|
|
}
|
|
}
|