clean project

This commit is contained in:
Helar Jaadla
2022-03-07 17:52:41 +02:00
parent a174b45bd2
commit cbeb10ec35
5100 changed files with 837159 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3c9058da2dd553e4e8cc1a664ea5bc0d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9b850b590def934d88d46d5f230177b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,68 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using System;
using Facebook.WitAi;
using Facebook.WitAi.Configuration;
using Facebook.WitAi.Data;
using Facebook.WitAi.Data.Configuration;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Data
{
[Serializable]
public class VoiceSDKDataCreation
{
[MenuItem("Assets/Create/Voice SDK/Add App Voice Experience to Scene")]
public static void AddVoiceCommandServiceToScene()
{
var witGo = new GameObject();
witGo.name = "App Voice Experience";
var wit = witGo.AddComponent<AppVoiceExperience>();
wit.RuntimeConfiguration = new WitRuntimeConfiguration
{
witConfiguration = WitDataCreation.FindDefaultWitConfig()
};
}
[MenuItem("Assets/Create/Voice SDK/Values/String Value")]
public static void WitStringValue()
{
WitDataCreation.CreateStringValue("");
}
[MenuItem("Assets/Create/Voice SDK/Values/Float Value")]
public static void WitFloatValue()
{
WitDataCreation.CreateFloatValue("");
}
public static WitFloatValue CreateFloatValue(string path)
{
return WitDataCreation.CreateFloatValue(path);
}
[MenuItem("Assets/Create/Voice SDK/Values/Int Value")]
public static void WitIntValue()
{
WitDataCreation.CreateStringValue("");
}
[MenuItem("Assets/Create/Voice SDK/Configuration")]
public static void CreateWitConfiguration()
{
WitConfigurationEditor.CreateWitConfiguration(WitAuthUtility.ServerToken, null);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 766b749f675dba94a92bb81ebf699d06
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5e7c523618d37124d82a50597af82815
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi.Inspectors;
using UnityEditor;
namespace Oculus.Voice.Inspectors
{
[CustomEditor(typeof(AppVoiceExperience))]
public class AppVoiceExperienceEditor : WitInspector
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 03744310c46b6e546b2b772e941f8cb2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi.Data.Configuration;
using UnityEditor;
namespace Oculus.Voice.Inspectors
{
[CustomEditor(typeof(WitConfiguration))]
public class AppVoiceExperienceWitConfigurationEditor : WitConfigurationEditor
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81dc8ceb5197487fa6b8f684c40a0a06
timeCreated: 1630651402

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a51109e9358cfd4fa1690bede306b75
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Upgrade
{
[CustomEditor(typeof(Wit), false)]
public class WitUpgrader : Editor
{
class Styles
{
public static GUIContent upgrade = new GUIContent("Upgrade to App Voice Experience",
"This will replace your Wit object with a comparable component from the Voice SDK.");
}
public override void OnInspectorGUI()
{
var wit = (Wit) target;
if (!wit.GetComponent<AppVoiceExperience>())
{
base.OnInspectorGUI();
if (!Application.isPlaying && GUILayout.Button(Styles.upgrade))
{
var voiceService = wit.gameObject.AddComponent<AppVoiceExperience>();
voiceService.events = wit.events;
voiceService.RuntimeConfiguration = wit.RuntimeConfiguration;
var voiceServiceSerializedObject = new SerializedObject(voiceService);
voiceServiceSerializedObject.ApplyModifiedProperties();
DestroyImmediate(wit);
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b6dc5be923e4794fbc03577778257f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c74dbc89a3023bb41b841587da9e9953
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using UnityEngine;
namespace Oculus.Voice.Utility
{
public class VoiceSDKStyles
{
public static Texture2D MainHeader;
static VoiceSDKStyles()
{
MainHeader = (Texture2D) Resources.Load("voicesdk_heroart");
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa1f0af066e824a31875bc815a72cc5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using UnityEngine;
namespace Oculus.Voice.Utility
{
public class VoiceSDKVersion : MonoBehaviour
{
public const string VERSION = "37.0.0.112.109";
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5bf6b7b99e36e104f964fb70253f847c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
{
"name": "VoiceSDK.Editor",
"references": [
"GUID:e545cc0678493234a9368f4e470c29e8",
"GUID:4504b1a6e0fdcc3498c30b266e4a63bf",
"GUID:fa958eb9f0171754fb207d563a15ddfa"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c313d8e945a7904dbf75897c010ac4d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6882087e17a8bbe4c80cf5a6764e6a6b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using System;
using Facebook.WitAi;
using Oculus.Voice.Utility;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Windows
{
public class AboutWindow : VoiceSDKWizardWindow
{
protected override float ContentHeight => EditorGUIUtility.singleLineHeight * 4 + 16 + 100;
[MenuItem("Oculus/Voice SDK/About", false, 200)]
static void CreateWizard()
{
ScriptableWizard.DisplayWizard<AboutWindow>("About Voice SDK", "Close");
}
protected override bool DrawWizardGUI()
{
base.DrawWizardGUI();
GUILayout.Label("Voice SDK Version: " + VoiceSDKVersion.VERSION);
GUILayout.Label("Wit.ai SDK Version: " + WitRequest.WIT_SDK_VERSION);
GUILayout.Label("Wit.ai API Version: " + WitRequest.WIT_API_VERSION);
GUILayout.Space(16);
if (GUILayout.Button("Tutorials"))
{
Application.OpenURL("https://developer.oculus.com/experimental/voice-sdk/tutorial-overview/");
}
return false;
}
private void OnWizardCreate()
{
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: b92c30adebae6ba4f93106d6fa6f4b3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- header: {fileID: 2800000, guid: 41df4ab8a05595e49b2f2d150e753bf7, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,158 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using System;
using Facebook.WitAi;
using Facebook.WitAi.Data.Configuration;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Windows
{
public class SettingsWindow : WitWindow
{
[MenuItem("Oculus/Voice SDK/Settings", false, 100)]
public static void ShowSettingsWindow()
{
if (WitAuthUtility.IsServerTokenValid())
{
GetWindow<SettingsWindow>("Welcome to Voice SDK");
}
else
{
var wizard =
ScriptableWizard.DisplayWizard<WelcomeWizard>("Welcome to Voice SDK", "Link");
wizard.successAction = ShowSettingsWindow;
}
}
protected override void OnEnable()
{
WitAuthUtility.InitEditorTokens();
WitAuthUtility.tokenValidator = new VoiceSDKTokenValidatorProvider();
SetWitEditor();
RefreshConfigList();
}
protected override void SetWitEditor(){
if (witConfiguration)
{
witEditor = (WitConfigurationEditor) Editor.CreateEditor(witConfiguration);
witEditor.drawHeader = false;
witEditor.appDrawer = new VoiceApplicationDetailProvider();
}
}
public static WitConfiguration CreateConfiguration(string serverToken, string language = null, Action onCompleteAction = null)
{
var path = EditorUtility.SaveFilePanel("Create Wit Configuration", Application.dataPath,
"WitConfiguration", "asset");
if (!string.IsNullOrEmpty(path) && path.StartsWith(Application.dataPath))
{
WitConfiguration asset = ScriptableObject.CreateInstance<WitConfiguration>();
if (null == language)
{
asset.FetchAppConfigFromServerToken(serverToken, onCompleteAction);
}
else if (AppBuiltIns.apps.ContainsKey(language))
{
var app = AppBuiltIns.apps[language];
asset.application = new WitApplication();
asset.application.name = app["name"];
asset.application.id = app["id"];
asset.application.lang = app["lang"];
asset.clientAccessToken = app["clientToken"];
onCompleteAction?.Invoke();
}
path = path.Substring(Application.dataPath.Length - 6);
AssetDatabase.CreateAsset(asset, path);
AssetDatabase.SaveAssets();
return asset;
}
return null;
}
protected override void OnDrawContent()
{
DrawWit();
}
protected override void DrawWelcome(){
titleContent = WitStyles.welcomeTitleContent;
if (!welcomeSizeSet)
{
minSize = new Vector2(450, 350);
maxSize = new Vector2(450, 350);
welcomeSizeSet = true;
}
scroll = GUILayout.BeginScrollView(scroll);
GUILayout.Label("Build Natural Language Experiences", WitStyles.LabelHeader);
GUILayout.Label(
"Empower people to use your product with voice and text",
WitStyles.LabelHeader2);
GUILayout.Space(32);
BeginCenter(296);
GUILayout.Label("Select language to use Built-In NLP", WitStyles.Label);
int witBuiltInIndex = -1;
int selected = EditorGUILayout.Popup("", witBuiltInIndex, AppBuiltIns.appNames);
if (selected != witBuiltInIndex)
{
witBuiltInIndex = selected;
WitAuthUtility.ServerToken = AppBuiltIns.builtInPrefix+AppBuiltIns.appNames[witBuiltInIndex];
CreateConfiguration(AppBuiltIns.appNames[witBuiltInIndex]);
RefreshContent();
}
EndCenter();
GUILayout.Space(16);
BeginCenter(296);
GUILayout.BeginHorizontal();
GUILayout.Label("Paste your Server Access Token here", WitStyles.Label);
GUILayout.FlexibleSpace();
if (GUILayout.Button(WitStyles.PasteIcon, WitStyles.Label))
{
serverToken = EditorGUIUtility.systemCopyBuffer;
WitAuthUtility.ServerToken = serverToken;
if (WitAuthUtility.IsServerTokenValid())
{
RefreshContent();
}
}
GUILayout.EndHorizontal();
if (null == serverToken)
{
serverToken = WitAuthUtility.ServerToken;
}
GUILayout.BeginHorizontal();
serverToken = EditorGUILayout.PasswordField(serverToken, WitStyles.TextField);
if (GUILayout.Button("Link", GUILayout.Width(75)))
{
WitAuthUtility.ServerToken = serverToken;
if (WitAuthUtility.IsServerTokenValid())
{
RefreshContent();
}
}
GUILayout.EndHorizontal();
EndCenter();
GUILayout.EndScrollView();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2c810bb2a5bea4e4897c121e3264df3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi;
using Facebook.WitAi.Utilities;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Windows
{
public class UnderstandingViewerWindow : WitUnderstandingViewer
{
[MenuItem("Oculus/Voice SDK/Understanding Viewer", false, 100)]
static void Init()
{
if (witConfigs.Length == 0)
{
RefreshConfigList();
}
if (witConfigs.Length > 0)
{
UnderstandingViewerWindow window = GetWindow(typeof(UnderstandingViewerWindow)) as
UnderstandingViewerWindow;
window.titleContent = new GUIContent("Understanding Viewer");
window.autoRepaintOnSceneChange = true;
window.Show();
}
else
{
var wizard = ScriptableWizard.DisplayWizard<WelcomeWizard>("Welcome to Voice SDK", "Link");
wizard.successAction = Init;
}
}
protected override string HeaderLink
{
get
{
if (null != witConfiguration && null != witConfiguration.application &&
!string.IsNullOrEmpty(witConfiguration.application.id))
{
return $"https://wit.ai/apps/{witConfiguration.application.id}/understanding";
}
return null;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c86fe355d3472b94bbaa52c686a49ddb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using UnityEngine;
using Facebook.WitAi.Data.Configuration;
namespace Oculus.Voice.Windows
{
public class VoiceApplicationDetailProvider : IApplicationDetailProvider
{
public void DrawApplication(WitApplication application)
{
if (string.IsNullOrEmpty(application.name))
{
GUILayout.Label("Loading...");
}
else
{
if (application.id.StartsWith("voice"))
{
InfoField("Name", application.name);
InfoField("Language", application.lang);
}
else
{
InfoField("Name", application.name);
InfoField("ID", application.id);
InfoField("Language", application.lang);
InfoField("Created", application.createdAt);
GUILayout.BeginHorizontal();
GUILayout.Label("Private", GUILayout.Width(100));
GUILayout.Toggle(application.isPrivate, "");
GUILayout.EndHorizontal();
}
}
}
private void InfoField(string name, string value)
{
GUILayout.BeginHorizontal();
GUILayout.Label(name, GUILayout.Width(100));
GUILayout.Label(value, "TextField");
GUILayout.EndHorizontal();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f885966f75e449f6b3912d20c1b85bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Oculus.Voice.Utility;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Windows
{
public class VoiceSDKWizardWindow : ScriptableWizard
{
protected virtual float ContentHeight => 0;
protected virtual float ContentWidth => 415;
protected override bool DrawWizardGUI()
{
var header = VoiceSDKStyles.MainHeader;
var headerHeight = header.height * (ContentWidth - 4) / header.width;
maxSize = new Vector2(ContentWidth, ContentHeight + headerHeight);
minSize = maxSize;
GUILayout.Box(header, GUILayout.Width(ContentWidth - 8), GUILayout.Height(headerHeight));
return false;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 9e81c43e4b4674634a8e8b4e34733945
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- header: {fileID: 2800000, guid: 41df4ab8a05595e49b2f2d150e753bf7, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,163 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using System;
using Facebook.WitAi;
using UnityEditor;
using UnityEngine;
namespace Oculus.Voice.Windows
{
public class WelcomeWizard : VoiceSDKWizardWindow
{
[SerializeField] private string serverToken;
[SerializeField] private int witBuiltInIndex;
protected override float ContentHeight
{
get
{
var height = 250f;
if (witBuiltInIndex <= 0)
{
height += 3 * EditorGUIUtility.singleLineHeight;
}
return height;
}
}
private string[] builtinAppNames;
public Action successAction;
private void OnWizardCreate()
{
if (witBuiltInIndex == 0)
{
WitAuthUtility.ServerToken = serverToken;
}
if (WitAuthUtility.IsServerTokenValid())
{
if (witBuiltInIndex > 0)
{
SettingsWindow.CreateConfiguration(WitAuthUtility.ServerToken,
builtinAppNames[witBuiltInIndex], successAction);
}
else
{
SettingsWindow.CreateConfiguration(WitAuthUtility.ServerToken, null, successAction);
}
Close();
}
else
{
throw new ArgumentException(
"Server token is not valid. Please set a server token.");
}
}
protected virtual void OnEnable()
{
WitAuthUtility.InitEditorTokens();
WitAuthUtility.tokenValidator = new VoiceSDKTokenValidatorProvider();
var names = AppBuiltIns.appNames;
builtinAppNames = new string[names.Length + 1];
builtinAppNames[0] = "Custom App";
for (int i = 0; i < names.Length; i++)
{
builtinAppNames[i + 1] = names[i];
}
}
protected override bool DrawWizardGUI()
{
base.DrawWizardGUI();
GUILayout.BeginHorizontal();
GUILayout.Space(24);
GUILayout.BeginVertical();
GUILayout.Label("Building App Voice Experiences", WitStyles.LabelHeader, GUILayout.Height(64));
GUILayout.Label(
"Empowering developers to build engaging voice interactions.",GUILayout.Height(EditorGUIUtility.singleLineHeight * 2));
GUILayout.EndVertical();
GUILayout.Space(24);
GUILayout.EndHorizontal();
BaseWitWindow.BeginCenter(296);
GUILayout.Label("Select language to use Built-In NLP", WitStyles.Label);
int selected = EditorGUILayout.Popup("", witBuiltInIndex, builtinAppNames);
if (selected != witBuiltInIndex)
{
witBuiltInIndex = selected;
WitAuthUtility.ServerToken =
AppBuiltIns.builtInPrefix + AppBuiltIns.appNames[witBuiltInIndex];
}
BaseWitWindow.EndCenter();
if (witBuiltInIndex <= 0)
{
GUILayout.Space(16);
BaseWitWindow.BeginCenter(296);
GUILayout.BeginHorizontal();
var color = "blue";
if (EditorGUIUtility.isProSkin)
{
color = "#ccccff";
}
if (GUILayout.Button(
$"Paste your <color={color}>Wit.ai</color> Server Access Token here",
WitStyles.Label))
{
Application.OpenURL("https://wit.ai/apps");
}
GUILayout.FlexibleSpace();
if (GUILayout.Button(WitStyles.PasteIcon, WitStyles.Label))
{
serverToken = EditorGUIUtility.systemCopyBuffer;
WitAuthUtility.ServerToken = serverToken;
}
GUILayout.EndHorizontal();
if (null == serverToken)
{
serverToken = WitAuthUtility.ServerToken;
}
serverToken = EditorGUILayout.PasswordField(serverToken);
BaseWitWindow.EndCenter();
}
return WitAuthUtility.IsServerTokenValid();
}
}
public class VoiceSDKTokenValidatorProvider : WitAuthUtility.ITokenValidationProvider
{
public bool IsTokenValid(string appId, string token)
{
return IsServerTokenValid(token);
}
public bool IsServerTokenValid(string serverToken)
{
return null != serverToken && (serverToken.Length == 32 || serverToken.StartsWith(AppBuiltIns.builtInPrefix));
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 1969028d6c8d24d5c83929e0d846ac21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_ViewDataDictionary: {instanceID: 0}
- header: {fileID: 2800000, guid: 41df4ab8a05595e49b2f2d150e753bf7, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 825cea7c5dd397348af75ce59831a2af
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bbc4c49e0d6b4e739b6daa5d08e00632
timeCreated: 1630370504

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 10a5b9b665ad462cb8d1e8d6cde9bc11
timeCreated: 1630370518

View File

@@ -0,0 +1,75 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi.Configuration;
using Oculus.Voice.Core.Bindings.Android;
using UnityEngine;
namespace Oculus.Voice.Bindings.Android
{
public class VoiceSDKBinding : BaseServiceBinding
{
public VoiceSDKBinding(AndroidJavaObject sdkInstance) : base(sdkInstance)
{
}
public bool Active => binding.Call<bool>("isActive");
public bool IsRequestActive => binding.Call<bool>("isRequestActive");
public bool MicActive => binding.Call<bool>("isMicActive");
public bool PlatformSupportsWit => binding.Call<bool>("platformSupportsWit");
public void Activate(string text)
{
binding.Call("activate", text);
}
public void Activate(string text, WitRequestOptions options)
{
binding.Call("activate", text);
}
public void Activate()
{
binding.Call("activate");
}
public void Activate(WitRequestOptions options)
{
binding.Call("activate");
}
public void ActivateImmediately()
{
binding.Call("activateImmediately");
}
public void ActivateImmediately(WitRequestOptions options)
{
binding.Call("activateImmediately");
}
public void Deactivate()
{
binding.Call("deactivate");
}
public void SetRuntimeConfiguration(WitRuntimeConfiguration configuration)
{
binding.Call("setRuntimeConfig", new VoiceSDKConfigBinding(configuration).ToJavaObject());
}
public void SetListener(VoiceSDKListenerBinding listener)
{
binding.Call("setListener", listener);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0d8c1d6d5b8545cfb741ca067158491a
timeCreated: 1630371197

View File

@@ -0,0 +1,55 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi.Configuration;
using UnityEngine;
namespace Oculus.Voice.Bindings.Android
{
public class VoiceSDKConfigBinding
{
private WitRuntimeConfiguration configuration;
public VoiceSDKConfigBinding(WitRuntimeConfiguration config)
{
configuration = config;
}
public AndroidJavaObject ToJavaObject()
{
AndroidJavaObject witConfig =
new AndroidJavaObject("com.oculus.voice.sdk.api.WitConfiguration");
witConfig.Set("clientAccessToken", configuration.witConfiguration.clientAccessToken);
AndroidJavaObject witRuntimeConfig = new AndroidJavaObject("com.oculus.voice.sdk.api.WitRuntimeConfiguration");
witRuntimeConfig.Set("witConfiguration", witConfig);
witRuntimeConfig.Set("minKeepAliveVolume", configuration.minKeepAliveVolume);
witRuntimeConfig.Set("minKeepAliveTimeInSeconds",
configuration.minKeepAliveTimeInSeconds);
witRuntimeConfig.Set("minTranscriptionKeepAliveTimeInSeconds",
configuration.minTranscriptionKeepAliveTimeInSeconds);
witRuntimeConfig.Set("maxRecordingTime",
configuration.maxRecordingTime);
witRuntimeConfig.Set("soundWakeThreshold",
configuration.soundWakeThreshold);
witRuntimeConfig.Set("sampleLengthInMs",
configuration.sampleLengthInMs);
witRuntimeConfig.Set("micBufferLengthInSeconds",
configuration.micBufferLengthInSeconds);
witRuntimeConfig.Set("sendAudioToWit",
configuration.sendAudioToWit);
return witRuntimeConfig;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 114218fd50f24874adaaf0e91a865d75
timeCreated: 1630370973

View File

@@ -0,0 +1,93 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi.Configuration;
using Facebook.WitAi.Events;
using Facebook.WitAi.Interfaces;
using Oculus.Voice.Core.Bindings.Android;
using Oculus.Voice.Interfaces;
namespace Oculus.Voice.Bindings.Android
{
public class VoiceSDKImpl : BaseAndroidConnectionImpl<VoiceSDKBinding>,
IPlatformVoiceService
{
public VoiceSDKImpl() : base(
"com.oculus.voice.sdk.unity.UnityVoiceSDKServiceFragment")
{
}
public bool PlatformSupportsWit => service.PlatformSupportsWit;
public bool Active => service.Active;
public bool IsRequestActive => service.IsRequestActive;
public bool MicActive => service.MicActive;
public void SetRuntimeConfiguration(WitRuntimeConfiguration configuration)
{
service.SetRuntimeConfiguration(configuration);
}
private VoiceSDKListenerBinding eventBinding;
public VoiceEvents VoiceEvents
{
get => eventBinding.VoiceEvents;
set
{
eventBinding = new VoiceSDKListenerBinding(value);
service.SetListener(eventBinding);
}
}
public ITranscriptionProvider TranscriptionProvider { get; set; }
public void Activate(string text)
{
service.Activate(text);
}
public void Activate(string text, WitRequestOptions requestOptions)
{
service.Activate(text, requestOptions);
}
public void Activate()
{
service.Activate();
}
public void Activate(WitRequestOptions requestOptions)
{
service.Activate(requestOptions);
}
public void ActivateImmediately()
{
service.ActivateImmediately();
}
public void ActivateImmediately(WitRequestOptions requestOptions)
{
service.ActivateImmediately(requestOptions);
}
public void Deactivate()
{
service.Deactivate();
}
public void DeactivateAndAbortRequest()
{
service.Deactivate();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a3943048f6aa4a49977131e8fb7f677d
timeCreated: 1630370598

View File

@@ -0,0 +1,96 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Facebook.WitAi.Events;
using Facebook.WitAi.Lib;
using UnityEngine;
namespace Oculus.Voice.Bindings.Android
{
public class VoiceSDKListenerBinding : AndroidJavaProxy
{
private VoiceEvents voiceEvents;
public VoiceEvents VoiceEvents => voiceEvents;
public VoiceSDKListenerBinding(VoiceEvents voiceEvents) : base(
"com.oculus.assistant.api.unity.dictation.UnityDictationListener")
{
this.voiceEvents = voiceEvents;
}
public void onResponse(string response)
{
voiceEvents.OnResponse?.Invoke(WitResponseNode.Parse(response));
}
public void onError(string error, string message)
{
voiceEvents.OnError?.Invoke(error, message);
}
public void onMicLevelChanged(float level)
{
voiceEvents.OnMicLevelChanged?.Invoke(level);
}
public void onRequestCreated()
{
voiceEvents.OnRequestCreated?.Invoke(null);
}
public void onStartListening()
{
voiceEvents.OnStartListening?.Invoke();
}
public void onStoppedListening()
{
voiceEvents.OnStoppedListening?.Invoke();
}
public void onStoppedListeningDueToInactivity()
{
voiceEvents.OnStoppedListeningDueToInactivity?.Invoke();
}
public void onStoppedListeningDueToTimeout()
{
voiceEvents.OnStoppedListeningDueToTimeout?.Invoke();
}
public void onStoppedListeningDueToDeactivation()
{
voiceEvents.OnStoppedListeningDueToDeactivation?.Invoke();
}
public void onMicDataSent()
{
voiceEvents.OnMicDataSent?.Invoke();
}
public void onMinimumWakeThresholdHit()
{
voiceEvents.OnMinimumWakeThresholdHit?.Invoke();
}
public void onPartialTranscription(string transcription)
{
voiceEvents.OnPartialTranscription?.Invoke(transcription);
}
public void onFullTranscription(string transcription)
{
voiceEvents.OnFullTranscription?.Invoke(transcription);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c4812e4a88b84256a571c7253e27799f
timeCreated: 1630371293

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 44a9302c8ca946f3b19b222b1481aa72
timeCreated: 1630374670

View File

@@ -0,0 +1,24 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi;
using Facebook.WitAi.Configuration;
namespace Oculus.Voice.Interfaces
{
public interface IPlatformVoiceService : IVoiceService
{
bool PlatformSupportsWit { get; }
void SetRuntimeConfiguration(WitRuntimeConfiguration configuration);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 64225fc2964c4ee98ff780eb51274278
timeCreated: 1630374685

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8e4f817930837444a893fce723ba3f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,163 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using System.Collections.Generic;
namespace Oculus.Voice
{
public static class AppBuiltIns
{
public static string builtInPrefix = "builtin:";
private static string modelName = "Built-in Models";
public static readonly Dictionary<string, Dictionary<string, string>>
apps = new Dictionary<string, Dictionary<string, string>>
{
{
"Chinese", new Dictionary<string, string>
{
{"id", "voiceSDK_zh"},
{"name", modelName},
{"lang", "zh"},
{"clientToken", "3KQH33637TAT7WD4TG7T65SDRO73WZGY"},
}
},
{
"Dutch", new Dictionary<string, string>
{
{"id", "voiceSDK_nl"},
{"name", modelName},
{"lang", "nl"},
{"clientToken", "ZCD6HCNCL6GTJKZ3QKWNKQVEDI4GUL7C"},
}
},
{
"English", new Dictionary<string, string>
{
{"id", "voiceSDK_en"},
{"name", modelName},
{"lang", "en"},
{"clientToken", "HOKEABS7HPIQVSRSVWRPTTV75TQJ5QBP"},
}
},
{
"French", new Dictionary<string, string>
{
{"id", "voiceSDK_fr"},
{"name", modelName},
{"lang", "fr"},
{"clientToken", "7PP7NK2QAH67MREGZV6SB6RIEWAYDNRY"},
}
},
{
"German", new Dictionary<string, string>
{
{"id", "voiceSDK_de"},
{"name", modelName},
{"lang", "de"},
{"clientToken", "7LXOOB4JC7MXPUTTGQHDVQMHGEEJT6LE"},
}
},
{
"Italian", new Dictionary<string, string>
{
{"id", "voiceSDK_it"},
{"name", modelName},
{"lang", "it"},
{"clientToken", "KELCNR4DCCPPOCF2RDFS4M6JOCWWIFII"},
}
},
{
"Japanese", new Dictionary<string, string>
{
{"id", "voiceSDK_ja"},
{"name", modelName},
{"lang", "ja"},
{"clientToken", "TPJGLBBCHJ5F7BVVN5XLEGP6YDQRUE3P"},
}
},
{
"Korean", new Dictionary<string, string>
{
{"id", "voiceSDK_ko"},
{"name", modelName},
{"lang", "ko"},
{"clientToken", "NT4WJLL7ACMFBXS4B7W5GRLTKDZQ36R4"},
}
},
{
"Polish", new Dictionary<string, string>
{
{"id", "voiceSDK_pl"},
{"name", modelName},
{"lang", "pl"},
{"clientToken", "DMDRHGYDYN33D3IKCX5BG5R57EL2IIC4"},
}
},
{
"Portuguese", new Dictionary<string, string>
{
{"id", "voiceSDK_pt"},
{"name", modelName},
{"lang", "pt"},
{"clientToken", "W4W3BSKL72HZC5MXLILONJUCG732SQQN"},
}
},
{
"Russian", new Dictionary<string, string>
{
{"id", "voiceSDK_ru"},
{"name", modelName},
{"lang", "ru"},
{"clientToken", "W67HLUWA3MBYVEKRW3VVWUKSNZGAOFBI"},
}
},
{
"Spanish", new Dictionary<string, string>
{
{"id", "voiceSDK_es"},
{"name", modelName},
{"lang", "es"},
{"clientToken", "YW7AM5OOVSW5XKGYKFE2S2HLC2WHC3UI"},
}
},
{
"Swedish", new Dictionary<string, string>
{
{"id", "voiceSDK_sv"},
{"name", modelName},
{"lang", "sv"},
{"clientToken", "NPE3UJ7Y4NIVTUOZ7QPPAP3TY6FYPXJY"},
}
},
{
"Turkish", new Dictionary<string, string>
{
{"id", "voiceSDK_tr"},
{"name", modelName},
{"lang", "tr"},
{"clientToken", "ZCISEDXESLYJOROLNOODCGGPZXHLUAEE"},
}
},
};
public static string[] appNames
{
get
{
string[] keys = new string[apps.Keys.Count];
apps.Keys.CopyTo(keys, 0);
return keys;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6483d6b21054c4e07acfd6c1c43c4e0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,153 @@
/**************************************************************************************************
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
*
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
**************************************************************************************************/
using Facebook.WitAi;
using Facebook.WitAi.Configuration;
using Facebook.WitAi.Interfaces;
#if UNITY_ANDROID
using Oculus.Voice.Bindings.Android;
#endif
using Oculus.Voice.Interfaces;
using UnityEngine;
namespace Oculus.Voice
{
[HelpURL("https://developer.oculus.com/experimental/voice-sdk/tutorial-overview/")]
public class AppVoiceExperience : VoiceService, IWitRuntimeConfigProvider
{
[SerializeField] private WitRuntimeConfiguration witRuntimeConfiguration;
public WitRuntimeConfiguration RuntimeConfiguration
{
get => witRuntimeConfiguration;
set => witRuntimeConfiguration = value;
}
private IPlatformVoiceService platformService;
private IVoiceService voiceServiceImpl;
#region Voice Service Properties
public override bool Active => null != voiceServiceImpl && voiceServiceImpl.Active;
public override bool IsRequestActive => null != voiceServiceImpl && voiceServiceImpl.IsRequestActive;
public override ITranscriptionProvider TranscriptionProvider
{
get => voiceServiceImpl.TranscriptionProvider;
set => voiceServiceImpl.TranscriptionProvider = value;
}
public override bool MicActive => null != voiceServiceImpl && voiceServiceImpl.MicActive;
protected override bool ShouldSendMicData => witRuntimeConfiguration.sendAudioToWit ||
null == TranscriptionProvider;
#endregion
public bool HasPlatformIntegrations => false;
#region Voice Service Methods
public override void Activate()
{
voiceServiceImpl.Activate();
}
public override void Activate(WitRequestOptions options)
{
voiceServiceImpl.Activate(options);
}
public override void ActivateImmediately()
{
voiceServiceImpl.ActivateImmediately();
}
public override void ActivateImmediately(WitRequestOptions options)
{
voiceServiceImpl.ActivateImmediately(options);
}
public override void Deactivate()
{
voiceServiceImpl.Deactivate();
}
public override void DeactivateAndAbortRequest()
{
voiceServiceImpl.DeactivateAndAbortRequest();
}
public override void Activate(string text)
{
voiceServiceImpl.Activate(text);
}
public override void Activate(string text, WitRequestOptions requestOptions)
{
voiceServiceImpl.Activate(text, requestOptions);
}
#endregion
void Start()
{
InitVoiceSDK();
}
private void InitVoiceSDK()
{
#if UNITY_ANDROID && !UNITY_EDITOR
if (HasPlatformIntegrations)
{
IPlatformVoiceService platformImpl = new VoiceSDKImpl();
if (platformImpl.PlatformSupportsWit)
{
voiceServiceImpl = platformImpl;
}
else
{
RevertToWitUnity();
}
}
else
{
RevertToWitUnity();
}
#else
RevertToWitUnity();
#endif
if (voiceServiceImpl is Wit wit)
{
wit.RuntimeConfiguration = witRuntimeConfiguration;
}
voiceServiceImpl.VoiceEvents = VoiceEvents;
}
private void RevertToWitUnity()
{
voiceServiceImpl = GetComponent<Wit>();
if (null == voiceServiceImpl)
{
voiceServiceImpl = gameObject.AddComponent<Wit>();
}
}
private void OnEnable()
{
if(null == voiceServiceImpl) InitVoiceSDK();
#if UNITY_ANDROID && !UNITY_EDITOR
platformService?.SetRuntimeConfiguration(witRuntimeConfiguration);
#endif
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28779cfed47441a42a6cd4fb49c8dc89
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
{
"name": "VoiceSDK.Runtime",
"references": [
"GUID:a6b2b1f1f66ed4645a97660636b8683d",
"GUID:a7c32ded21d3b9b42a71cdf39f2ed8da",
"GUID:4504b1a6e0fdcc3498c30b266e4a63bf"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e545cc0678493234a9368f4e470c29e8
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: