コード例 #1
0
		public void OnEnable() {
			data = (InkLibrary) target;
			list = new ReorderableList(data.inkLibrary, typeof(InkFile), false, true, false, false);
//			list.elementHeight = 60;
			list.drawHeaderCallback = (Rect rect) => {  
    			EditorGUI.LabelField(rect, "Ink Library");
			};

			list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
				InkFile inkFile = ((List<InkFile>)list.list)[index];
				Rect objectFieldRect = new Rect(rect.x, rect.y, rect.width - 80, rect.height-4);
				if(!inkFile.isMaster) {
					objectFieldRect.x += 14;
					objectFieldRect.width -= 14;
				}
				Rect selectRect = new Rect(objectFieldRect.xMax, rect.y, 80, rect.height-4);
//				Rect titleRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
//				Rect inkAssetRect = new Rect(rect.x, rect.y + EditorGUIUtility.singleLineHeight * 1, rect.width, EditorGUIUtility.singleLineHeight);
//				Rect jsonAssetRect = new Rect(rect.x, rect.y + EditorGUIUtility.singleLineHeight * 2, rect.width, EditorGUIUtility.singleLineHeight);
//
//				inkFile.compileAutomatically = EditorGUI.Toggle(titleRect, "Compile Automatically", inkFile.compileAutomatically);
				EditorGUI.BeginDisabledGroup(true);
				inkFile.inkAsset = EditorGUI.ObjectField(objectFieldRect, inkFile.inkAsset, typeof(DefaultAsset)) as DefaultAsset;
				EditorGUI.EndDisabledGroup();
				if(GUI.Button(selectRect, "Select")) {
					Selection.activeObject = inkFile.inkAsset;
				}
//				inkFile.jsonAsset = EditorGUI.ObjectField(jsonAssetRect, new GUIContent("JSON File"), inkFile.jsonAsset, typeof(TextAsset)) as TextAsset;
			};
		}
        private void StartOnGUI(SerializedProperty property, GUIContent label)
        {
            _currentProp = property;
            _label = label;
            _currentKeysProp = _currentProp.FindPropertyRelative("_keys");
            _currentValuesProp = _currentProp.FindPropertyRelative("_values");

            _currentValuesProp.arraySize = _currentKeysProp.arraySize;

            _lst = CachedReorderableList.GetListDrawer(_currentKeysProp, _lst_DrawHeader, _lst_DrawElement, _lst_OnAdd, _lst_OnRemove);
            //_lst.draggable = false;




            if(this.fieldInfo != null)
            {
                var attrib = this.fieldInfo.GetCustomAttributes(typeof(VariantCollection.AsPropertyListAttribute), false).FirstOrDefault() as VariantCollection.AsPropertyListAttribute;
                _propertyListTargetType = (attrib != null) ? attrib.TargetType : null;
                if(attrib != null && attrib.TargetType != null)
                {
                    _propertyListTargetType = attrib.TargetType;

                    _propertyListMembers = (from m
                                             in DynamicUtil.GetEasilySerializedMembersFromType(_propertyListTargetType, System.Reflection.MemberTypes.Field | System.Reflection.MemberTypes.Property, DynamicMemberAccess.Write)
                                            select m).ToArray();
                    _propertyListNames = (from m in _propertyListMembers select m.Name).ToArray();
                }
            }
        }
コード例 #3
0
    private void OnEnable()
    {
        if (l != null)
        {
            return;
        }

        var targetList = serializedObject.FindProperty("rList");

        l = new ReorderableList(serializedObject, targetList, true, true, true, true);

        l.elementHeightCallback = (index) =>
        {
            int r = targetList.GetArrayElementAtIndex(index).intValue;
            return(EditorGUIUtility.singleLineHeight * (r > 0 ? r : 1));
        };

        l.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            EditorGUI.LabelField(rect, "", GUI.skin.box);

            Rect cur = rect;
            cur.height = EditorGUIUtility.singleLineHeight;

            EditorGUI.PropertyField(cur, targetList.GetArrayElementAtIndex(index),
                                    new GUIContent(string.Format("customInfos,high is {0}*singleLine", targetList.GetArrayElementAtIndex(index).intValue)));
        };
        l.onAddCallback = (ReorderableList list) =>
        {
            targetList.InsertArrayElementAtIndex(targetList.arraySize);
        };
    }
コード例 #4
0
        public void SetupList()
        {
            data.tempVariablesList = new List <BlackboardSystem.BlackBoard.VariablesData>();

            foreach (var key in data.variables.Keys)
            {
                data.tempVariablesList.Add(new BlackboardSystem.BlackBoard.VariablesData(key.ToString()));
            }

            reorderableList = new ReorderableList(
                serializedObject, serializedObject.FindProperty("tempVariablesList"), true, true, true, true
                );

            reorderableList.drawElementCallback          = DrawListItems;    // Delegate to draw the elements on the list
            reorderableList.drawHeaderCallback           = DrawHeader;
            reorderableList.onAddDropdownCallback        = AddDropdownCallback;
            reorderableList.onReorderCallbackWithDetails = OnReorder;
            reorderableList.onRemoveCallback             = OnRemove;
            reorderableList.elementHeightCallback        = OnHeightCallback;
            reorderableList.onMouseDragCallback          = OnMouseDrag;
            reorderableList.onMouseUpCallback            = OnMouseUp;
            reorderableList.onSelectCallback             = OnSelect;

            //reorderableList.drawElementBackgroundCallback = DrawBackgroundList;

            linkIcon = EditorHelpers.LoadIcon("linkIcon.png");
            dragIcon = EditorHelpers.LoadGraphic("dragIcon.png");
        }
コード例 #5
0
        private void OnAddCallback(InternalList _list)
        {
            var index = _list.serializedProperty.arraySize;

            _list.serializedProperty.arraySize++;
            _list.index = _list.serializedProperty.arraySize - 1;
        }
コード例 #6
0
 private void OnDisable() {
     if (reorderableList == null) return;
     reorderableList.drawElementCallback -= DrawElement;
     reorderableList.drawHeaderCallback -= DrawHeader;
     reorderableList.onAddCallback -= AddTag;
     reorderableList = null;
 }
