protected virtual void DrawObjectsElement(Rect rect, int index, bool isActive, bool isFocused)
            {
                EditorGUIUtility.fieldWidth = 50f;

                SerializedProperty prefab   = objects.GetPropertyOfIndex(index, "prefab");
                SerializedProperty position = objects.GetPropertyOfIndex(index, "position");
                SerializedProperty rotation = objects.GetPropertyOfIndex(index, "rotation");
                SerializedProperty scale    = objects.GetPropertyOfIndex(index, "scale");

                EditorGUI.BeginChangeCheck();
                prefab.objectReferenceValue = EditorGUI.ObjectField(GUIArea.ProgressLine(ref rect), "Prefab", prefab.objectReferenceValue, typeof(GameObject), false);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedPropertiesWithoutUndo();

                    ForAllTargets((MultiPrefab target) => target.objects[index].Instantiate(target.transform));
                }

                EditorGUI.BeginChangeCheck();
                EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), position);
                EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), rotation);
                EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), scale);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedPropertiesWithoutUndo();

                    ForAllTargets((MultiPrefab target) => target.objects[index].UpdateInstanceCoords());
                }
            }
Exemplo n.º 2
0
            void DrawPlatformsPreviewElement(Rect rect, int index, bool isActive, bool isFocused)
            {
                SerializedProperty platform = platformsList.preview.GetArrayElement(index);

                GUIArea.Progress(ref rect, GUIArea.LayoutOffset / 2);

                EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), platform, new GUIContent("Platform " + (index + 1)));
            }
Exemplo n.º 3
0
            public static void Draw(ref Rect rect, SerializedProperty property)
            {
                SerializedProperty name  = property.FindPropertyRelative("name");
                SerializedProperty asset = property.FindPropertyRelative("asset");

                asset.objectReferenceValue = EditorGUI.ObjectField(GUIArea.ProgressLine(ref rect), property.displayName, asset.objectReferenceValue, typeof(SceneAsset), false);

                name.stringValue = asset.objectReferenceValue ? asset.objectReferenceValue.name : "";
            }
Exemplo n.º 4
0
        protected override void DrawDefaultElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            string label = ElementNameGetter(GetArrayElement(index));

            if (label == string.Empty)
            {
                label = "--------";
            }

            EditorGUI.LabelField(GUIArea.ProgressLine(ref rect), label);
        }
Exemplo n.º 5
0
            void DrawPlatformsElement(Rect rect, int index, bool isActive, bool isFocused)
            {
                SerializedProperty name   = platformsList.main.GetPropertyOfIndex(index, "name");
                SerializedProperty module = platformsList.main.GetPropertyOfIndex(index, "module");

                GUIArea.ProgressLayout(ref rect);

                name.stringValue = EditorGUI.TextField(GUIArea.ProgressLine(ref rect), "Name", name.stringValue);

                module.objectReferenceValue = EditorGUI.ObjectField(GUIArea.ProgressLine(ref rect), platformsList.main.serializedProperty.displayName, module.objectReferenceValue, target.ModuleType, false);
            }
            public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
            {
                InitProperty(property);

                label.text = property.displayName;

                EnabledValue = EditorGUI.ToggleLeft(GUIArea.ProgressLine(ref rect), label, EnabledValue);

                if (EnabledValue)
                {
                    DrawValue(ref rect, property, label);
                }
            }
Exemplo n.º 7
0
        protected virtual void DrawDefaultElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            GUIArea.Progress(ref rect, GUIArea.LayoutOffset);

            elementHeight = GetDefaultElementsSize();

            if (GetArrayElement(index).hasVisibleChildren)
            {
                DrawDefaultMultiElements(rect, index, isActive, isFocused);
            }
            else
            {
                DrawDefaultSingleElements(rect, index, isActive, isFocused, GetArrayElement(index));
            }
        }
        public virtual void Draw(ref Rect rect)
        {
            if (HasChildern)
            {
                PropertyExpanded = EditorGUI.Foldout(GUIArea.ProgressLine(ref rect), PropertyExpanded, Label);

                if (PropertyExpanded)
                {
                    DrawChildern(ref rect);
                }
            }
            else
            {
                EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), Property);
            }
        }
Exemplo n.º 9
0
        protected virtual void DrawDefaultMultiElements(Rect rect, int index, bool isActive, bool isFocused)
        {
            List <SerializedProperty> childern = GetArrayElement(index).GetChildern();

            if (childern.Count == 1)
            {
                DrawDefaultSingleElements(rect, index, isActive, isFocused, childern[0]);

                return;
            }

            Rect childRect;

            for (int i = 0; i < childern.Count; i++)
            {
                childRect = GUIArea.ProgressLayout(ref rect, EditorGUI.GetPropertyHeight(childern[i], true));
                EditorGUI.PropertyField(childRect, childern[i]);
            }
        }
Exemplo n.º 10
0
 protected virtual void DrawDefaultSingleElements(Rect rect, int index, bool isActive, bool isFocused, SerializedProperty property)
 {
     EditorGUI.PropertyField(GUIArea.ProgressLine(ref rect), property);
 }
        protected virtual void DrawChild(ref Rect rect, SerializedProperty property)
        {
            var height = EditorGUI.GetPropertyHeight(property, true);

            EditorGUI.PropertyField(GUIArea.Progress(ref rect, height), property);
        }
Exemplo n.º 12
0
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     EditorGUI.PropertyField(GUIArea.ProgressLine(ref position), GetValueProperty(property), new GUIContent(property.displayName), true);
 }