Initial Commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.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:
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.WitAi.Data.Configuration;
|
||||
using Meta.WitAi.Windows;
|
||||
using Meta.WitAi;
|
||||
using Meta.WitAi.Data.Info;
|
||||
using Oculus.Voice.Utility;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Inspectors
|
||||
{
|
||||
[CustomEditor(typeof(WitConfiguration))]
|
||||
public class AppVoiceExperienceWitConfigurationEditor : WitConfigurationEditor
|
||||
{
|
||||
// Override with voice sdk header
|
||||
protected override Texture2D HeaderIcon => VoiceSDKStyles.MainHeader;
|
||||
public override string HeaderUrl => GetSafeAppUrl(Configuration, WitTexts.WitAppEndpointType.Settings);
|
||||
protected override string DocsUrl => VoiceSDKStyles.Texts.VoiceDocsUrl;
|
||||
protected override string OpenButtonLabel => IsBuiltInConfiguration(Configuration) ? VoiceSDKStyles.Texts.BuiltInAppBtnLabel : base.OpenButtonLabel;
|
||||
|
||||
// Disable server functionality for built in configurations
|
||||
protected override bool _disableServerPost => IsBuiltInConfiguration(Configuration);
|
||||
|
||||
// Use to determine if built in configuration
|
||||
public static bool IsBuiltInConfiguration(WitConfiguration witConfiguration)
|
||||
{
|
||||
if (witConfiguration == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return IsBuiltInConfiguration(witConfiguration.GetApplicationInfo());
|
||||
}
|
||||
public static bool IsBuiltInConfiguration(WitAppInfo appInfo)
|
||||
{
|
||||
return IsBuiltInConfiguration(appInfo.id);
|
||||
}
|
||||
public static bool IsBuiltInConfiguration(string applicationID)
|
||||
{
|
||||
return !string.IsNullOrEmpty(applicationID) && applicationID.StartsWith("voice");
|
||||
}
|
||||
|
||||
// Get safe app url
|
||||
public static string GetSafeAppUrl(WitConfiguration witConfiguration, WitTexts.WitAppEndpointType endpointType)
|
||||
{
|
||||
// Use built in app url
|
||||
if (IsBuiltInConfiguration(witConfiguration))
|
||||
{
|
||||
return VoiceSDKStyles.Texts.BuiltInAppUrl;
|
||||
}
|
||||
// Return wit app id
|
||||
return WitTexts.GetAppURL(witConfiguration?.GetApplicationId(), endpointType);
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81dc8ceb5197487fa6b8f684c40a0a06
|
||||
timeCreated: 1630651402
|
||||
Reference in New Issue
Block a user