コード例 #7
0
        protected override void OnEnable()
        {
            base.OnEnable();
            m_Material           = serializedObject.FindProperty("m_Material");
            m_ShaderPass         = serializedObject.FindProperty("m_ShaderPass");
            m_InitializationMode = serializedObject.FindProperty("m_InitializationMode");
            m_InitSource         = serializedObject.FindProperty("m_InitSource");
            m_InitColor          = serializedObject.FindProperty("m_InitColor");
            m_InitTexture        = serializedObject.FindProperty("m_InitTexture");
            m_InitMaterial       = serializedObject.FindProperty("m_InitMaterial");
            m_UpdateMode         = serializedObject.FindProperty("m_UpdateMode");
            m_UpdatePeriod       = serializedObject.FindProperty("m_UpdatePeriod");
            m_UpdateZoneSpace    = serializedObject.FindProperty("m_UpdateZoneSpace");
            m_UpdateZones        = serializedObject.FindProperty("m_UpdateZones");
            m_WrapUpdateZones    = serializedObject.FindProperty("m_WrapUpdateZones");
            m_DoubleBuffered     = serializedObject.FindProperty("m_DoubleBuffered");
            m_CubeFaceMask       = serializedObject.FindProperty("m_CubemapFaceMask");

            m_RectList = new UnityEditorInternal.ReorderableList(serializedObject, m_UpdateZones);
            m_RectList.drawElementCallback   = OnDrawElement;
            m_RectList.drawHeaderCallback    = OnDrawHeader;
            m_RectList.onAddCallback         = OnAdd;
            m_RectList.onRemoveCallback      = OnRemove;
            m_RectList.elementHeightCallback = OnElementHeight;
            m_RectList.footerHeight          = 0;

            m_ShowInitSourceAsMaterial.value = !m_InitSource.hasMultipleDifferentValues && (m_InitSource.intValue == (int)CustomRenderTextureInitializationSource.Material);
            m_ShowInitSourceAsMaterial.valueChanged.AddListener(Repaint);
        }
コード例 #8
0
 public void AddButton(Rect rect, ReorderableList list)
 {
     GenericMenu menu = new GenericMenu();
     menu.AddItem(new GUIContent("Add Motion Field"), false, new GenericMenu.MenuFunction(this.AddChildAnimation));
     menu.AddItem(EditorGUIUtility.TempContent("New Blend Tree"), false, new GenericMenu.MenuFunction(this.AddBlendTreeCallback));
     menu.Popup(rect, 0);
 }
コード例 #9
0
 protected virtual void AddTag(ReorderableList list) {
     int index = list.serializedProperty.arraySize;
     list.serializedProperty.arraySize++;
     list.index = index;
     var newElement = property.GetArrayElementAtIndex(index);
     newElement.FindPropertyRelative("name").stringValue = "New Tag";
 }
コード例 #10
0
 private void AddToSortLayerList(ReorderableList list)
 {
     base.serializedObject.ApplyModifiedProperties();
     InternalEditorUtility.AddSortingLayer();
     base.serializedObject.Update();
     list.index = list.serializedProperty.arraySize - 1;
 }
コード例 #11
0
        public void OnEnable()
        {
            prop_FontAsset = serializedObject.FindProperty("fontAsset");
            prop_SpriteAsset = serializedObject.FindProperty("spriteAsset");
            prop_StyleSheet = serializedObject.FindProperty("styleSheet");

            m_list = new ReorderableList(serializedObject, serializedObject.FindProperty("fallbackFontAssets"), true, true, true, true);

            m_list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
            {
                var element = m_list.serializedProperty.GetArrayElementAtIndex(index);
                rect.y += 2;
                EditorGUI.PropertyField( new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none);
            };

            m_list.drawHeaderCallback = rect =>
            {
                EditorGUI.LabelField(rect, "<b>Fallback Font Asset List</b>", TMP_UIStyleManager.Label);
            };

            prop_WordWrapping = serializedObject.FindProperty("enableWordWrapping");
            prop_Kerning = serializedObject.FindProperty("enableKerning");
            prop_ExtraPadding = serializedObject.FindProperty("enableExtraPadding");
            prop_TintAllSprites = serializedObject.FindProperty("enableTintAllSprites");

            prop_WarningsDisabled = serializedObject.FindProperty("warningsDisabled");

            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();
        }
コード例 #12
0
        void CreateListWithObject(SerializedObject obj, string propertyName, string label)
        {
            var property = obj.FindProperty(propertyName);

            this.label = string.IsNullOrEmpty(label) ? property.displayName : label;

            List = new ReorderableList(obj, property);
            List.drawHeaderCallback = (Rect rect) => {
                EditorGUI.LabelField(rect, List.count.ToString(), EditorExtensions.GetLabelGUIStyle(TextAnchor.MiddleRight));
                rect.xMin          += 10;
                property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, this.label, true);
            };
            List.drawElementCallback += (Rect rect, int index, bool selected, bool focused) => {
                if (!property.isExpanded)
                {
                    GUI.enabled = index == List.count;
                    return;
                }
                rect.height -= 4;
                rect.y      += 2;
                SerializedProperty element = List.serializedProperty.GetArrayElementAtIndex(index);
                EditorGUI.PropertyField(rect, element, GUIContent.none);
            };
            List.elementHeightCallback = (int indexer) => {
                if (!property.isExpanded)
                {
                    return(0);
                }
                else
                {
                    return(List.elementHeight);
                }
            };
        }
コード例 #13
0
 void OnChange(UnityEditorInternal.ReorderableList list)
 {
     if (onChangedCallback != null)
     {
         onChangedCallback(this);
     }
 }
コード例 #14
0
        private void OnVertexStreamListAddDropdownCallback(Rect rect, UnityEditorInternal.ReorderableList list)
        {
            List <int> notEnabled = new List <int>();

            for (int i = 0; i < s_Texts.vertexStreamsPacked.Length; ++i)
            {
                bool exists = false;
                for (int j = 0; j < m_VertexStreams.arraySize; ++j)
                {
                    if (m_VertexStreams.GetArrayElementAtIndex(j).intValue == i)
                    {
                        exists = true;
                        break;
                    }
                }

                if (!exists)
                {
                    notEnabled.Add(i);
                }
            }

            GenericMenu menu = new GenericMenu();

            for (int i = 0; i < notEnabled.Count; ++i)
            {
                menu.AddItem(s_Texts.vertexStreamsMenuContent[notEnabled[i]], false, SelectVertexStreamCallback, new StreamCallbackData(list, m_VertexStreams, notEnabled[i]));
            }
            menu.ShowAsContext();
            Event.current.Use();
        }
コード例 #15
0
 public void RecreateListControl()
 {
   if ((UnityEngine.Object) this.m_Controller == (UnityEngine.Object) null)
     return;
   this.m_Views = new List<MixerGroupView>((IEnumerable<MixerGroupView>) this.m_Controller.views);
   if (this.m_Views.Count == 0)
   {
     this.m_Views.Add(new MixerGroupView()
     {
       guids = this.m_Controller.GetAllAudioGroupsSlow().Select<AudioMixerGroupController, GUID>((Func<AudioMixerGroupController, GUID>) (gr => gr.groupID)).ToArray<GUID>(),
       name = "View"
     });
     this.SaveToBackend();
   }
   ReorderableList list = new ReorderableList((IList) this.m_Views, typeof (MixerGroupView), true, false, false, false);
   list.onReorderCallback += new ReorderableList.ReorderCallbackDelegate(this.EndDragChild);
   list.elementHeight = 16f;
   list.headerHeight = 0.0f;
   list.footerHeight = 0.0f;
   list.showDefaultBackground = false;
   list.index = this.m_Controller.currentViewIndex;
   if (this.m_Controller.currentViewIndex >= list.count)
     Debug.LogError((object) ("State mismatch, currentViewIndex: " + (object) this.m_Controller.currentViewIndex + ", num items: " + (object) list.count));
   this.m_ReorderableListWithRenameAndScrollView = new ReorderableListWithRenameAndScrollView(list, this.m_State);
   this.m_ReorderableListWithRenameAndScrollView.onSelectionChanged += new System.Action<int>(this.SelectionChanged);
   this.m_ReorderableListWithRenameAndScrollView.onNameChangedAtIndex += new System.Action<int, string>(this.NameChanged);
   this.m_ReorderableListWithRenameAndScrollView.onDeleteItemAtIndex += new System.Action<int>(this.Delete);
   this.m_ReorderableListWithRenameAndScrollView.onGetNameAtIndex += new Func<int, string>(this.GetNameOfElement);
   this.m_ReorderableListWithRenameAndScrollView.onCustomDrawElement += new ReorderableList.ElementCallbackDelegate(this.CustomDrawElement);
 }
コード例 #16
0
ファイル: BookmarkList.cs プロジェクト: KellyeAnnora/GGJ2020
 protected override void onSelectCallback(UnityEditorInternal.ReorderableList list)
 {
     if (onBookmarkSelected != null)
     {
         onBookmarkSelected(this.list[list.index]);
     }
 }
コード例 #17
0
 void OnEnable()
 {
     _targetList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(PROP_TARGETS), true, true, true, true);
     _targetList.drawHeaderCallback = _targetList_DrawHeader;
     _targetList.drawElementCallback = _targetList_DrawElement;
     _targetList.onAddCallback = _targetList_OnAdd;
 }
コード例 #18
0
        public static CachedReorderableList GetListDrawer(SerializedProperty property, ReorderableList.HeaderCallbackDelegate drawHeaderCallback, ReorderableList.ElementCallbackDelegate drawElementCallback,
            ReorderableList.AddCallbackDelegate onAddCallback = null, ReorderableList.RemoveCallbackDelegate onRemoveCallback = null, ReorderableList.SelectCallbackDelegate onSelectCallback = null,
            ReorderableList.ChangedCallbackDelegate onChangedCallback = null, ReorderableList.ReorderCallbackDelegate onReorderCallback = null, ReorderableList.CanRemoveCallbackDelegate onCanRemoveCallback = null,
            ReorderableList.AddDropdownCallbackDelegate onAddDropdownCallback = null)
        {
            if (property == null) throw new System.ArgumentNullException("property");
            if (!property.isArray) throw new System.ArgumentException("SerializedProperty must be a property for an Array or List", "property");

            int hash = com.spacepuppyeditor.Internal.PropertyHandlerCache.GetPropertyHash(property);
            CachedReorderableList lst;
            if (_lstCache.TryGetValue(hash, out lst))
            {
                lst.serializedProperty = property;
            }
            else
            {
                lst = new CachedReorderableList(property.serializedObject, property);
                _lstCache[hash] = lst;
            }

            lst.drawHeaderCallback = drawHeaderCallback;
            lst.drawElementCallback = drawElementCallback;
            lst.onAddCallback = onAddCallback;
            lst.onRemoveCallback = onRemoveCallback;
            lst.onSelectCallback = onSelectCallback;
            lst.onChangedCallback = onChangedCallback;
            lst.onReorderCallback = onReorderCallback;
            lst.onCanRemoveCallback = onCanRemoveCallback;
            lst.onAddDropdownCallback = onAddDropdownCallback;

            return lst;
        }
コード例 #19
0
        private void OnEnable()
        {
            instance = target as TouchManager;
            layers = serializedObject.FindProperty("layers");
            displayDevice = serializedObject.FindProperty("displayDevice");
            useSendMessage = serializedObject.FindProperty("useSendMessage");
            sendMessageTarget = serializedObject.FindProperty("sendMessageTarget");
            sendMessageEvents = serializedObject.FindProperty("sendMessageEvents");

            refresh();

            layersList = new ReorderableList(serializedObject, layers, true, true, false, false);
            layersList.drawHeaderCallback += rect => GUI.Label(rect, LAYERS_HEADER);
            layersList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                rect.y += 2;
                if (index >= layers.arraySize) return;
                var layer = layers.GetArrayElementAtIndex(index).objectReferenceValue as TouchLayer;
                if (layer == null)
                {
                    EditorGUI.LabelField(rect, "null");
                    return;
                }
                EditorGUI.LabelField(rect, layer.Name);
            };
        }
コード例 #20
0
		private void OnAddItem(ReorderableList list)
		{
			ReorderableList.defaultBehaviours.DoAddButton(list);

			SerializedProperty col = colorsProperty.GetArrayElementAtIndex(list.index);
			col.colorValue = Color.white;
		}
