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,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: