SDKConfigTranslation.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace SC.XR.Unity
  5. {
  6. public class SDKConfigTranslation : MonoBehaviour
  7. {
  8. private static SDKConfigTranslation mInstance;
  9. public static SDKConfigTranslation getInstance
  10. {
  11. get
  12. {
  13. if (mInstance == null)
  14. {
  15. mInstance = new GameObject("SDKConfigurationAsset").AddComponent<SDKConfigTranslation>();
  16. }
  17. return mInstance;
  18. }
  19. }
  20. SDKConfiguration SDKConfiguration;
  21. public List<Section> Configs;
  22. private void Awake()
  23. {
  24. Configs = new List<Section>();
  25. if (SDKConfiguration == null)
  26. {
  27. SDKConfiguration = Resources.Load<SDKConfiguration>("SDKConfiguration");
  28. DebugMy.Log("Load SDKConfiguration!", this, true);
  29. if (SDKConfiguration == null)
  30. {
  31. DebugMy.Log("SDKConfiguration Not Exist !", this, true);
  32. }
  33. }
  34. if (SDKConfiguration)
  35. {
  36. Configs.Add(new Section()
  37. {
  38. section = "Module_InputSystem",
  39. KEY_VALUE = new List<KEY_VALUE>(){
  40. new KEY_VALUE()
  41. {
  42. Name = "ActiveHead",
  43. Value = GetBool(SDKConfiguration.InputSettings.ActivateDevice.Head)
  44. },
  45. new KEY_VALUE()
  46. {
  47. Name = "ActiveGGT26Dof",
  48. Value = GetBool(SDKConfiguration.InputSettings.ActivateDevice.GGT26Dof)
  49. },
  50. new KEY_VALUE()
  51. {
  52. Name = "ActiveBT3Dof",
  53. Value = GetBool(SDKConfiguration.InputSettings.ActivateDevice.BT3Dof)
  54. },
  55. new KEY_VALUE()
  56. {
  57. Name = "ActiveKS",
  58. Value = GetBool(SDKConfiguration.InputSettings.ActivateDevice.KS)
  59. },
  60. new KEY_VALUE()
  61. {
  62. Name = "KSModeSet3Dof",
  63. Value = GetBool(SDKConfiguration.InputSettings.KSModeSet3Dof)
  64. },
  65. new KEY_VALUE()
  66. {
  67. Name = "UseK102Model",
  68. Value = GetBool(SDKConfiguration.InputSettings.UseK102Model)
  69. },
  70. new KEY_VALUE()
  71. {
  72. Name = "GreyHandOffsetX",
  73. Value = SDKConfiguration.InputSettings.HandInputSettings.GreyHandOffset.x.ToString()
  74. },
  75. new KEY_VALUE()
  76. {
  77. Name = "GreyHandOffsetY",
  78. Value = SDKConfiguration.InputSettings.HandInputSettings.GreyHandOffset.y.ToString()
  79. },
  80. new KEY_VALUE()
  81. {
  82. Name = "GreyHandOffsetZ",
  83. Value = SDKConfiguration.InputSettings.HandInputSettings.GreyHandOffset.z.ToString()
  84. },
  85. new KEY_VALUE()
  86. {
  87. Name = "K102PointerAngleOffsetX",
  88. Value = SDKConfiguration.InputSettings.K102PointerAngleOffset.x.ToString()
  89. },
  90. new KEY_VALUE()
  91. {
  92. Name = "K102PointerAngleOffsetY",
  93. Value = SDKConfiguration.InputSettings.K102PointerAngleOffset.y.ToString()
  94. },
  95. new KEY_VALUE()
  96. {
  97. Name = "K102PointerAngleOffsetZ",
  98. Value = SDKConfiguration.InputSettings.K102PointerAngleOffset.z.ToString()
  99. },
  100. new KEY_VALUE()
  101. {
  102. Name = "FarPointerRotationOffsetX",
  103. Value = SDKConfiguration.InputSettings.HandInputSettings.FarPointerRotationOffset.x.ToString()
  104. },
  105. new KEY_VALUE()
  106. {
  107. Name = "FarPointerRotationOffsetY",
  108. Value = SDKConfiguration.InputSettings.HandInputSettings.FarPointerRotationOffset.y.ToString()
  109. },
  110. new KEY_VALUE()
  111. {
  112. Name = "FarPointerRotationOffsetZ",
  113. Value = SDKConfiguration.InputSettings.HandInputSettings.FarPointerRotationOffset.z.ToString()
  114. },
  115. new KEY_VALUE()
  116. {
  117. Name = "GGT26DofHandDataLerp",
  118. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.HandDataLerp)
  119. },
  120. new KEY_VALUE()
  121. {
  122. Name = "GGT26DofHandEffectColor",
  123. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.HandEffectColor)
  124. },
  125. new KEY_VALUE()
  126. {
  127. Name = "K11_Left_EnterKeyAlias",
  128. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Left_Enter.ToString()
  129. },
  130. new KEY_VALUE()
  131. {
  132. Name = "K11_Right_EnterKeyAlias",
  133. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Right_Enter.ToString()
  134. },
  135. new KEY_VALUE()
  136. {
  137. Name = "K101_Left_EnterKeyAlias",
  138. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K101_Left_Enter.ToString()
  139. },
  140. new KEY_VALUE()
  141. {
  142. Name = "K101_Right_EnterKeyAlias",
  143. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K101_Right_Enter.ToString()
  144. },
  145. new KEY_VALUE()
  146. {
  147. Name = "K102_Left_EnterKeyAlias",
  148. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K102_Left_Enter.ToString()
  149. },
  150. new KEY_VALUE()
  151. {
  152. Name = "K102_Right_EnterKeyAlias",
  153. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K102_Right_Enter.ToString()
  154. },
  155. new KEY_VALUE()
  156. {
  157. Name = "K101_Left_CalibrationKeyAlias",
  158. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K101_Left_Calibration.ToString()
  159. },
  160. new KEY_VALUE()
  161. {
  162. Name = "K101_Right_CalibrationKeyAlias",
  163. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K101_Right_Calibration.ToString()
  164. },
  165. new KEY_VALUE()
  166. {
  167. Name = "K102_Left_CalibrationKeyAlias",
  168. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K102_Left_Calibration.ToString()
  169. },
  170. new KEY_VALUE()
  171. {
  172. Name = "K102_Right_CalibrationKeyAlias",
  173. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K102_Right_Calibration.ToString()
  174. },
  175. new KEY_VALUE()
  176. {
  177. Name = "K11_Left_CalibrationKeyAlias",
  178. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Left_Calibration.ToString()
  179. },
  180. new KEY_VALUE()
  181. {
  182. Name = "K11_Right_CalibrationKeyAlias",
  183. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Right_Calibration.ToString()
  184. },
  185. new KEY_VALUE()
  186. {
  187. Name = "K11_Left_AnotherEnterKeyAlias",
  188. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Left_AnotherEnter.ToString()
  189. },
  190. new KEY_VALUE()
  191. {
  192. Name = "K11_Right_AnotherEnterKeyAlias",
  193. Value = SDKConfiguration.InputSettings.KeyAliasSettings.K11_Right_AnotherEnter.ToString()
  194. },
  195. new KEY_VALUE()
  196. {
  197. Name = "ISGCPriorityGGT26Dof",
  198. Value = GetBool(SDKConfiguration.InputSettings.IsGCPriorityGGT26Dof)
  199. },
  200. new KEY_VALUE()
  201. {
  202. Name = "ShowHandLowPower",
  203. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.ShowHandLowPower)
  204. },
  205. new KEY_VALUE()
  206. {
  207. Name = "ShowHandCursor",
  208. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.ShowHandCursor)
  209. },
  210. new KEY_VALUE()
  211. {
  212. Name = "ShowHandLine",
  213. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.ShowHandLine)
  214. },
  215. new KEY_VALUE()
  216. {
  217. Name = "OutCameraShowHandLine",
  218. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.OutCameraShowHandLine)
  219. },
  220. new KEY_VALUE()
  221. {
  222. Name = "ShowHandRender",
  223. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.ShowHandRender)
  224. },
  225. new KEY_VALUE()
  226. {
  227. Name = "HandRenderEMISSIONIntensity",
  228. Value = SDKConfiguration.InputSettings.HandInputSettings.HandRenderEmissionIntensity.ToString()
  229. },
  230. new KEY_VALUE()
  231. {
  232. Name = "HandModelType",
  233. Value = SDKConfiguration.InputSettings.HandInputSettings.HandModelType.ToString()
  234. },
  235. new KEY_VALUE()
  236. {
  237. Name = "handMainColorR",
  238. Value = SDKConfiguration.InputSettings.HandInputSettings.HandMainColor.r.ToString()
  239. },
  240. new KEY_VALUE()
  241. {
  242. Name = "handMainColorG",
  243. Value = SDKConfiguration.InputSettings.HandInputSettings.HandMainColor.g.ToString()
  244. },
  245. new KEY_VALUE()
  246. {
  247. Name = "handMainColorB",
  248. Value = SDKConfiguration.InputSettings.HandInputSettings.HandMainColor.b.ToString()
  249. },
  250. new KEY_VALUE()
  251. {
  252. Name = "handMainColorA",
  253. Value = SDKConfiguration.InputSettings.HandInputSettings.HandMainColor.a.ToString()
  254. },
  255. new KEY_VALUE()
  256. {
  257. Name = "EnableHandFarInteraction",
  258. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.EnableHandFarInteraction)
  259. },
  260. new KEY_VALUE()
  261. {
  262. Name = "EnableHandTouchInteraction",
  263. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.EnableHandTouchInteraction)
  264. },
  265. new KEY_VALUE()
  266. {
  267. Name = "EnableHandGrabInteraction",
  268. Value = GetBool(SDKConfiguration.InputSettings.HandInputSettings.EnableHandGrabInteraction)
  269. },
  270. new KEY_VALUE()
  271. {
  272. Name = "EnableK102HandAnimation",
  273. Value = GetBool(SDKConfiguration.InputSettings.EnableK102HandAnimation)
  274. },
  275. new KEY_VALUE()
  276. {
  277. Name = "KS_ShowLog",
  278. Value = GetBool(SDKConfiguration.InputSettings.KS_ShowLog)
  279. },
  280. new KEY_VALUE()
  281. {
  282. Name = "ShowDebugLog",
  283. Value = GetBool(SDKConfiguration.InputSettings.ShowDebugLog)
  284. },
  285. }
  286. });
  287. Configs.Add(new Section()
  288. {
  289. section = "Module_Slam",
  290. KEY_VALUE = new List<KEY_VALUE>(){
  291. new KEY_VALUE()
  292. {
  293. Name = "IsUseOpticsCalibration",
  294. Value = GetBool(SDKConfiguration.SlamSettings.UseOpticsCalibration)
  295. },
  296. new KEY_VALUE()
  297. {
  298. Name = "trackPositionScale",
  299. Value = SDKConfiguration.SlamSettings.trackPositionScale.ToString()
  300. },
  301. new KEY_VALUE()
  302. {
  303. Name = "IsSlamUse3Dof",
  304. Value = GetBool(SDKConfiguration.SlamSettings.SlamUse3Dof)
  305. },
  306. new KEY_VALUE()
  307. {
  308. Name = "LeftShoulderX",
  309. Value = SDKConfiguration.SlamSettings.LeftShoulder.x.ToString()
  310. },
  311. new KEY_VALUE()
  312. {
  313. Name = "LeftShoulderY",
  314. Value = SDKConfiguration.SlamSettings.LeftShoulder.y.ToString()
  315. },
  316. new KEY_VALUE()
  317. {
  318. Name = "LeftShoulderZ",
  319. Value = SDKConfiguration.SlamSettings.LeftShoulder.z.ToString()
  320. },
  321. new KEY_VALUE()
  322. {
  323. Name = "IsCreateDepthRT",
  324. Value = GetBool(SDKConfiguration.SlamSettings.CreateDepthRT)
  325. },
  326. new KEY_VALUE()
  327. {
  328. Name = "isUseSingleView",
  329. Value = GetBool(SDKConfiguration.SlamSettings.UseSingleView)
  330. },
  331. }}) ;
  332. Configs.Add(new Section()
  333. {
  334. section = "Module_DetectorSystem",
  335. KEY_VALUE = new List<KEY_VALUE>(){
  336. new KEY_VALUE()
  337. {
  338. Name = "ActiveBatteryDetector",
  339. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.Battery)
  340. },
  341. new KEY_VALUE()
  342. {
  343. Name = "ActiveLanguageDetector",
  344. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.Language)
  345. },
  346. new KEY_VALUE()
  347. {
  348. Name = "ActiveNoNetworkDetector",
  349. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.NoNetwork)
  350. },
  351. new KEY_VALUE()
  352. {
  353. Name = "ActiveNoticeDetector",
  354. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.Notice)
  355. },
  356. new KEY_VALUE()
  357. {
  358. Name = "ActiveRecorderDetector",
  359. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.Recorder)
  360. },
  361. new KEY_VALUE()
  362. {
  363. Name = "ActiveVolumeDetector",
  364. Value = GetBool(SDKConfiguration.DetectorSettings.ActivateDetector.Volume)
  365. }
  366. }
  367. });
  368. Configs.Add(new Section()
  369. {
  370. section = "Module_QuitApp",
  371. KEY_VALUE = new List<KEY_VALUE>(){
  372. new KEY_VALUE()
  373. {
  374. Name = "UseQuitKeyCodeList",
  375. Value = GetBool(SDKConfiguration.QuitAppSettings.UseQuitKeyCodeList)
  376. },
  377. new KEY_VALUE()
  378. {
  379. Name = "UseLongPress",
  380. Value = GetBool(SDKConfiguration.QuitAppSettings.UseLongPress)
  381. }
  382. }});
  383. Configs.Add(new Section()
  384. {
  385. section = "Module_SDKSystem",
  386. KEY_VALUE = new List<KEY_VALUE>(){
  387. new KEY_VALUE()
  388. {
  389. Name = "IsUseSafetyAreaHeight",
  390. Value = GetBool(SDKConfiguration.SDKSystemSettings.UseSafetyAreaHeight)
  391. },
  392. new KEY_VALUE()
  393. {
  394. Name = "IsDontDestroyOnLoad",
  395. Value = GetBool(SDKConfiguration.SDKSystemSettings.IsDontDestroyOnLoad)
  396. }
  397. }
  398. });
  399. }
  400. }
  401. private string GetBool(bool value)
  402. {
  403. if (value == true)
  404. {
  405. return "1";
  406. }
  407. else return "0";
  408. }
  409. }
  410. }