コード例 #21
0
        protected virtual void OnEnable()
        {
            // String Tables property
            stringTablesProp = serializedObject.FindProperty("stringTables");
            stringTablesList = new ReorderableList(serializedObject, stringTablesProp, true, true, true, true);

            stringTablesList.drawHeaderCallback = (Rect rect) => {  
                EditorGUI.LabelField(rect, "String Tables");
            };

            stringTablesList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { 
                Rect r = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
                SerializedProperty element = stringTablesProp.GetArrayElementAtIndex(index);
                EditorGUI.PropertyField(r, element, new GUIContent(""));
            };

            // Register Types property   
            registerTypesProp = serializedObject.FindProperty("registerTypes");
            registerTypeList = new ReorderableList(serializedObject, registerTypesProp, true, true, true, true);

            registerTypeList.drawHeaderCallback = (Rect rect) => {  
                EditorGUI.LabelField(rect, "Type Lists");
            };

            registerTypeList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { 
                Rect r = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight);
                SerializedProperty element = registerTypesProp.GetArrayElementAtIndex(index);
                EditorGUI.PropertyField(r, element, new GUIContent(""));
            };
        }
コード例 #22
0
    public void Recreate()
    {
        GenericParamUtils.SetDrawersForKnownTypes();

        _drawerList = new ReorderableList
                      (
            Parameters, typeof(GenericParameter),
            true, false, true, true
                      );

        DrawerList.drawHeaderCallback += rect =>
        {
            rect.x     += ReorderableListOffset;
            rect.width -= ReorderableListOffset;

            var original = rect;

            rect.width *= 0.5f;
            GUI.Label(rect, "Name");


            rect.x     = original.x + rect.width;
            rect.width = GenericParamUtils.FieldWidth;
            GUI.Label(rect, "Value");
        };

        if (!CustomAdd)
        {
            DrawerList.onAddDropdownCallback += OnAddParameter;
        }

        DrawerList.drawElementCallback += OnDrawParameter;
    }
コード例 #23
0
        protected virtual void OnEnable()
        {
            hideFlags = HideFlags.HideAndDontSave;

            instance = target as Gesture;

            advanced = serializedObject.FindProperty("advancedProps");
            friendlyGestures = serializedObject.FindProperty("friendlyGestures");
            requireGestureToFail = serializedObject.FindProperty("requireGestureToFail");
            combineTouches = serializedObject.FindProperty("combineTouches");
            combineTouchesInterval = serializedObject.FindProperty("combineTouchesInterval");
            useSendMessage = serializedObject.FindProperty("useSendMessage");
            sendMessageTarget = serializedObject.FindProperty("sendMessageTarget");
            sendStateChangeMessages = serializedObject.FindProperty("sendStateChangeMessages");

            friendlyGesturesList = new ReorderableList(serializedObject, friendlyGestures, false, false, false, true);
            friendlyGesturesList.headerHeight = 0;
            friendlyGesturesList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                var gesture = friendlyGestures.GetArrayElementAtIndex(index).objectReferenceValue as Gesture;
                if (gesture == null)
                {
                    // Killing null elements.
                    indexToRemove = index;
                    EditorGUI.LabelField(rect, GUIContent.none);
                    return;
                }
                EditorGUI.LabelField(rect, string.Format("{0} @ {1}", gesture.GetType().Name, gesture.name), GUIElements.BoxLabelStyle);
            };
            friendlyGesturesList.onRemoveCallback += list => { indexToRemove = list.index; };
        }
コード例 #24
0
	protected virtual void OnEnable(){
		database = ItemDatabase.Load ();

		parameterTypeNames = TypeUtility.GetSubTypeNames (typeof(FsmVariable));
		parameterTypeNames = ArrayUtility.Insert<string> (parameterTypeNames, "None", 0);

		customDataList = new ReorderableList(serializedObject, 
		                                     serializedObject.FindProperty("customData"), 
		                                     true, true, true, true);
		customDataList.elementHeight = EditorGUIUtility.singleLineHeight * 3+10;
		customDataList.onRemoveCallback = (ReorderableList list) => {
			list.serializedProperty.serializedObject.Update();
			DestroyImmediate(list.serializedProperty.GetArrayElementAtIndex(list.index).objectReferenceValue,true);
			AssetDatabase.SaveAssets();
			list.serializedProperty.DeleteArrayElementAtIndex(list.index);
			list.serializedProperty.serializedObject.ApplyModifiedProperties();
		};

		customDataList.drawElementCallback =  (Rect rect, int index, bool isActive, bool isFocused) => {
			var element = customDataList.serializedProperty.GetArrayElementAtIndex(index);
			FsmVariable variable = element.objectReferenceValue as FsmVariable;
			rect.y+=2;
			int m = parameterTypeNames.ToList ().FindIndex (x => x == (variable!= null?variable.GetType ().Name:""));
			m = Mathf.Clamp (m, 0, int.MaxValue);
			rect.height=EditorGUIUtility.singleLineHeight;
			m = EditorGUI.Popup (rect,"Parameter Type", m, parameterTypeNames);
			string typeName=parameterTypeNames [m];
			string variableTypeName = (variable == null ? "None" : variable.GetType ().Name);

			if(typeName != variableTypeName){
				DestroyImmediate(element.objectReferenceValue,true);
				if(typeName != "None"){
					variable = ScriptableObject.CreateInstance (TypeUtility.GetTypeByName(typeName)[0]) as FsmVariable;
					variable.hideFlags = HideFlags.HideInHierarchy;
					
					if (EditorUtility.IsPersistent (element.serializedObject.targetObject)) {
						AssetDatabase.AddObjectToAsset (variable, element.serializedObject.targetObject);
						AssetDatabase.SaveAssets ();
					}
					
					element.serializedObject.Update();
					element.objectReferenceValue = variable;
					element.serializedObject.ApplyModifiedProperties ();
				}
			}
			if(variable != null){
				SerializedObject mVariable=new SerializedObject(variable);
				mVariable.Update();
				rect.y+=EditorGUIUtility.singleLineHeight+2;
				EditorGUI.PropertyField(rect,mVariable.FindProperty("name"));
				rect.y+=EditorGUIUtility.singleLineHeight+2;
				EditorGUI.PropertyField(rect,mVariable.FindProperty("value"));
				mVariable.ApplyModifiedProperties();
			}
		};
		customDataList.drawHeaderCallback = (Rect rect) => {  
			EditorGUI.LabelField(rect, "Custom Data");
		};
	}
