using SC.XR.Unity; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace SC.XR.Unity { public class SDKGlobalConfigTranslation : MonoBehaviour { private static SDKGlobalConfigTranslation mInstance; public static SDKGlobalConfigTranslation getInstance { get { if (mInstance == null) { mInstance = new GameObject("SDKGlobalConfigurationAsset").AddComponent(); } return mInstance; } } SDKGlobalConfiguration SDKGlobalConfiguration; public List
Configs; private void Awake() { Configs = new List
(); if (SDKGlobalConfiguration == null) { SDKGlobalConfiguration = Resources.Load("SDKGlobalConfiguration"); DebugMy.Log("Load SDKGlobalConfiguration!", this, true); if (SDKGlobalConfiguration == null) { DebugMy.Log("SDKGlobalConfiguration Not Exist !", this, true); } } if (SDKGlobalConfiguration) { Configs.Add(new Section() { section = "RecorderDetector", KEY_VALUE = new List(){ new KEY_VALUE() { Name = "IsRecording", Value = GetBool(SDKGlobalConfiguration.RecorderDetectorSettings.IsRecording) } } }); Configs.Add(new Section() { section = "BatteryDetector", KEY_VALUE = new List(){ new KEY_VALUE() { Name = "IsCharging", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsCharging) }, new KEY_VALUE() { Name = "Under20", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.Under20) }, new KEY_VALUE() { Name = "Under15", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.Under15) }, new KEY_VALUE() { Name = "Under10", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.Under10) }, new KEY_VALUE() { Name = "Under5", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.Under5) }, new KEY_VALUE() { Name = "Under1", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.Under1) }, new KEY_VALUE() { Name = "IsRightConnect", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsRightConnect) }, new KEY_VALUE() { Name = "IsRightUnconnecting", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsRightUnconnecting) }, new KEY_VALUE() { Name = "IsRightLow", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsRightLow) }, new KEY_VALUE() { Name = "IsLeftConnect", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsLeftConnect) }, new KEY_VALUE() { Name = "IsLeftUnconnecting", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsLeftUnconnecting) }, new KEY_VALUE() { Name = "IsLeftLow", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsLeftLow) }, new KEY_VALUE() { Name = "IsHandTracking", Value = GetBool(SDKGlobalConfiguration.BatteryDetectorSettings.IsHandTracking) } } }); Configs.Add(new Section() { section = "Module_SafetyArea", KEY_VALUE = new List(){ new KEY_VALUE() { Name = "Height", Value = SDKGlobalConfiguration.SafetyAreaSettings.SafetyAreaHeight.ToString() }, } }) ; } } private string GetBool(bool value) { if (value == true) { return "1"; } else return "0"; } private string GetList(string[] list) { string result = "[\""+String.Join("\",\"", list)+"\"]"; return result; } private string IfInRange(int min, int max,int num) { if ((num > min) && (num <= max)) { return "1"; } else return "0"; } } }