using Newtonsoft.Json; using System.IO; using UnityEngine; using static UVC.Util.WindowTools; namespace Factory.Config { /// /// 애플리케이션의 설정을 관리하는 클래스입니다. AppConfig.json 파일에서 설정을 로드합니다. /// public class FactoryAppConfig { /// /// 로드된 애플리케이션 설정을 담고 있는 정적 인스턴스입니다. /// public static FactoryAppConfig Config { get; private set; } /// /// Windows 런타임 환경에서 StreamingAssets 폴더의 AppConfig.json 파일로부터 설정을 로드합니다. /// /// 설정 로드 성공 여부를 반환합니다. public static bool LoadConfig() { string path = Path.Combine(Application.streamingAssetsPath, "FactoryAppConfig.json"); if (File.Exists(path)) { string json = File.ReadAllText(path); Config = JsonConvert.DeserializeObject(json); Debug.Log($"AppConfig loaded from {path}"); return Config != null; } else { Debug.LogError($"File not found: {path}"); } return false; } /// /// 애플리케이션의 언어 설정입니다. /// [JsonProperty("language")] public string Language { get; set; } /// /// 목표 프레임 레이트 설정입니다. /// [JsonProperty("targetFrameRate")] public int TargetFrameRate { get; set; } /// /// 애플리케이션의 창 관련 설정입니다. /// [JsonProperty("window")] public WindowInfoData Window { get; set; } /// /// API 도메인 설정입니다. /// [JsonProperty("api")] public string Api { get; set; } /// /// Mqtt 도메인 설정입니다. /// [JsonProperty("mqtt")] public MQTTConfig Mqtt { get; set; } } public class MQTTConfig { /// /// MQTT 도메인 설정입니다. /// [JsonProperty("host")] public string Domain { get; set; } /// /// MQTT 포트 설정입니다. /// [JsonProperty("port")] public int Port { get; set; } /// /// MQTT JSON에서 데이터를 가지고 있는 키입니다. /// [JsonProperty("dataKey")] public string DataKey { get; set; } /// /// MQTT MessagePack 디코딩 사용할지 설정입니다. /// [JsonProperty("messagePack")] public bool MessagePack { get; set; } } }