コード例 #25
0
 bool OnCanRemove(UnityEditorInternal.ReorderableList list)
 {
     if (list.count <= minItems)
     {
         return(false);
     }
     return(true);
 }
コード例 #26
0
 protected void SetupReorderableList()
 {
     reorderableList = new ReorderableList( so, so.FindProperty("idColors"), true, true, true, true );
       reorderableList.drawElementCallback = ReorderableDrawElement;
       reorderableList.drawHeaderCallback = ReorderableDrawHeader;
       reorderableList.onReorderCallback = ReorderableReorder;
       return;
 }
コード例 #27
0
 /// <summary>
 /// Called at the start of the editor to initialize all needed elements
 /// </summary>
 /// <param name="editor"></param>
 public override void Initialize(ObjectEditor editor)
 {
     base.Initialize(editor);
     LoadData();
     m_ExclusionReorderList = new ReorderableList(m_Data.Exclusions, typeof(string), true, true, true, true);
     m_ExclusionReorderList.drawElementCallback += OnDrawExclusionElement;
     m_ExclusionReorderList.onAddCallback += OnAddExclusionElement;
 }
コード例 #28
0
 private ReorderableList GetList(SerializedProperty property) {
     if (reorderableList != null) return reorderableList;
     reorderableList = new ReorderableList(property.serializedObject, property, true, true, true, true);
     reorderableList.drawElementCallback += DrawElement;
     reorderableList.drawHeaderCallback += DrawHeader;
     reorderableList.onAddCallback += AddTag;
     return reorderableList;
 }
コード例 #29
0
 private void RefreshList()
 {
     targetList = new UnityEditorInternal.ReorderableList(targets, typeof(ToggleObject), false, true, true, false)
     {
         drawElementCallback = DrawElement,
         drawHeaderCallback  = DrawHeader
     };
 }
コード例 #30
0
		private void AddToTagsList(ReorderableList list)
		{
			int arraySize = this.m_Tags.arraySize;
			this.m_Tags.InsertArrayElementAtIndex(arraySize);
			SerializedProperty arrayElementAtIndex = this.m_Tags.GetArrayElementAtIndex(arraySize);
			arrayElementAtIndex.stringValue = "New Tag";
			list.index = list.serializedProperty.arraySize - 1;
		}
コード例 #31
0
    protected void HandleOnAdd(UnityEditorInternal.ReorderableList p_list)
    {
        List <AOTKeyValuePair <int, GameObject> > v_clonedList = p_list.list is List <AOTKeyValuePair <int, GameObject> >?(p_list.list as List <AOTKeyValuePair <int, GameObject> >).CloneList() : new List <AOTKeyValuePair <int, GameObject> >();

        v_clonedList.Add(new AOTKeyValuePair <int, GameObject>());
        FillSelectedWithList(v_clonedList, false, true);
        _needRecreateList = true;
    }
コード例 #32
0
 public ReorderableListWithRenameAndScrollView(ReorderableList list, State state)
 {
     this.m_State = state;
     this.m_ReorderableList = list;
     this.m_ReorderableList.drawElementCallback = (ReorderableList.ElementCallbackDelegate) Delegate.Combine(this.m_ReorderableList.drawElementCallback, new ReorderableList.ElementCallbackDelegate(this.DrawElement));
     this.m_ReorderableList.onSelectCallback = (ReorderableList.SelectCallbackDelegate) Delegate.Combine(this.m_ReorderableList.onSelectCallback, new ReorderableList.SelectCallbackDelegate(this.SelectCallback));
     this.m_ReorderableList.onMouseUpCallback = (ReorderableList.SelectCallbackDelegate) Delegate.Combine(this.m_ReorderableList.onMouseUpCallback, new ReorderableList.SelectCallbackDelegate(this.MouseUpCallback));
     this.m_ReorderableList.onReorderCallback = (ReorderableList.ReorderCallbackDelegate) Delegate.Combine(this.m_ReorderableList.onReorderCallback, new ReorderableList.ReorderCallbackDelegate(this.ReorderCallback));
 }
コード例 #33
0
 private UnityEventDrawer.State RestoreState(SerializedProperty property)
 {
   UnityEventDrawer.State state = this.GetState(property);
   this.m_ListenersArray = state.m_ReorderableList.serializedProperty;
   this.m_ReorderableList = state.m_ReorderableList;
   this.m_LastSelectedIndex = state.lastSelectedIndex;
   this.m_ReorderableList.index = this.m_LastSelectedIndex;
   return state;
 }
コード例 #34
0
    public override float GetPropertyHeight(SerializedProperty property, UnityEngine.GUIContent label)
    {
        if (list == null)
        {
            list = getList(property.FindPropertyRelative("List"));
        }

        return(list.GetHeight());
    }
コード例 #35
0
 private void Init(SerializedProperty property)
 {
   if (this.m_ReorderableList != null)
     return;
   SerializedProperty propertyRelative = property.FindPropertyRelative("m_Options");
   this.m_ReorderableList = new ReorderableList(property.serializedObject, propertyRelative);
   this.m_ReorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawOptionData);
   this.m_ReorderableList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawHeader);
   this.m_ReorderableList.elementHeight += 16f;
 }
コード例 #36
0
        protected override void OnEnable()
        {
            base.OnEnable();

            _dataList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(PROP_TWEENDATA));
            _dataList.drawHeaderCallback = _dataList_DrawHeader;
            _dataList.drawElementCallback = _dataList_DrawElement;
            _dataList.elementHeight = EditorGUIUtility.singleLineHeight * 6f + 7f;
            
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            _animList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(PROP_ANIMATIONS), true, true, true, true);
            _animList.drawHeaderCallback = this._animList_DrawHeader;
            _animList.drawElementCallback = this._animList_DrawElement;
            _animList.onAddCallback = this._animList_OnAdded;
            _animList.onRemoveCallback = this._animList_OnRemoved;
        }
