void DoRemove(int _index) { SerializedProperty sp = reorderableList.serializedProperty; //.GetArrayElementAtIndex(_index); if (sp.GetArrayElementAtIndex(_index) != null) { sp.DeleteArrayElementAtIndex(_index); } data.variables.RemoveAt(_index); data.tempVariablesList = new List <BlackboardSystem.BlackBoard.VariablesData>(); foreach (var key in data.variables.Keys) { data.tempVariablesList.Add(new BlackboardSystem.BlackBoard.VariablesData(key.ToString())); } serializedObject.Update(); reorderableList.DoLayoutList(); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(data); }
public override void OnInspectorGUI() { EditorGUILayout.PropertyField(SerializerCollectionPath); EditorGUILayout.PropertyField(DeserializerCollectionPath); EditorGUILayout.PropertyField(NamePrefix); serializedObject.ApplyModifiedProperties(); m_GhostList.DoLayoutList(); if (GUILayout.Button("Update ghost list")) { var collectionTarget = target as GhostCollectionAuthoringComponent; AddAllNewGhosts(collectionTarget.Ghosts); } if (GUILayout.Button("Regenerate all ghosts")) { RegenerateAllGhosts(); } if (GUILayout.Button("Generate collection code")) { GenerateCollection(); } }
private void DrawParameterList() { paramScroll = GUILayout.BeginScrollView(paramScroll); /*EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); * { * // GUILayout.TextField("Name", (GUIStyle)"ToolbarSeachTextFieldPopup"); * if (GUILayout.Button("+", EditorStyles.toolbarButton)) * { * GenericMenu menu = new GenericMenu(); * * var names = Enum.GetNames(typeof(GenericParameter.ParameterType)); * * for (int i = 0; i < names.Length; i++) * { * menu.AddItem(new GUIContent(names[i]), false, CreateNewParameterCallback(i)); * } * * menu.ShowAsContext(); * } * } * EditorGUILayout.EndHorizontal();*/ if (ParameterList != null && TreeAsset != null && TreeAsset.Parameters != null) { ParameterList.DoLayoutList(); } /*foreach (GenericParameter parameter in TreeAsset.Parameters) * { * GenericParamUtils.LayoutParameter(parameter); * }*/ GUILayout.EndScrollView(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (reorderableList == null) { var property = serializedObject.FindProperty("points"); reorderableList = new UnityEditorInternal.ReorderableList(serializedObject, property); reorderableList.drawElementCallback = (rect, index, isActive, isFocus) => { var element = property.GetArrayElementAtIndex(index); rect.width -= 20; rect.height -= 4; rect.y += 2; EditorGUI.PropertyField(rect, element); }; reorderableList.drawHeaderCallback = (rect) => EditorGUI.LabelField(rect, property.displayName); } serializedObject.Update(); reorderableList.DoLayoutList(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); reorderable.DoLayoutList(); serializedObject.ApplyModifiedProperties(); }
void OnGUI() { EditorGUILayout.BeginVertical(paddingStyle); list.DoLayoutList(); if (GUILayout.Button("Combine")) { var path = EditorUtility.SaveFilePanelInProject( "Combine Asset", "Combined.asset", "asset", "Choose where to save combined asset" ); if (!string.IsNullOrEmpty(path)) { CombineObjects(assets, path); } } if (Event.current.type == EventType.DragUpdated || Event.current.type == EventType.DragPerform) { DragAndDrop.visualMode = DragAndDropVisualMode.Copy; } if (Event.current.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); assets.AddRange(DragAndDrop.objectReferences); } EditorGUILayout.EndVertical(); }
public void DoLayoutList() { EditorGUI.BeginChangeCheck(); if (_popUpValue == 0) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.PropertyField(_sourceProperty); if (!_sourceProperty.isExpanded) { _popUpValue = EditorGUILayout.Popup( _popUpValue, _popupOptions, GUILayout.Width(125) ); } } EditorGUILayout.EndHorizontal(); } else { _reorderableList.DoLayoutList(); } if (EditorGUI.EndChangeCheck()) { SaveModifiedProperties(); } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(serializedObject.FindProperty("behaviour")); GUILayout.Space(5); setVariablesList.DoLayoutList(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { m_GhostList.DoLayoutList(); if (GUILayout.Button("Update ghost list")) { AddAllNewGhosts(target as GhostCollectionAuthoringComponent); } }
public override void OnInspectorGUI() { serializedObject.Update(); _reorderableList.DoLayoutList(); EditorGUILayout.PropertyField(DeveloperDescription); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { // base.OnInspectorGUI(); serializedObject.Update(); list = new ReorderableList( serializedObject, serializedObject.FindProperty("waves"), true, true, true, true); list.drawElementCallback = DrawListElementCallbackDelegate; list.DoLayoutList(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.Space(); reorderableList.DoLayoutList(); int index = reorderableList.index; SerializedProperty element = reorderableList.serializedProperty.GetArrayElementAtIndex(index); // element.isExpanded = true; // EditorGUILayout.PropertyField(element, true); foreach (SerializedProperty field in element) { EditorGUILayout.PropertyField(field); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); //EditorGUILayout.BeginVertical(StyleBlue); //EditorGUILayout.HelpBox("Apply Reactions to an Animal when the method React() is called", MessageType.None); //EditorGUILayout.EndVertical(); //EditorGUI.BeginDisabledGroup(true); //EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false); //EditorGUI.EndDisabledGroup(); EditorGUILayout.PropertyField(animal); Reo_List_Reactions.DoLayoutList(); if (Reo_List_Reactions.index != -1) { var element = reactions_List.GetArrayElementAtIndex(Reo_List_Reactions.index); //EditorGUI.BeginDisabledGroup(true); //EditorGUILayout.PropertyField(element,GUIContent.none); //EditorGUI.EndDisabledGroup(); DrawElement(element); } if (m.reactions != null && m.reactions.Count > 0 && Application.isPlaying) { EditorGUI.BeginDisabledGroup(!m.Animal); for (int i = 0; i < m.reactions.Count; i++) { if (GUILayout.Button("React [" + m.reactions[i].fullName + "]")) { m.React(i); } } EditorGUI.EndDisabledGroup(); } serializedObject.ApplyModifiedProperties(); //base.OnInspectorGUI(); }
public override void OnInspectorGUI() { serializedObject.Update(); //EditorGUILayout.BeginVertical(StyleBlue); //EditorGUILayout.HelpBox("Apply Modifications to any stat on the 'Stats' Component", MessageType.None); //EditorGUILayout.EndVertical(); //EditorGUI.BeginDisabledGroup(true); //EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false); //EditorGUI.EndDisabledGroup(); EditorGUILayout.PropertyField(stats); RList_modifiers.DoLayoutList(); EditorGUI.BeginDisabledGroup(!m.stats); if (Application.isPlaying && GUILayout.Button("Modify Stat")) { m.Modify(); } EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (_prefabList == null) { SetupPrefabList(); } base.OnInspectorGUI(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Placement mode:", EditorStyles.boldLabel); GUILayout.Label(PrefabPlacer.PlacementMode ? "ACTIVE" : "Inactive", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); if (PrefabPlacer.PlacementMode) { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(string.Format("Last Hit: {0}, {1}, {2}", PrefabPlacer.LastHit.x, PrefabPlacer.LastHit.y, PrefabPlacer.LastHit.z)); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Separator(); if (GUILayout.Button("Toggle Placement Mode")) { PrefabPlacer.TogglePlacementMode(); } EditorGUILayout.Separator(); EditorGUI.BeginChangeCheck(); _prefabList.DoLayoutList(); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); var properties = target.GetType().GetProperties(); serializedObject.Update(); SerializedProperty iterator = serializedObject.GetIterator(); for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false) { EditorGUI.BeginChangeCheck(); if (iterator.isArray && iterator.propertyType != SerializedPropertyType.String) { var list = new ReorderableList(iterator.serializedObject, iterator,true,true,true,true); list.drawHeaderCallback += rect => GUI.Label(rect, iterator.displayName); list.drawElementCallback += (rect, index, active, focused) => { rect.height = 16; rect.y += 2; EditorGUI.PropertyField(rect, list.serializedProperty.GetArrayElementAtIndex(index), GUIContent.none); }; list.DoLayoutList(); // list.DoList(EditorGUILayout.); } else { EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]); } if (EditorGUI.EndChangeCheck()) { var propertyName = iterator.name.ToLower().Substring(1); var propertyInfo = properties.FirstOrDefault(p => p.Name.ToLower() == propertyName); if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof (int)) { propertyInfo.SetValue(target, iterator.intValue,null); } if (propertyInfo.PropertyType == typeof(AnimationCurve)) { propertyInfo.SetValue(target, iterator.animationCurveValue, null); } if (propertyInfo.PropertyType == typeof(Color)) { propertyInfo.SetValue(target, iterator.colorValue, null); } if (propertyInfo.PropertyType == typeof(Quaternion)) { propertyInfo.SetValue(target, iterator.quaternionValue, null); } if (propertyInfo.PropertyType == typeof(float)) { propertyInfo.SetValue(target, iterator.floatValue, null); } if (propertyInfo.PropertyType == typeof(bool)) { propertyInfo.SetValue(target, iterator.boolValue, null); } if (propertyInfo.PropertyType == typeof(Bounds)) { propertyInfo.SetValue(target, iterator.boundsValue, null); } if (propertyInfo.PropertyType == typeof(string)) { propertyInfo.SetValue(target, iterator.stringValue, null); } if (propertyInfo.PropertyType == typeof(Vector2)) { propertyInfo.SetValue(target, iterator.vector2Value, null); } if (propertyInfo.PropertyType == typeof(Vector3)) { propertyInfo.SetValue(target, iterator.vector3Value, null); } if (propertyInfo.PropertyType == typeof(Vector4)) { propertyInfo.SetValue(target, iterator.vector4Value, null); } if (typeof(Enum).IsAssignableFrom(propertyInfo.PropertyType)) { propertyInfo.SetValue(target, Enum.GetValues(propertyInfo.PropertyType).GetValue(iterator.enumValueIndex), null); } } } } serializedObject.ApplyModifiedProperties(); if (InvertApplication.Container != null) { InvertApplication.SignalEvent<IDrawUnityInspector>(_ => _.DrawInspector(target)); } }
void OnGUI() { EditorGUI.BeginDisabledGroup(!eventTemp.isEnable); { EditorGUILayout.BeginHorizontal(); eventTemp.normalizedTime = Mathf.Clamp(EditorGUILayout.FloatField("Normalized Time", eventTemp.normalizedTime), 0.0f, 1.0f); if (GUILayout.Button("Current", GUILayout.MaxWidth(60))) { eventTemp.normalizedTime = editor.PlaybackTime; } EditorGUILayout.EndHorizontal(); eventTemp.functionName = EditorGUILayout.TextField("Message", eventTemp.functionName); eventTemp.paramType = (MecanimEventParamTypes)EditorGUILayout.EnumPopup("Parameter Type", eventTemp.paramType); switch (eventTemp.paramType) { case MecanimEventParamTypes.Int32: eventTemp.intParam = EditorGUILayout.IntField("Parameter", eventTemp.intParam); break; case MecanimEventParamTypes.Float: eventTemp.floatParam = EditorGUILayout.FloatField("Parameter", eventTemp.floatParam); break; case MecanimEventParamTypes.String: eventTemp.stringParam = EditorGUILayout.TextField("Parameter", eventTemp.stringParam); break; case MecanimEventParamTypes.Boolean: eventTemp.boolParam = EditorGUILayout.Popup(new GUIContent("Parameter"), eventTemp.boolParam == true ? 1 : 0, booleanPopup) == 1 ? true : false; break; } GUIContent toggleLabel = new GUIContent("Critical", "A critical event won't be missed even state was interrupted."); eventTemp.critical = EditorGUILayout.Toggle(toggleLabel, eventTemp.critical); if (availableParameters.Length > 0) { conditionList.DoLayoutList(); } else { eventTemp.condition.conditions.Clear(); } GUILayout.Space(10); GUILayout.FlexibleSpace(); } EditorGUI.EndDisabledGroup(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Copy", GUILayout.MinWidth(60))) { MecanimEventEditor.clipboard = new MecanimEvent(eventTemp); } EditorGUI.BeginDisabledGroup(MecanimEventEditor.clipboard == null); if (GUILayout.Button("Paste", GUILayout.MinWidth(60))) { eventTemp = new MecanimEvent(MecanimEventEditor.clipboard); } EditorGUI.EndDisabledGroup(); if (GUILayout.Button(eventTemp.isEnable?"Disable":"Enable")) { eventTemp.isEnable = !eventTemp.isEnable; } GUILayout.FlexibleSpace(); GUILayout.Space(20); if (GUILayout.Button("Save", GUILayout.MinWidth(80))) { eventEditing.normalizedTime = eventTemp.normalizedTime; eventEditing.functionName = eventTemp.functionName; eventEditing.paramType = eventTemp.paramType; eventEditing.intParam = eventTemp.intParam; eventEditing.floatParam = eventTemp.floatParam; eventEditing.stringParam = eventTemp.stringParam; eventEditing.boolParam = eventTemp.boolParam; eventEditing.condition = eventTemp.condition; eventEditing.critical = eventTemp.critical; eventEditing.isEnable = eventTemp.isEnable; Close(); } // GUILayout.Space(20); // // if (GUILayout.Button("Delete", GUILayout.MinWidth(80))) { // editor.DelEvent(eventEditing); // Close(); // } GUILayout.Space(20); if (GUILayout.Button("Cancel", GUILayout.MinWidth(80))) { Close(); } GUILayout.Space(20); GUILayout.EndHorizontal(); GUILayout.Space(10); }
public override void OnInspectorGUI() { serializedObject.Update(); PrefabLoader loader = target as PrefabLoader; PrefabType prefabType = PrefabUtility.GetPrefabType(loader.gameObject); if (prefabType == PrefabType.PrefabInstance) { GUILayout.Label("Prefabの管理 (更新/復元はこのボタンで必ずすること)"); using (var scopeH = new GUILayout.HorizontalScope()) { if (GUILayout.Button("Select", EditorStyles.miniButtonLeft)) { loader.EditorExecSelect(); } if (GUILayout.Button("Revert", EditorStyles.miniButtonMid)) { loader.EditorExecRevert(); } if (GUILayout.Button("Apply", EditorStyles.miniButtonRight)) { loader.EditorExecApply(); loader.EditorExecInstantiate(); } } } if (prefabType != PrefabType.Prefab) { using (var scopeH = new GUILayout.HorizontalScope()) { if (GUILayout.Button("Instantiate", EditorStyles.miniButtonLeft)) { loader.EditorExecInstantiate(); } if (GUILayout.Button("Update TransformData", EditorStyles.miniButtonMid)) { loader.EditorExecUpdateTransformData(); } if (GUILayout.Button("Remove", EditorStyles.miniButtonRight)) { loader.EditorExecRemove(); } } } if (loader.IsNeedUpdateTransformData() && !Application.isPlaying) { EditorGUILayout.HelpBox( "子プレハブのTransform情報がシリアライズされていません\n" + "Update TransformDataで更新してください." , MessageType.Info); } GUILayout.Space(5f); EditorGUILayout.PropertyField(loadTiming, true); reorderableList.DoLayoutList(); serializedObject.ApplyModifiedProperties(); //EditorGUILayout.PropertyField (info, true); }
public void DoLayoutList() { #if UNITY_EDITOR list.DoLayoutList(); #endif }
protected virtual void DrawList() { RecreateList(); _reordList.DoLayoutList(); }
public void DoLayoutList() { m_List.DoLayoutList(); }
private void DrawListOfUserAction() { if (Event.current.type != EventType.Repaint) { if (indexToCopy != -1) { var newUserAction = new UserActionInfo(controller.UserActions[indexToCopy]); controller.UserActions.Insert(indexToCopy + 1, newUserAction); indexToCopy = -1; } if (toRemove != null) { controller.UserActions.Remove(toRemove); toRemove = null; } } GUILayout.Space(2); CalculateListItemsHeight(); if (reorderableList == null || reorderableList.count != controller.UserActions.Count) { reorderableList = new ReorderableList(controller.UserActions, null, true, false, true, false); reorderableList.drawElementCallback = DrawUserClickInfo; reorderableList.elementHeightCallback = index => heights[index]; reorderableList.drawElementBackgroundCallback = (Rect rect, int index, bool isActive, bool isFocused) => { if (Event.current.type == EventType.Layout || index == -1) { return; } Color c = GUI.backgroundColor; var userAction = (UserActionInfo)reorderableList.list[index]; if (userAction.SelectedAssertation == null || userAction.SelectedAssertation.methodInfo == null) { Debug.LogError(String.Format("UITestFlowRecorderWindow: SELECTED ASSERTATION OR ITS METHOD INFO IS NULL FOR ELEMENT #{0}", index)); toRemove = userAction; return; } var declaringType = userAction.SelectedAssertation.methodInfo.DeclaringType.Name; switch (declaringType) { case "Wait": case "AsyncWait": GUI.backgroundColor = new Color(0.827f, 0.859f, 0.827f); break; case "Check": case "AsyncCheck": GUI.backgroundColor = new Color(0.859f, 0.851f, 0.827f); break; case "Interact": GUI.backgroundColor = new Color(0.827f, 0.831f, 0.85f); break; } if (isActive) { GUI.backgroundColor *= new Color(0.8f, 0.8f, 0.8f, 1); } rect.y += 1; rect.height = GetHeight(index, isActive) - 2; rect.x = 3; rect.width -= 6; GUI.Box(rect, ""); GUI.backgroundColor = c; }; reorderableList.onReorderCallback = (ReorderableList list) => { CalculateListItemsHeight(); }; reorderableList.onAddCallback = (ReorderableList list) => { controller.CreateNoGameobjectAction(); }; } m_NonDragTargetIndices = (List <int>) typeof(UnityEditorInternal.ReorderableList).GetField("m_NonDragTargetIndices", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(reorderableList); reorderableList.DoLayoutList(); Repaint(); }