SettingsWindow.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 Meta.Voice.Hub;
  21. using Meta.Voice.Hub.Attributes;
  22. using Meta.Voice.Hub.Interfaces;
  23. using Meta.Voice.VSDKHub;
  24. using Meta.WitAi;
  25. using Meta.WitAi.Windows;
  26. using Oculus.Voice.Utility;
  27. using Oculus.Voice.Windows;
  28. using UnityEngine;
  29. namespace Meta.Voice.Windows
  30. {
  31. public class SettingsWindow : WitWindow
  32. {
  33. protected override GUIContent Title => new GUIContent(VoiceSDKStyles.SettingsTitle.text);
  34. protected override Texture2D HeaderIcon => VoiceSDKStyles.MainHeader;
  35. protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
  36. protected override void OnEnable()
  37. {
  38. WitAuthUtility.tokenValidator = new VoiceSDKTokenValidatorProvider();
  39. titleContent = Title;
  40. base.OnEnable();
  41. }
  42. }
  43. [MetaHubPage("Wit Configurations", VoiceHubConstants.CONTEXT_VOICE, priority: 500)]
  44. public class WitConfigWindowPage : SettingsWindow, IMetaHubPage
  45. {
  46. protected override GUIContent Title => new GUIContent("Wit Configurations");
  47. protected override Texture2D HeaderIcon => null;
  48. protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
  49. public override bool ShowGeneralSettings => false;
  50. protected override void OnEnable()
  51. {
  52. base.OnEnable();
  53. titleContent = Title;
  54. }
  55. public new void OnGUI()
  56. {
  57. base.OnGUI();
  58. }
  59. public override string ToString()
  60. {
  61. return Title.text;
  62. }
  63. }
  64. [MetaHubPage("Settings", VoiceHubConstants.CONTEXT_VOICE, priority: 800)]
  65. public class SettingsWindowPage : SettingsWindow, IMetaHubPage
  66. {
  67. protected override GUIContent Title => new GUIContent("Settings");
  68. protected override Texture2D HeaderIcon => null;
  69. protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
  70. public override bool ShowWitConfiguration => false;
  71. protected override void OnEnable()
  72. {
  73. base.OnEnable();
  74. titleContent = Title;
  75. }
  76. public new void OnGUI()
  77. {
  78. base.OnGUI();
  79. }
  80. }
  81. }