コード例 #38
0
        protected override void onAddDropdownCallback(UnityEngine.Rect buttonRect, UnityEditorInternal.ReorderableList list)
        {
            var menu = new GenericMenu();

            foreach (var t in _availableTypes)
            {
                menu.AddItem(new GUIContent(TypeUtils.GetPrettyName(t)), false, clickHandler, t);
            }
            menu.ShowAsContext();
        }
コード例 #39
0
 void CreateSpawnerPresetList()
 {
     m_spawnerPresetList = new UnityEditorInternal.ReorderableList(m_biomePreset.m_spawnerPresetList, typeof(BiomeSpawnerListEntry), true, true, true, true);
     m_spawnerPresetList.elementHeightCallback = OnElementHeightSpawnerPresetListEntry;
     m_spawnerPresetList.drawElementCallback   = DrawSpawnerPresetListElement;
     m_spawnerPresetList.drawHeaderCallback    = DrawSpawnerPresetListHeader;
     m_spawnerPresetList.onAddCallback         = OnAddSpawnerPresetListEntry;
     m_spawnerPresetList.onRemoveCallback      = OnRemoveSpawnerPresetListEntry;
     m_spawnerPresetList.onReorderCallback     = OnReorderSpawnerPresetList;
 }
コード例 #40
0
ファイル: TagsDrawer.cs プロジェクト: RabitBox/FlickBattler
 private void initList(SerializedProperty property, GUIContent label)
 {
     list = new ReorderableList(property.serializedObject, property.FindPropertyRelative("tagList"), false, true, true, true);
     list.drawHeaderCallback += rect => GUI.Label(rect, label);
     list.drawElementCallback += (rect, index, active, focused) =>
     {
         rect.height = 16;
         rect.y += 2;
         EditorGUI.PropertyField(rect, list.serializedProperty.GetArrayElementAtIndex(index), GUIContent.none);
     };
 }
コード例 #41
0
 protected override void onRemoveCallback(UnityEditorInternal.ReorderableList list)
 {
     if (EditorUtility.DisplayDialog("Warning!", "Are you sure you want to delete this variable?", "Yes", "No"))
     {
         if (onVariableDeleted != null)
         {
             onVariableDeleted(this.list[list.index].ID, this.list[list.index].Name);
         }
         ReorderableList.defaultBehaviours.DoRemoveButton(list);
     }
 }
コード例 #42
0
 internal void AddButton(Rect rect, ReorderableList list)
 {
     this.m_SpawnListProperty.arraySize++;
     list.index = this.m_SpawnListProperty.arraySize - 1;
     SerializedProperty arrayElementAtIndex = this.m_SpawnListProperty.GetArrayElementAtIndex(this.m_SpawnListProperty.arraySize - 1);
     if (arrayElementAtIndex.objectReferenceValue != null)
     {
         arrayElementAtIndex.objectReferenceValue = null;
     }
     this.m_SpawnList.index = this.m_SpawnList.count - 1;
 }
コード例 #43
0
    private void OnEnable()
    {
        SerializedProperty items = serializedObject.FindProperty("_list");

        string title = "List (" + Target.Type + ")";

        _reorderableList = new ReorderableList(serializedObject, items, ELEMENT_DRAGGABLE, LIST_DISPLAY_HEADER, LIST_DISPLAY_ADD_BUTTON, LIST_DISPLAY_REMOVE_BUTTON);
        _reorderableList.drawHeaderCallback  += (Rect rect) => { EditorGUI.LabelField(rect, title); };
        _reorderableList.drawElementCallback += DrawElement;
        _reorderableList.onRemoveCallback    += Remove;
        _reorderableList.onChangedCallback   += (ReorderableList list) => { Repaint(); };
    }
コード例 #44
0
        private void Init(SerializedProperty property)
        {
            if (m_ReorderableList != null)
                return;

            SerializedProperty array = property.FindPropertyRelative("m_Options");

            m_ReorderableList = new ReorderableList(property.serializedObject, array);
            m_ReorderableList.drawElementCallback = DrawOptionData;
            m_ReorderableList.drawHeaderCallback = DrawHeader;
            m_ReorderableList.elementHeight += 16;
        }
コード例 #45
0
        protected override void onAddDropdownCallback(Rect buttonRect, UnityEditorInternal.ReorderableList list)
        {
            var menu = new GenericMenu();

            menu.AddItem(new GUIContent("Answer"), false, AddAnswer, AnswerType.Answer);
            if (_node.Answers.Find(x => x.Type == AnswerType.Time) == null)
            {
                menu.AddItem(new GUIContent("Time"), false, AddAnswer, AnswerType.Time);
            }

            menu.ShowAsContext();
        }
コード例 #46
0
        void OnEnable()
        {
            var collectionTarget = target as GhostCollectionAuthoringComponent;

            m_GhostList =
                new ReorderableList(collectionTarget.Ghosts, typeof(GhostCollectionAuthoringComponent.Ghost), true,
                                    true, true, true);
            m_GhostList.drawHeaderCallback  += DrawHeader;
            m_GhostList.drawElementCallback += DrawGhost;
            m_GhostList.onAddCallback       += AddGhost;
            m_GhostList.onRemoveCallback    += RemoveGhost;
        }
