clean project
This commit is contained in:
8
Assets/Oculus/Voice/Scripts/Editor/Data.meta
Normal file
8
Assets/Oculus/Voice/Scripts/Editor/Data.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9b850b590def934d88d46d5f230177b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 766b749f675dba94a92bb81ebf699d06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Scripts/Editor/Inspectors.meta
Normal file
8
Assets/Oculus/Voice/Scripts/Editor/Inspectors.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e7c523618d37124d82a50597af82815
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03744310c46b6e546b2b772e941f8cb2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81dc8ceb5197487fa6b8f684c40a0a06
|
||||
timeCreated: 1630651402
|
||||
8
Assets/Oculus/Voice/Scripts/Editor/Upgrade.meta
Normal file
8
Assets/Oculus/Voice/Scripts/Editor/Upgrade.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a51109e9358cfd4fa1690bede306b75
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
47
Assets/Oculus/Voice/Scripts/Editor/Upgrade/WitUpgrader.cs
Normal file
47
Assets/Oculus/Voice/Scripts/Editor/Upgrade/WitUpgrader.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b6dc5be923e4794fbc03577778257f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Scripts/Editor/Utility.meta
Normal file
8
Assets/Oculus/Voice/Scripts/Editor/Utility.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c74dbc89a3023bb41b841587da9e9953
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Oculus/Voice/Scripts/Editor/Utility/VoiceSDKStyles.cs
Normal file
26
Assets/Oculus/Voice/Scripts/Editor/Utility/VoiceSDKStyles.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa1f0af066e824a31875bc815a72cc5c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bf6b7b99e36e104f964fb70253f847c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/Oculus/Voice/Scripts/Editor/VoiceSDK.Editor.asmdef
Normal file
19
Assets/Oculus/Voice/Scripts/Editor/VoiceSDK.Editor.asmdef
Normal 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
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c313d8e945a7904dbf75897c010ac4d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Scripts/Editor/Windows.meta
Normal file
8
Assets/Oculus/Voice/Scripts/Editor/Windows.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6882087e17a8bbe4c80cf5a6764e6a6b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
54
Assets/Oculus/Voice/Scripts/Editor/Windows/AboutWindow.cs
Normal file
54
Assets/Oculus/Voice/Scripts/Editor/Windows/AboutWindow.cs
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
158
Assets/Oculus/Voice/Scripts/Editor/Windows/SettingsWindow.cs
Normal file
158
Assets/Oculus/Voice/Scripts/Editor/Windows/SettingsWindow.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c810bb2a5bea4e4897c121e3264df3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c86fe355d3472b94bbaa52c686a49ddb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f885966f75e449f6b3912d20c1b85bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
163
Assets/Oculus/Voice/Scripts/Editor/Windows/WelcomeWizard.cs
Normal file
163
Assets/Oculus/Voice/Scripts/Editor/Windows/WelcomeWizard.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user