clean project
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af63f3a49855bc49ab30a54897228fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKEditor",
|
||||
"references": [
|
||||
"GUID:a7c32ded21d3b9b42a71cdf39f2ed8da"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a32f21e557428c84e845c18e46d9284f
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13ae9debef50c7e46a015123dfc48813
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,118 @@
|
||||
/**************************************************************************************************
|
||||
* 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.
|
||||
**************************************************************************************************/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ArrayElementTitleAttribute))]
|
||||
public class ArrayElementTitleDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
|
||||
protected virtual ArrayElementTitleAttribute Attribute
|
||||
{
|
||||
get { return (ArrayElementTitleAttribute) attribute; }
|
||||
}
|
||||
|
||||
SerializedProperty titleNameProp;
|
||||
|
||||
public override void OnGUI(Rect position,
|
||||
SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
string name = null;
|
||||
if (string.IsNullOrEmpty(Attribute.varname))
|
||||
{
|
||||
titleNameProp = property.serializedObject.FindProperty(property.propertyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string fullPathName = property.propertyPath + "." + Attribute.varname;
|
||||
titleNameProp = property.serializedObject.FindProperty(fullPathName);
|
||||
}
|
||||
|
||||
if (null != titleNameProp)
|
||||
{
|
||||
name = GetTitle();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(Attribute.fallbackName))
|
||||
{
|
||||
name = Attribute.fallbackName;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = label.text;
|
||||
}
|
||||
|
||||
EditorGUI.PropertyField(position, property, new GUIContent(name, label.tooltip), true);
|
||||
}
|
||||
|
||||
private string GetTitle()
|
||||
{
|
||||
switch (titleNameProp.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Generic:
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
return titleNameProp.intValue.ToString();
|
||||
case SerializedPropertyType.Boolean:
|
||||
return titleNameProp.boolValue.ToString();
|
||||
case SerializedPropertyType.Float:
|
||||
return titleNameProp.floatValue.ToString();
|
||||
case SerializedPropertyType.String:
|
||||
return titleNameProp.stringValue;
|
||||
case SerializedPropertyType.Color:
|
||||
return titleNameProp.colorValue.ToString();
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
return titleNameProp.objectReferenceValue?.ToString();
|
||||
case SerializedPropertyType.LayerMask:
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
return titleNameProp.enumNames[titleNameProp.enumValueIndex];
|
||||
case SerializedPropertyType.Vector2:
|
||||
return titleNameProp.vector2Value.ToString();
|
||||
case SerializedPropertyType.Vector3:
|
||||
return titleNameProp.vector3Value.ToString();
|
||||
case SerializedPropertyType.Vector4:
|
||||
return titleNameProp.vector4Value.ToString();
|
||||
case SerializedPropertyType.Rect:
|
||||
break;
|
||||
case SerializedPropertyType.ArraySize:
|
||||
break;
|
||||
case SerializedPropertyType.Character:
|
||||
break;
|
||||
case SerializedPropertyType.AnimationCurve:
|
||||
break;
|
||||
case SerializedPropertyType.Bounds:
|
||||
break;
|
||||
case SerializedPropertyType.Gradient:
|
||||
break;
|
||||
case SerializedPropertyType.Quaternion:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99800bf0e26831a41983faa658759631
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa3bcde078d02604fb774938a2a9ea66
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
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 System.Reflection;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class AssistantEditorUtils
|
||||
{
|
||||
public static T GetFieldValue<T>(object obj, string name)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
return (T) field?.GetValue(obj);
|
||||
}
|
||||
|
||||
public static void SetFieldValue<T>(object obj, string name, T value)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
field?.SetValue(obj, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91dbfa5ea168d9444aeca84e19716861
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08b982f4564aa084e9f123b2855d6881
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 719ae09d6be753e46845c9b349912e3e
|
||||
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 Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class AndroidServiceConnection : IConnection
|
||||
{
|
||||
private AndroidJavaObject mAssistantServiceConnection;
|
||||
|
||||
private string serviceFragmentClass;
|
||||
private string serviceGetter;
|
||||
|
||||
public bool IsConnected => null != mAssistantServiceConnection;
|
||||
|
||||
public AndroidJavaObject AssistantServiceConnection => mAssistantServiceConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a connection manager of the given type
|
||||
/// </summary>
|
||||
/// <param name="serviceFragmentClassName">The fully qualified class name of the service fragment that will manage this connection</param>
|
||||
/// <param name="serviceGetterMethodName">The name of the method that will return an instance of the service</param>
|
||||
/// TODO: We should make the getBlahService simply getService() within each fragment implementation.
|
||||
public AndroidServiceConnection(string serviceFragmentClassName, string serviceGetterMethodName)
|
||||
{
|
||||
serviceFragmentClass = serviceFragmentClassName;
|
||||
serviceGetter = serviceGetterMethodName;
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
if (null == mAssistantServiceConnection)
|
||||
{
|
||||
AndroidJNIHelper.debug = true;
|
||||
|
||||
AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
AndroidJavaObject activity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
|
||||
using (AndroidJavaClass assistantBackgroundFragment = new AndroidJavaClass(serviceFragmentClass))
|
||||
{
|
||||
mAssistantServiceConnection =
|
||||
assistantBackgroundFragment.CallStatic<AndroidJavaObject>("createAndAttach", activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
mAssistantServiceConnection.Call("detach");
|
||||
}
|
||||
|
||||
public AndroidJavaObject GetService()
|
||||
{
|
||||
return mAssistantServiceConnection.Call<AndroidJavaObject>(serviceGetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85f4ff04745e1ab459e49eb38bc288b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
/**************************************************************************************************
|
||||
* 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 UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class BaseAndroidConnectionImpl<T> where T : BaseServiceBinding
|
||||
{
|
||||
private string fragmentClassName;
|
||||
protected T service;
|
||||
protected readonly AndroidServiceConnection serviceConnection;
|
||||
|
||||
public bool IsConnected => serviceConnection.IsConnected;
|
||||
|
||||
public BaseAndroidConnectionImpl(string className)
|
||||
{
|
||||
fragmentClassName = className;
|
||||
serviceConnection = new AndroidServiceConnection(className, "getService");
|
||||
}
|
||||
|
||||
#region Service Connection
|
||||
|
||||
public virtual void Connect()
|
||||
{
|
||||
serviceConnection.Connect();
|
||||
var serviceInstance = serviceConnection.GetService();
|
||||
if (null == serviceInstance)
|
||||
{
|
||||
throw new Exception("Unable to get service connection from " + fragmentClassName);
|
||||
}
|
||||
|
||||
service = (T) Activator.CreateInstance(typeof(T), serviceInstance);
|
||||
}
|
||||
|
||||
public virtual void Disconnect()
|
||||
{
|
||||
service.Shutdown();
|
||||
serviceConnection.Disconnect();
|
||||
service = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class BaseServiceBinding
|
||||
{
|
||||
protected AndroidJavaObject binding;
|
||||
|
||||
protected BaseServiceBinding(AndroidJavaObject sdkInstance)
|
||||
{
|
||||
binding = sdkInstance;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
binding.Call("shutdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa5e9cb2d6b763f4c983b82092bb192d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKRuntime"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7c32ded21d3b9b42a71cdf39f2ed8da
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a116b0921542354a9d57799cba768bd
|
||||
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.
|
||||
**************************************************************************************************/
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Interfaces
|
||||
{
|
||||
public interface IConnection
|
||||
{
|
||||
void Connect();
|
||||
void Disconnect();
|
||||
|
||||
bool IsConnected { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a8340504b2574441afe16939acde7ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48dd050ce4e9b904fa2888ae3c2724d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
/**************************************************************************************************
|
||||
* 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.
|
||||
**************************************************************************************************/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class ArrayElementTitleAttribute : PropertyAttribute
|
||||
{
|
||||
public string varname;
|
||||
public string fallbackName;
|
||||
|
||||
public ArrayElementTitleAttribute(string elementTitleVar = null, string fallbackName = null)
|
||||
{
|
||||
varname = elementTitleVar;
|
||||
this.fallbackName = fallbackName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd85a8631126f474f8d69375b5cc2bf4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user