コード例 #47
0
        private ReorderableList CreateAnimReorderableList()
        {
            ReorderableList reordList = new ReorderableList(m_target.DirectionalAnimController.GetAnimList(), typeof(DirectionalAnimData), true, true, true, true);
            float elementHeight = m_target.DirectionalAnimController.DirectionsPerAnim <= 4 ? 64f : 128f;
            reordList.displayAdd = reordList.displayRemove = false;
            reordList.elementHeight = 0;
            reordList.draggable = reordList.elementHeight > 0f;
            reordList.drawHeaderCallback += (Rect rect) =>
            {
                EditorGUI.LabelField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), "Animations", EditorStyles.boldLabel);
                Texture2D btnTexture = reordList.elementHeight == 0f ? EditorGUIUtility.FindTexture("winbtn_win_max_h") : EditorGUIUtility.FindTexture("winbtn_win_min_h");
                if (GUI.Button(new Rect(rect.x + rect.width - EditorGUIUtility.singleLineHeight, rect.y, EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight), btnTexture, EditorStyles.label))
                {
                    reordList.elementHeight = reordList.elementHeight == 0f ? elementHeight : 0f;
                    reordList.draggable = reordList.elementHeight > 0f;
                }
            };
            reordList.drawElementCallback += (Rect rect, int index, bool isActive, bool isFocused) =>
            {
                if (reordList.elementHeight == 0f) return;
                DirectionalAnimData anim = (DirectionalAnimData)reordList.list[index];
                anim.name = GUI.TextField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), anim.name);

                int dirNb = m_target.DirectionalAnimController.DirectionsPerAnim;
                float frameWidth = rect.width / Mathf.Min(4, dirNb);
                int rowNb = 1 + (dirNb - 1) / 4;
                float frameHeight = (rect.height - EditorGUIUtility.singleLineHeight) / rowNb;
                for (int i = 0; i < dirNb; ++i)
                {
                    Vector2 dir = Quaternion.Euler(Vector3.forward * (((float)i / dirNb) * 360f)) * Vector3.down;
                    Sprite sprite = m_target.DirectionalAnimController.GetPreviewAnimSprite(dir, index);
                    if (sprite)
                    {
                        float aspectRatio = sprite.rect.width / sprite.rect.height;
                        Rect uv = new Rect() { position = Vector2.Scale(sprite.rect.position, sprite.texture.texelSize), size = Vector2.Scale(sprite.rect.size, sprite.texture.texelSize) };
                        Rect rAnim = new Rect(rect.x + frameWidth * (i % 4), rect.y + EditorGUIUtility.singleLineHeight + (i / 4) * frameHeight, frameHeight * aspectRatio, frameHeight);
                        GUI.DrawTextureWithTexCoords(rAnim, sprite.texture, uv);
                    }
                    else
                    {
                        Rect rBox = new Rect(rect.x + frameWidth * i, rect.y + EditorGUIUtility.singleLineHeight, frameWidth, rect.height - EditorGUIUtility.singleLineHeight);
                        GUI.Box(rBox, "");
                    }
                }
            };
            reordList.onSelectCallback += (ReorderableList list) =>
            {
                m_target.AnimIndex = m_animReordList.index;
                GUI.changed = true;
            };
            return reordList;
        }
コード例 #48
0
ファイル: CombineAssets.cs プロジェクト: sttz/trimmer-extras
    void OnEnable()
    {
        if (list == null)
        {
            assets = new List <Object>();
            list   = new UnityEditorInternal.ReorderableList(assets, typeof(Object));
            list.drawElementCallback = OnDrawElement;
            list.elementHeight       = 16;
        }

        paddingStyle         = new GUIStyle();
        paddingStyle.padding = new RectOffset(5, 5, 5, 5);
    }
コード例 #49
0
    protected void HandleOnRemove(UnityEditorInternal.ReorderableList p_list)
    {
        List <AOTKeyValuePair <int, GameObject> > v_clonedList = p_list.list is List <AOTKeyValuePair <int, GameObject> >?(p_list.list as List <AOTKeyValuePair <int, GameObject> >).CloneList() : new List <AOTKeyValuePair <int, GameObject> >();

        try
        {
            int v_index = p_list.index >= 0 && p_list.index < v_clonedList.Count? p_list.index : v_clonedList.Count - 1;
            v_clonedList.RemoveAt(v_index);
        }
        catch {}
        FillSelectedWithList(v_clonedList, false, true);
        _needRecreateList = true;
    }
コード例 #50
0
        public ReorderableIconLayerList(bool draggable = true, bool showControls = true)
        {
            m_List = new UnityEditorInternal.ReorderableList(new List <Texture2D>(), typeof(Texture2D), draggable, true, showControls, showControls);
            m_List.onAddCallback       = OnAdd;
            m_List.onRemoveCallback    = OnRemove;
            m_List.onReorderCallback   = OnChange;
            m_List.drawElementCallback = OnElementDraw;
            m_List.drawHeaderCallback  = OnHeaderDraw;
            m_List.onCanAddCallback    = OnCanAdd;
            m_List.onCanRemoveCallback = OnCanRemove;

            UpdateElementHeight();
        }
コード例 #51
0
        private InternalList MakeList(SerializedProperty _property)
        {
            var list = new InternalList(_property.serializedObject, _property, true, true, true, true);

            m_ItemType = fieldInfo.FieldType.GetField(itemsPropertyName).FieldType.GetElementType();

            list.drawHeaderCallback    = DrawHeaderCallback;
            list.elementHeightCallback = ElementHeightCallback;
            list.drawElementCallback   = DrawElementCallback;
            list.onAddCallback         = OnAddCallback;

            return(list);
        }
コード例 #52
0
 private void OnEnable()
 {
     AnimatorOverrideController target = base.target as AnimatorOverrideController;
     this.m_Controller = base.serializedObject.FindProperty("m_Controller");
     if (this.m_ClipList == null)
     {
         this.m_ClipList = new ReorderableList(target.clips, typeof(AnimationClipPair), false, true, false, false);
         this.m_ClipList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawClipElement);
         this.m_ClipList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawClipHeader);
         this.m_ClipList.elementHeight = 16f;
     }
     target.OnOverrideControllerDirty = (AnimatorOverrideController.OnOverrideControllerDirtyCallback) Delegate.Combine(target.OnOverrideControllerDirty, new AnimatorOverrideController.OnOverrideControllerDirtyCallback(this.Repaint));
 }
コード例 #53
0
 public ReorderableListDrawer(IList elements, System.Type type, string label)
 {
     this.label = label;
     List       = new ReorderableList(elements, type);
     List.drawElementCallback += (Rect rect, int index, bool selected, bool focused) => {
         rect.height -= 4;
         rect.y      += 2;
         SerializedProperty property = List.serializedProperty.GetArrayElementAtIndex(index);
         EditorGUI.PropertyField(rect, property, GUIContent.none);
     };
     List.drawHeaderCallback += (rect) => {
         rect.height = 0;
     };
 }
コード例 #54
0
    private void OnEnable()
    {
        modifiers = serializedObject.FindProperty("modifiers");
        stats     = serializedObject.FindProperty("stats");
        m         = (ModifyStat)target;
        script    = MonoScript.FromMonoBehaviour(target as MonoBehaviour);

        RList_modifiers = new UnityEditorInternal.ReorderableList(serializedObject, modifiers, true, true, true, true)
        {
            drawElementCallback = Draw_Element_Reo,
            drawHeaderCallback  = Draw_Header_Reo,
            onAddCallback       = OnAdd_Modify
        };
    }
