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()); } }
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))); }
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 : ""; }
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); }
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); } }
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); } }
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]); } }
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); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.PropertyField(GUIArea.ProgressLine(ref position), GetValueProperty(property), new GUIContent(property.displayName), true); }