Ejemplo n.º 1
0
        private void OnEnable()
        {
            m_propertyLoader = serializedObject.FindProperty("m_loader");
            m_list           = new ResourcesAssetGroupAssetListDrawer(serializedObject.FindProperty("m_assets"));

            m_list.Enable();
        }
 static void Update()
 {
     //Whenever we change selection, clear the states (to avoid dead object refs)
     if (lastActiveInstanceID != Selection.activeInstanceID)
     {
         lastActiveInstanceID = Selection.activeInstanceID;
         ReorderableListDrawer.CleanStates();
     }
 }
Ejemplo n.º 3
0
        protected override float OnGetSettingsHeight(SerializedProperty propertyGroups)
        {
            float height = EditorGUIUtility.singleLineHeight;
            float space  = EditorGUIUtility.standardVerticalSpacing;

            string                name             = GetSelectedGroupName();
            SerializedProperty    propertySettings = OnGetSettings(propertyGroups, name);
            ReorderableListDrawer drawer           = GetListDrawer(name, propertySettings);

            float heightDefines = drawer.SerializedProperty.isExpanded ? drawer.GetHeight() : height;

            return(height * 2F + space * 3F + heightDefines + PADDING * 2F);
        }
Ejemplo n.º 4
0
        private ReorderableListDrawer GetListDrawer(string name, SerializedProperty propertySettings)
        {
            if (!m_listDrawers.TryGetValue(name, out ReorderableListDrawer drawer))
            {
                SerializedProperty propertyDefines = propertySettings.FindPropertyRelative("m_defines");

                drawer = new ReorderableListDrawer(propertyDefines);
                drawer.List.drawElementCallback = (rect, index, active, focused) => { OnListDrawElement(drawer, name, rect, index); };

                m_listDrawers.Add(name, drawer);
            }

            return(drawer);
        }
        private void OnEnable()
        {
            m_propertyUnloadTrackedAssetsOnUninitialize = serializedObject.FindProperty("m_unloadTrackedAssetsOnUninitialize");

            m_listLoaders            = new AssetReferenceListDrawer(serializedObject.FindProperty("m_loaders"));
            m_listGroups             = new AssetReferenceListDrawer(serializedObject.FindProperty("m_groups"));
            m_listPreloadAssets      = new ReorderableListDrawer(serializedObject.FindProperty("m_preload"));
            m_listPreloadAssetsAsync = new ReorderableListDrawer(serializedObject.FindProperty("m_preloadAsync"));

            m_listLoaders.Enable();
            m_listGroups.Enable();
            m_listPreloadAssets.Enable();
            m_listPreloadAssetsAsync.Enable();
        }
        private void CreateStateEventList(StateEventsAsset events)
        {
            var listDrawer = new ReorderableListDrawer <StateEventAsset>("Events", events.Events, true);

            listDrawer.List.onAddCallback = list =>
            {
                //listDrawer.Source.Add(new StateEventAsset() { Name = ValidateEventName("New Event", events.Events) });
            };
            listDrawer.List.elementHeightCallback = index =>
            {
                if (!listDrawer.Drawer.StartDrawing(index))
                {
                    return(listDrawer.Drawer.Height);
                }

                listDrawer.Drawer.Space(TOP_PADDING);

                listDrawer.Drawer.Draw(EditorGUI.GetPropertyHeight(SerializedPropertyType.String, new GUIContent("Name")), rect =>
                {
                    GUIContent nameLabel = new GUIContent(listDrawer.Source[index].Name);
                    float nameLabelWidth = Mathf.Min(rect.width - EDIT_BUTTON_WIDTH - INTERNAL_HORIZONTAL_MARGIN - FOLDOUT_MARGIN, GUI.skin.label.CalcSize(nameLabel).x);

                    //listDrawer.Source[index].IsExpanded = EditorGUI.Foldout(rect.AddX(FOLDOUT_MARGIN).Width(nameLabelWidth), listDrawer.Source[index].IsExpanded, listDrawer.Source[index].Name, true);

                    if (GUI.Button(rect.AddX(rect.width - EDIT_BUTTON_WIDTH).Width(EDIT_BUTTON_WIDTH), "Edit"))
                    {
                        //RenameEditor.Open(listDrawer.Source[index].Name, newName => listDrawer.Source[index].Name = ValidateEventName(newName, listDrawer.Source));
                    }
                }, INTERNAL_VERTICAL_MARGIN);

                //if (listDrawer.Source[index].IsExpanded)
                //{
                //    listDrawer.Drawer.Draw(EditorGUI.GetPropertyHeight(SerializedPropertyType.Float, new GUIContent("Normalized Time")), rect =>
                //    {
                //        listDrawer.Source[index].NormalizedTime = EditorGUI.FloatField(rect, "Normalized Time", listDrawer.Source[index].NormalizedTime);
                //    }, TOP_PADDING);
                //}

                return(listDrawer.Drawer.Height);
            };

            //_stateEventsLists.Add(listDrawer);
        }
Ejemplo n.º 7
0
        private void OnListDrawElement(ReorderableListDrawer drawer, string name, Rect rect, int index)
        {
            PlatformInfo platform = PlatformEditorUtility.GetPlatform(name);

            float height = EditorGUIUtility.singleLineHeight;
            float space  = EditorGUIUtility.standardVerticalSpacing;

            rect.y += space;

            SerializedProperty propertyElement = drawer.SerializedProperty.GetArrayElementAtIndex(index);
            SerializedProperty propertyValue   = propertyElement.FindPropertyRelative("m_value");

            var rectDefine = new Rect(rect.x, rect.y, rect.width - height + space, height);
            var rectFlag   = new Rect(rectDefine.xMax + space, rect.y, height, height);

            GUIContent flagContent = !string.IsNullOrEmpty(propertyValue.stringValue) && DefinesEditorUtility.HasDefine(propertyValue.stringValue, platform.BuildTargetGroup)
                ? m_styles.FlagOnContent
                : m_styles.FlagOffContent;

            EnabledPropertyGUIUtility.EnabledProperty(rectDefine, GUIContent.none, propertyElement, false);
            GUI.Label(rectFlag, flagContent, m_styles.FlagStyle);
        }
Ejemplo n.º 8
0
        protected override void OnDrawSettings(Rect position, SerializedProperty propertyGroups, string name)
        {
            float height = EditorGUIUtility.singleLineHeight;
            float space  = EditorGUIUtility.standardVerticalSpacing;

            SerializedProperty    propertySettings = OnGetSettings(propertyGroups, name);
            ReorderableListDrawer drawer           = GetListDrawer(name, propertySettings);

            using (new LabelWidthChangeScope(-PADDING))
            {
                var rectPlatformName   = new Rect(position.x, position.y, position.width, height);
                var rectIncludeInBuild = new Rect(position.x, rectPlatformName.yMax + space, position.width, height);
                var rectDefines        = new Rect(position.x, rectIncludeInBuild.yMax + space, position.width, height);

                SerializedProperty propertyIncludeInBuild = propertySettings.FindPropertyRelative("m_includeInBuild");

                OnDrawSettingsPlatformName(rectPlatformName, propertyGroups, name);

                EditorGUI.PropertyField(rectIncludeInBuild, propertyIncludeInBuild);

                drawer.DrawGUI(rectDefines);
            }
        }
Ejemplo n.º 9
0
 private void OnEnable()
 {
     m_list = new ReorderableListDrawer(serializedObject.FindProperty("m_containers"));
     m_list.Enable();
 }