コード例 #55
0
        private void OnAddCallback_Reaction(UnityEditorInternal.ReorderableList list)
        {
            addMenu = new GenericMenu();

            for (int i = 0; i < ReactionType.Count; i++)
            {
                Type st = ReactionType[i];

                var Rname = st.Name.Replace("Rea", " Rea");
                addMenu.AddItem(new GUIContent(Rname), false, () => AddReaction(st));
            }

            addMenu.ShowAsContext();
        }
コード例 #56
0
    void OnEnable()
    {
        //		PrefabLoader loader = target as PrefabLoader;
        loadTiming = serializedObject.FindProperty("loadTiming");
        infoList   = serializedObject.FindProperty("prefabInfoList");

        reorderableList = new UnityEditorInternal.ReorderableList(serializedObject, infoList, true, false, true, true);

        reorderableList.elementHeight = (EditorGUIUtility.singleLineHeight + 4f) * 2f;

        reorderableList.drawHeaderCallback = (Rect rect) => {
            EditorGUI.LabelField(rect, "PrefabInfoList");
        };
        reorderableList.drawElementCallback = delegate(Rect position, int index, bool isActive, bool isFocused) {
            //EditorGUI.PropertyField(rect, , true);
            SerializedProperty property = infoList.GetArrayElementAtIndex(index);

            position.height = EditorGUIUtility.singleLineHeight;
            position.y     += 2;
            Rect rect = position;

            switch (property.FindPropertyRelative("loadMode").enumValueIndex)
            {
            case (int)PrefabLoader.LoadMode.Reference:
                EditorGUI.PropertyField(position, property.FindPropertyRelative("loadMode"), new GUIContent("LoadMode"));
                rect.y += EditorGUIUtility.singleLineHeight + 2.0f;
                EditorGUI.PropertyField(rect, property.FindPropertyRelative("prefab"), new GUIContent("Prefab"));
                break;

            case (int)PrefabLoader.LoadMode.ResourcesPath:
                EditorGUI.PropertyField(position, property.FindPropertyRelative("loadMode"), new GUIContent("LoadMode"));
                rect.y += EditorGUIUtility.singleLineHeight + 2.0f;
                EditorGUI.PropertyField(rect, property.FindPropertyRelative("path"), new GUIContent("Resources Path"));
                break;

            case (int)PrefabLoader.LoadMode.AssetBundle:
                position.width = EditorGUIUtility.labelWidth - 2.0f;
                EditorGUI.PropertyField(position, property.FindPropertyRelative("loadMode"), GUIContent.none);
                position.x    += position.width + 2.0f;
                position.width = rect.width - EditorGUIUtility.labelWidth;
                EditorGUI.LabelField(position, "Name");
                position.x     += 40.0f;
                position.width -= 40.0f;
                EditorGUI.PropertyField(position, property.FindPropertyRelative("name"), GUIContent.none);
                rect.y += EditorGUIUtility.singleLineHeight;
                EditorGUI.PropertyField(rect, property.FindPropertyRelative("path"), new GUIContent("AssetBundle Path"));
                break;
            }
        };
    }
コード例 #57
0
            private RKnobListGUI(List <T> items, GUIContent label, ElementGUI elementGUI, ElementHeight height, ConnectionKnobs knobs, RepositionKnobs reKnobs)
            {
#if UNITY_EDITOR
                list = new UnityEditorInternal.ReorderableList(items, typeof(T), true, true, true, true);
                list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    if (index >= list.count || list.count <= 0)//Fixes error if .doGUI removes an element from the list
                    {
                        return;
                    }
                    elementGUI(items[index], rect);
                    if (Event.current.type == EventType.Repaint)
                    {
                        reKnobs(items[index], rect);
                    }
                };
                list.elementHeightCallback = (index) => { return(height(items[index])); };
                list.drawHeaderCallback    = (Rect rect) =>
                {
                    EditorGUI.LabelField(rect, label, new GUIStyle(GUI.skin.label)
                    {
                        alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Bold
                    });
                };
                list.drawElementBackgroundCallback = (rect, index, active, focused) =>
                {
                    if (list.count <= 0)
                    {
                        return;
                    }
                    rect.height = height(items[index]);
                    Texture2D tex = new Texture2D(1, 1);
                    tex.SetPixel(0, 0, new Color(0.33f, 0.66f, 1f, 0.66f));
                    tex.Apply();
                    if (active)
                    {
                        GUI.DrawTexture(rect, tex as Texture);
                    }
                };
                list.onRemoveCallback = (list) =>
                {
                    foreach (var knob in knobs(items[list.index]))
                    {
                        knob.body.DeleteConnectionPort(knob);
                    }
                    items.RemoveAt(list.index);
                };
#endif
            }
コード例 #58
0
        private InternalList GetList(SerializedProperty _property)
        {
            m_ItemsProperty = _property.FindPropertyRelative(itemsPropertyName);

            if (m_List == null)
            {
                m_List = MakeList(m_ItemsProperty);
            }
            else
            {
                m_List.serializedProperty = m_ItemsProperty;
            }

            return(m_List);
        }
コード例 #59
0
        private void HandleElementRemoved(UnityEditorInternal.ReorderableList list)
        {
            var indexToRemove   = list.index;
            var elementToDelete = this.presetsToDraw[indexToRemove];
            var popupMessage    = string.Format(
                "Are you sure you want to delete the preset \"{0}\"?", elementToDelete.Name
                );

            if (EditorUtility.DisplayDialog("Warning", popupMessage, "Delete Preset", "No"))
            {
                this.presetsToDraw.RemoveAt(indexToRemove);
                this.reorderableList.index = 0;
                this.InvokePresetsChanged();
            }
        }
コード例 #60
-16
		private void AddDropdown(Rect buttonRect, ReorderableList l)
		{
			var menu = new GenericMenu();
			foreach (string levelName in _listLevelName)
				menu.AddItem(new GUIContent(levelName), false, AddDropdownItem, levelName);
			menu.ShowAsContext();
		}