Initialer Upload neues Unity-Projekt
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 UnityEngine;
|
||||
namespace Oculus.Interaction
|
||||
{
|
||||
public class ConditionalHideAttribute : PropertyAttribute
|
||||
{
|
||||
public string ConditionalFieldPath { get; private set; }
|
||||
public object HideValue { get; private set; }
|
||||
|
||||
|
||||
public ConditionalHideAttribute(string fieldName, object hideValue)
|
||||
{
|
||||
ConditionalFieldPath = fieldName;
|
||||
HideValue = hideValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1def61d70ea1cd64ebbf612ff7b0b2f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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 UnityEngine;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Oculus.Interaction
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class InspectorButtonAttribute : PropertyAttribute
|
||||
{
|
||||
private const float BUTTON_WIDTH = 80;
|
||||
private const float BUTTON_HEIGHT = 20;
|
||||
|
||||
public float ButtonWidth { get; set; } = BUTTON_WIDTH;
|
||||
|
||||
public readonly string methodName;
|
||||
public readonly float buttonHeight;
|
||||
|
||||
public InspectorButtonAttribute(string methodName)
|
||||
{
|
||||
this.methodName = methodName;
|
||||
this.buttonHeight = BUTTON_HEIGHT;
|
||||
}
|
||||
public InspectorButtonAttribute(string methodName, float buttonHeight)
|
||||
{
|
||||
this.methodName = methodName;
|
||||
this.buttonHeight = buttonHeight;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[CustomPropertyDrawer(typeof(InspectorButtonAttribute))]
|
||||
public class InspectorButtonPropertyDrawer : PropertyDrawer
|
||||
{
|
||||
private MethodInfo _method = null;
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
InspectorButtonAttribute inspectorButtonAttribute = (InspectorButtonAttribute)attribute;
|
||||
return inspectorButtonAttribute.buttonHeight;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect positionRect, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
InspectorButtonAttribute inspectorButtonAttribute = (InspectorButtonAttribute)attribute;
|
||||
Rect rect = positionRect;
|
||||
rect.height = inspectorButtonAttribute.buttonHeight;
|
||||
if (GUI.Button(rect, label.text))
|
||||
{
|
||||
Type eventType = prop.serializedObject.targetObject.GetType();
|
||||
string eventName = inspectorButtonAttribute.methodName;
|
||||
if (_method == null)
|
||||
{
|
||||
_method = eventType.GetMethod(eventName,
|
||||
BindingFlags.Public
|
||||
| BindingFlags.NonPublic
|
||||
| BindingFlags.Instance
|
||||
| BindingFlags.Static);
|
||||
}
|
||||
_method?.Invoke(prop.serializedObject.targetObject, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49e18ec05efde04499be425cfc618529
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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 UnityEngine;
|
||||
|
||||
namespace Oculus.Interaction
|
||||
{
|
||||
/// <summary>
|
||||
/// Used on a SerializedField surfaces the expectation that this field can remain empty.
|
||||
/// </summary>
|
||||
public class OptionalAttribute : PropertyAttribute
|
||||
{
|
||||
[System.Flags]
|
||||
public enum Flag
|
||||
{
|
||||
/// <summary>
|
||||
/// Presents the Optional tag and moves it into the Optional Section
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Indicates that if the reference is missing, a new object will be
|
||||
/// created and linked to it during runtime.
|
||||
/// </summary>
|
||||
AutoGenerated = 1 << 0,
|
||||
/// <summary>
|
||||
/// Indicates that even though the reference is Optional, it is important
|
||||
/// for the component to work as expected.
|
||||
/// </summary>
|
||||
DontHide = 1 << 1
|
||||
}
|
||||
|
||||
public Flag Flags { get; private set; } = Flag.None;
|
||||
|
||||
public OptionalAttribute() { }
|
||||
|
||||
public OptionalAttribute(Flag flags)
|
||||
{
|
||||
Flags = flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed8877737b1570c42b9dafa5f1dcce9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 UnityEngine;
|
||||
|
||||
namespace Oculus.Interaction
|
||||
{
|
||||
/// <summary>
|
||||
/// Used on a SerializedField tags the field to be added to a custom section
|
||||
/// </summary>
|
||||
public class SectionAttribute : PropertyAttribute
|
||||
{
|
||||
public string SectionName { get; private set; } = string.Empty;
|
||||
|
||||
public SectionAttribute(string sectionName)
|
||||
{
|
||||
SectionName = sectionName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c8ae2e66f5d90a4f8887d11f590497c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user