Added VR libraries

This commit is contained in:
Chris Midkiff
2018-10-08 23:54:11 -04:00
parent d9eb2a9763
commit 7ce1036e39
1037 changed files with 195630 additions and 348 deletions

View File

@@ -0,0 +1,77 @@
// Copyright 2017 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// 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 UnityEngine.UI;
using UnityEditor;
[CustomPropertyDrawer(typeof(GvrPointerScrollInput), true)]
public class GvrPointerScrollInputEditor : PropertyDrawer {
private bool isExpanded = true;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
int rows = GetNumRows(property);
float totalHeight = position.height;
float rowHeight = totalHeight / rows;
position.height = rowHeight;
isExpanded = EditorGUI.Foldout(position, isExpanded, label);
if (isExpanded) {
EditorGUI.indentLevel++;
// Inertia property.
SerializedProperty inertia =
property.FindPropertyRelative(GvrPointerScrollInput.PROPERTY_NAME_INERTIA);
position.y += rowHeight;
EditorGUI.PropertyField(position, inertia);
if (inertia.boolValue) {
EditorGUI.indentLevel++;
// Deceleration rate property.
SerializedProperty decelerationRate =
property.FindPropertyRelative(GvrPointerScrollInput.PROPERTY_NAME_DECELERATION_RATE);
position.y += rowHeight;
EditorGUI.PropertyField(position, decelerationRate);
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
}
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
return base.GetPropertyHeight(property, label) * GetNumRows(property);
}
private int GetNumRows(SerializedProperty property) {
SerializedProperty inertia =
property.FindPropertyRelative(GvrPointerScrollInput.PROPERTY_NAME_INERTIA);
if (!isExpanded) {
return 1;
} else if (!inertia.boolValue) {
return 2;
} else {
return 3;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: da538b2d940864934bfd4a6f2e6d0602
timeCreated: 1487103089
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: