VoiceSDKStyles.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * Licensed under the Oculus SDK License Agreement (the "License");
  6. * you may not use the Oculus SDK except in compliance with the License,
  7. * which is provided at the time of installation or download, or which
  8. * otherwise accompanies this software in either electronic or hard copy form.
  9. *
  10. * You may obtain a copy of the License at
  11. *
  12. * https://developer.oculus.com/licenses/oculussdk/
  13. *
  14. * Unless required by applicable law or agreed to in writing, the Oculus SDK
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. using System;
  21. using UnityEngine;
  22. using Meta.WitAi;
  23. namespace Oculus.Voice.Utility
  24. {
  25. public static class VoiceSDKStyles
  26. {
  27. [Serializable]
  28. public struct VoiceSDKTexts
  29. {
  30. [Header("Setup Texts")]
  31. public string SetupTitleLabel;
  32. public string SetupHeaderLabel;
  33. public string SetupSubheaderLabel;
  34. public string SetupLanguageLabel;
  35. public string VoiceDocsUrl;
  36. [Header("About Texts")]
  37. public string AboutTitleLabel;
  38. public string AboutCloseLabel;
  39. public string AboutVoiceSdkVersionLabel;
  40. public string AboutWitSdkVersionLabel;
  41. public string AboutWitApiVersionLabel;
  42. public string AboutTutorialButtonLabel;
  43. public string AboutTutorialButtonUrl;
  44. [Header("Settings Texts")]
  45. public string SettingsTitleLabel;
  46. [Header("Understanding Viewer Texts")]
  47. public string UnderstandingViewerTitleLabel;
  48. [Header("Built-In Texts")]
  49. public string BuiltInAppBtnLabel;
  50. public string BuiltInAppUrl;
  51. }
  52. public static VoiceSDKTexts Texts;
  53. public static Texture2D MainHeader;
  54. public static GUIContent SetupTitle;
  55. public static GUIContent AboutTitle;
  56. public static GUIContent SettingsTitle;
  57. public static GUIContent UnderstandingTitle;
  58. static VoiceSDKStyles()
  59. {
  60. // Load localization
  61. string languageID = "en-us";
  62. string textFilePath = $"voicesdk_texts_{languageID}";
  63. TextAsset textAsset = Resources.Load<TextAsset>(textFilePath);
  64. if (textAsset == null)
  65. {
  66. VLog.E($"VoiceSDK Texts - Add localization to Resources/{textFilePath}\nLanguage: {languageID}");
  67. return;
  68. }
  69. Texts = JsonUtility.FromJson<VoiceSDKTexts>(textAsset.text);
  70. MainHeader = (Texture2D) Resources.Load("voicesdk_heroart");
  71. SetupTitle = new GUIContent(Texts.SetupTitleLabel);
  72. AboutTitle = new GUIContent(Texts.AboutTitleLabel);
  73. SettingsTitle = new GUIContent(Texts.SettingsTitleLabel);
  74. UnderstandingTitle = new GUIContent(Texts.UnderstandingViewerTitleLabel);
  75. }
  76. }
  77. }