Initialer Upload neues Unity-Projekt
This commit is contained in:
56
Assets/Oculus/Voice/Scripts/Editor/Windows/AboutWindow.cs
Normal file
56
Assets/Oculus/Voice/Scripts/Editor/Windows/AboutWindow.cs
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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 Meta.Voice.VSDKHub;
|
||||
using Meta.Voice.Hub.Attributes;
|
||||
using Meta.Voice.Hub.Interfaces;
|
||||
using Meta.WitAi;
|
||||
using Oculus.Voice.Utility;
|
||||
using Oculus.Voice;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Meta.Voice
|
||||
{
|
||||
[MetaHubPage("About", VoiceHubConstants.CONTEXT_VOICE, priority: 1000)]
|
||||
public class AboutWindow : IMetaHubPage
|
||||
{
|
||||
private Vector2 _offset;
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
Vector2 size;
|
||||
WitEditorUI.LayoutWindow(VoiceSDKStyles.Texts.AboutTitleLabel, null, null, null, OnWindowGUI, ref _offset, out size);
|
||||
}
|
||||
|
||||
private void OnWindowGUI()
|
||||
{
|
||||
WitEditorUI.LayoutKeyLabel(VoiceSDKStyles.Texts.AboutVoiceSdkVersionLabel, VoiceSDKConstants.SdkVersion);
|
||||
WitEditorUI.LayoutKeyLabel(VoiceSDKStyles.Texts.AboutWitSdkVersionLabel, WitConstants.SDK_VERSION);
|
||||
WitEditorUI.LayoutKeyLabel(VoiceSDKStyles.Texts.AboutWitApiVersionLabel, WitConstants.API_VERSION);
|
||||
|
||||
GUILayout.Space(16);
|
||||
|
||||
if (WitEditorUI.LayoutTextButton(VoiceSDKStyles.Texts.AboutTutorialButtonLabel))
|
||||
{
|
||||
Application.OpenURL(VoiceSDKStyles.Texts.AboutTutorialButtonUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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:
|
||||
98
Assets/Oculus/Voice/Scripts/Editor/Windows/SettingsWindow.cs
Normal file
98
Assets/Oculus/Voice/Scripts/Editor/Windows/SettingsWindow.cs
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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;
|
||||
using Meta.Voice.Hub.Attributes;
|
||||
using Meta.Voice.Hub.Interfaces;
|
||||
using Meta.Voice.VSDKHub;
|
||||
using Meta.WitAi;
|
||||
using Meta.WitAi.Windows;
|
||||
using Oculus.Voice.Utility;
|
||||
using Oculus.Voice.Windows;
|
||||
using UnityEngine;
|
||||
using Meta.Voice.TelemetryUtilities;
|
||||
|
||||
namespace Meta.Voice.Windows
|
||||
{
|
||||
public class SettingsWindow : WitWindow
|
||||
{
|
||||
protected override GUIContent Title => new GUIContent(VoiceSDKStyles.SettingsTitle.text);
|
||||
protected override Texture2D HeaderIcon => VoiceSDKStyles.MainHeader;
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
WitAuthUtility.tokenValidator = new VoiceSDKTokenValidatorProvider();
|
||||
titleContent = Title;
|
||||
base.OnEnable();
|
||||
}
|
||||
}
|
||||
|
||||
[MetaHubPage("Wit Configurations", VoiceHubConstants.CONTEXT_VOICE, priority: 500)]
|
||||
public class WitConfigWindowPage : SettingsWindow, IMetaHubPage
|
||||
{
|
||||
protected override GUIContent Title => new GUIContent("Wit Configurations");
|
||||
protected override Texture2D HeaderIcon => null;
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
|
||||
public override bool ShowGeneralSettings => false;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
Telemetry.LogInstantEvent(Telemetry.TelemetryEventId.OpenUi, new Dictionary<Telemetry.AnnotationKey, string>()
|
||||
{
|
||||
{Telemetry.AnnotationKey.PageId, "Configuration Window"}
|
||||
});
|
||||
titleContent = Title;
|
||||
}
|
||||
|
||||
public new void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Title.text;
|
||||
}
|
||||
}
|
||||
|
||||
[MetaHubPage("Settings", VoiceHubConstants.CONTEXT_VOICE, priority: 800)]
|
||||
public class SettingsWindowPage : SettingsWindow, IMetaHubPage
|
||||
{
|
||||
protected override GUIContent Title => new GUIContent("Settings");
|
||||
protected override Texture2D HeaderIcon => null;
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
|
||||
public override bool ShowWitConfiguration => false;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
titleContent = Title;
|
||||
}
|
||||
|
||||
public new void OnGUI()
|
||||
{
|
||||
base.OnGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c810bb2a5bea4e4897c121e3264df3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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;
|
||||
using Meta.Voice.TelemetryUtilities;
|
||||
using Meta.WitAi;
|
||||
using Meta.WitAi.Windows;
|
||||
using UnityEngine;
|
||||
using Oculus.Voice.Utility;
|
||||
using Oculus.Voice.Inspectors;
|
||||
|
||||
namespace Oculus.Voice.Windows
|
||||
{
|
||||
public class UnderstandingViewerWindow : WitUnderstandingViewer
|
||||
{
|
||||
protected override GUIContent Title => VoiceSDKStyles.UnderstandingTitle;
|
||||
protected override Texture2D HeaderIcon => VoiceSDKStyles.MainHeader;
|
||||
protected override string HeaderUrl => AppVoiceExperienceWitConfigurationEditor.GetSafeAppUrl(witConfiguration, WitTexts.WitAppEndpointType.Understanding);
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
Telemetry.LogInstantEvent(Telemetry.TelemetryEventId.OpenUi, new Dictionary<Telemetry.AnnotationKey, string>()
|
||||
{
|
||||
{Telemetry.AnnotationKey.PageId, "Configuration Window"}
|
||||
});
|
||||
base.OnEnable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c86fe355d3472b94bbaa52c686a49ddb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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 UnityEditor;
|
||||
using System.Reflection;
|
||||
using Meta.WitAi.Data.Info;
|
||||
using Meta.WitAi.Windows;
|
||||
using Oculus.Voice.Inspectors;
|
||||
|
||||
namespace Oculus.Voice.Windows
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(WitAppInfo))]
|
||||
public class VoiceApplicationDetailProvider : WitApplicationPropertyDrawer
|
||||
{
|
||||
// Skip fields if voice sdk app id
|
||||
protected override bool ShouldLayoutField(SerializedProperty property, FieldInfo subfield)
|
||||
{
|
||||
string appID = GetFieldStringValue(property, "id").ToLower();
|
||||
if (AppVoiceExperienceWitConfigurationEditor.IsBuiltInConfiguration(appID))
|
||||
{
|
||||
switch (subfield.Name)
|
||||
{
|
||||
case "name":
|
||||
case "lang":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return base.ShouldLayoutField(property, subfield);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f885966f75e449f6b3912d20c1b85bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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 UnityEditor;
|
||||
|
||||
namespace Oculus.Voice.Windows
|
||||
{
|
||||
public class VoiceSDKWizardWindow : ScriptableWizard
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -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:
|
||||
130
Assets/Oculus/Voice/Scripts/Editor/Windows/WelcomeWizard.cs
Normal file
130
Assets/Oculus/Voice/Scripts/Editor/Windows/WelcomeWizard.cs
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus 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;
|
||||
using Meta.Voice.TelemetryUtilities;
|
||||
using Meta.WitAi;
|
||||
using Meta.WitAi.Data.Configuration;
|
||||
using Meta.WitAi.Windows;
|
||||
using Meta.WitAi.Data.Info;
|
||||
using Oculus.Voice.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Windows
|
||||
{
|
||||
public class WelcomeWizard : WitWelcomeWizard
|
||||
{
|
||||
private int witBuiltInIndex;
|
||||
private string[] builtinAppNames;
|
||||
|
||||
protected override Texture2D HeaderIcon => VoiceSDKStyles.MainHeader;
|
||||
protected override GUIContent Title => VoiceSDKStyles.SetupTitle;
|
||||
protected override string ContentHeaderLabel => VoiceSDKStyles.Texts.SetupHeaderLabel;
|
||||
protected override string ContentSubheaderLabel => VoiceSDKStyles.Texts.SetupSubheaderLabel;
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
Telemetry.LogInstantEvent(Telemetry.TelemetryEventId.OpenUi, new Dictionary<Telemetry.AnnotationKey, string>()
|
||||
{
|
||||
{Telemetry.AnnotationKey.PageId, "Getting Started"}
|
||||
});
|
||||
|
||||
WitAuthUtility.tokenValidator = new VoiceSDKTokenValidatorProvider();
|
||||
base.OnEnable();
|
||||
witBuiltInIndex = 0;
|
||||
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 void LayoutFields()
|
||||
{
|
||||
// Prebuilt language app
|
||||
bool updated = false;
|
||||
WitEditorUI.LayoutLabel(VoiceSDKStyles.Texts.SetupLanguageLabel);
|
||||
WitEditorUI.LayoutPopup("", builtinAppNames, ref witBuiltInIndex, ref updated);
|
||||
if (updated)
|
||||
{
|
||||
if (witBuiltInIndex == 0)
|
||||
{
|
||||
serverToken = WitAuthUtility.ServerToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverToken = AppBuiltIns.builtInPrefix + builtinAppNames[witBuiltInIndex];
|
||||
}
|
||||
}
|
||||
|
||||
// Base fields
|
||||
if (witBuiltInIndex == 0)
|
||||
{
|
||||
GUILayout.Space(WitStyles.HeaderPaddingBottom);
|
||||
base.LayoutFields();
|
||||
}
|
||||
}
|
||||
|
||||
// Customize configuration if voice app was selected
|
||||
protected override int CreateConfiguration(string newToken)
|
||||
{
|
||||
// Do base for custom app
|
||||
if (witBuiltInIndex <= 0)
|
||||
{
|
||||
return base.CreateConfiguration(newToken);
|
||||
}
|
||||
|
||||
// Get built in app data
|
||||
string languageName = builtinAppNames[witBuiltInIndex];
|
||||
Dictionary<string, string> appData = AppBuiltIns.apps[languageName];
|
||||
|
||||
// Generate asset using app data
|
||||
WitConfiguration configuration = ScriptableObject.CreateInstance<WitConfiguration>();
|
||||
configuration.SetClientAccessToken(appData["clientToken"]);
|
||||
WitAppInfo application = new WitAppInfo()
|
||||
{
|
||||
name = appData["name"],
|
||||
id = appData["id"],
|
||||
lang = appData["lang"]
|
||||
};
|
||||
configuration.SetApplicationInfo(application);
|
||||
configuration.name = application.id;
|
||||
|
||||
// Save configuration to asset
|
||||
return WitConfigurationUtility.SaveConfiguration(string.Empty, configuration);
|
||||
}
|
||||
}
|
||||
|
||||
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