Beispiel #1
0
        internal virtual void DrawItem(AdvancedDropdownItem item, string name, Texture2D icon, bool enabled, bool drawArrow, bool selected, bool hasSearch)
        {
            var content = item.content;
            var imgTemp = content.image;

            //we need to pretend we have an icon to calculate proper width in case
            if (content.image == null)
            {
                content.image = Texture2D.whiteTexture;
            }
            var rect = GetItemRect(content);

            content.image = imgTemp;

            if (!string.IsNullOrEmpty(content.tooltip) && rect.Contains(Event.current.mousePosition) &&
                !string.Equals(content.tooltip, content.text, StringComparison.Ordinal))
            {
                GUIStyle.SetMouseTooltip(content.tooltip, rect);
            }

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            var imageTemp = content.image;

            if (m_DataSource.selectedIDs.Any() && m_DataSource.selectedIDs.Contains(item.id))
            {
                var checkMarkRect = new Rect(rect);
                checkMarkRect.width = iconSize.x + 1;
                Styles.checkMark.Draw(checkMarkRect, Styles.checkMarkContent, false, false, selected, selected);
                rect.x     += iconSize.x + 1;
                rect.width -= iconSize.x + 1;

                //don't draw the icon if the check mark is present
                content.image = null;
            }
            else if (content.image == null)
            {
                lineStyle.Draw(rect, GUIContent.none, false, false, selected, selected);
                rect.x     += iconSize.x + 1;
                rect.width -= iconSize.x + 1;
            }
            EditorGUI.BeginDisabled(!enabled);

            DrawItemContent(item, rect, content, false, false, selected, selected);
            content.image = imageTemp;
            if (drawArrow)
            {
                var  yOffset   = (lineStyle.fixedHeight - Styles.rightArrow.fixedHeight) / 2;
                Rect arrowRect = new Rect(
                    rect.xMax - Styles.rightArrow.fixedWidth - Styles.rightArrow.margin.right,
                    rect.y + yOffset,
                    Styles.rightArrow.fixedWidth,
                    Styles.rightArrow.fixedHeight);
                Styles.rightArrow.Draw(arrowRect, false, false, false, false);
            }
            EditorGUI.EndDisabled();
        }
Beispiel #2
0
        public override Rect Draw(BuildTargetGroup target, Rect rect)
        {
            rect.y += EditorGUIUtility.standardVerticalSpacing;

            EditorGUI.BeginDisabled(target == BuildTargetGroup.Android);

            rect.height = EditorGUIUtility.singleLineHeight;
            GUIContent label = EditorGUI.BeginProperty(rect, s_SharedDepthBufferLabel, m_SharedDepthBuffer);

            EditorGUI.BeginChangeCheck();
            bool boolValue = EditorGUI.Toggle(rect, label, m_SharedDepthBuffer.boolValue);

            if (EditorGUI.EndChangeCheck())
            {
                m_SharedDepthBuffer.boolValue = boolValue;
            }
            EditorGUI.EndProperty();
            rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing;

            rect.height = EditorGUIUtility.singleLineHeight;
            label       = EditorGUI.BeginProperty(rect, s_DashSupportLabel, m_DashSupport);
            EditorGUI.BeginChangeCheck();
            boolValue = EditorGUI.Toggle(rect, label, m_DashSupport.boolValue);
            if (EditorGUI.EndChangeCheck())
            {
                m_DashSupport.boolValue = boolValue;
            }
            EditorGUI.EndProperty();

            EditorGUI.EndDisabled();

            rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing;

            return(rect);
        }
        protected virtual void DrawTrackProperties()
        {
            var property = serializedObject.GetIterator();
            var expanded = true;

            while (property.NextVisible(expanded))
            {
                if ("m_Script" == property.propertyPath)
                {
                    // Don't draw script field for built-in types
                    if (m_IsBuiltInType)
                    {
                        continue;
                    }

                    // Disable the script field, as it will break your Timeline if you change it.
                    EditorGUI.BeginDisabled(true);
                    EditorGUILayout.PropertyField(property, !expanded);
                    EditorGUI.EndDisabled();
                    continue;
                }


                EditorGUILayout.PropertyField(property, !expanded);
                expanded = false;
            }
        }
        public virtual void DrawItem(AdvancedDropdownItem item, bool selected, bool hasSearch)
        {
            if (item.IsSeparator())
            {
                DrawLineSeparator();
                return;
            }

            var content = !hasSearch ? item.content : item.contentWhenSearching;
            var imgTemp = content.image;

            //we need to pretend we have an icon to calculate proper width in case
            if (content.image == null)
            {
                content.image = Texture2D.whiteTexture;
            }
            var rect = GUILayoutUtility.GetRect(content, lineStyle, GUILayout.ExpandWidth(true));

            content.image = imgTemp;

            if (item.IsSeparator() || Event.current.type != EventType.Repaint)
            {
                return;
            }

            var imageTemp = content.image;

            if (m_DataSource.selectedIds.Any() && m_DataSource.selectedIds.Contains(item.id))
            {
                var checkMarkRect = new Rect(rect);
                checkMarkRect.width = iconSize.x + 1;
                Styles.checkMark.Draw(checkMarkRect, Styles.checkMarkContent, false, false, selected, selected);
                rect.x     += iconSize.x + 1;
                rect.width -= iconSize.x + 1;

                //don't draw the icon if the check mark is present
                content.image = null;
            }
            else if (content.image == null)
            {
                lineStyle.Draw(rect, GUIContent.none, false, false, selected, selected);
                rect.x     += iconSize.x + 1;
                rect.width -= iconSize.x + 1;
            }
            EditorGUI.BeginDisabled(!item.enabled);
            lineStyle.Draw(rect, content, false, false, selected, selected);
            content.image = imageTemp;
            if (item.drawArrow)
            {
                var  yOffset   = (lineStyle.fixedHeight - Styles.rightArrow.fixedHeight) / 2;
                Rect arrowRect = new Rect(
                    rect.xMax - Styles.rightArrow.fixedWidth - Styles.rightArrow.margin.right,
                    rect.y + yOffset,
                    Styles.rightArrow.fixedWidth,
                    Styles.rightArrow.fixedHeight);
                Styles.rightArrow.Draw(arrowRect, false, false, false, false);
            }
            EditorGUI.EndDisabled();
        }
Beispiel #5
0
        public override void OnInspectorGUI()
        {
            var t = target as AssetStoreUploadConfig;

            if (!t)
            {
                return;
            }

            if (targets.Length <= 1)
            {
                EditorGUILayout.LabelField(new GUIContent("Selection", "Select all root folders and assets that should be exported. For packages, select the package.json."), EditorStyles.boldLabel);
                itemList.DoLayoutList();
                // EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(t.compressionStrength)));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(t.respectIgnoreFiles)), RespectIgnoreFilesContent);
                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Export for Local Testing" + (targets.Length > 1 ? " [" + targets.Length + "]" : "")))
            {
                foreach (var o in targets)
                {
                    var config = (AssetStoreUploadConfig)o;
                    if (!config)
                    {
                        continue;
                    }
                    AssetStoreToolsPatchProvider.ExportPackageForConfig(config);
                }
            }

            EditorGUILayout.Space();
            EditorGUI.BeginDisabled(true);
            EditorGUILayout.Space();
            foreach (var o in targets)
            {
                var c = (AssetStoreUploadConfig)o;
                EditorGUILayout.LabelField(new GUIContent("Export Roots for " + c.name, "All content from these folders will be included when exporting with this configuration."), EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                var paths = c.GetExportPaths();
                foreach (var p in paths)
                {
                    EditorGUILayout.LabelField(p);
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
            EditorGUI.EndDisabled();
        }
Beispiel #6
0
 static void WindowGUI()
 {
     EditorGUI.BeginDisabled(m_Effect == null);
     EditorGUILayout.Space();
     list.DoLayoutList();
     EditorGUILayout.Space();
     using (new GUILayout.HorizontalScope(GUILayout.Width(358)))
     {
         if (GUILayout.Button("Play", Styles.leftButton, GUILayout.Height(24)))
         {
             SendEvent("OnPlay");
         }
         if (GUILayout.Button("Stop", Styles.middleButton, GUILayout.Height(24)))
         {
             SendEvent("OnStop");
         }
         if (GUILayout.Button("Custom", Styles.rightButton, GUILayout.Height(24)))
         {
             SendEvent(m_CustomEvent);
         }
     }
     m_CustomEvent = EditorGUILayout.TextField("Custom Event", m_CustomEvent);
     EditorGUI.EndDisabled();
 }
    static SettingsProvider PreferenceGUI()
    {
        ReorderableList floatNameList  = new ReorderableList(floatPropertyNames, typeof(string), false, true, false, false);
        ReorderableList vectorNameList = new ReorderableList(vectorPropertyNames, typeof(string), false, true, false, false);
        ReorderableList colorNameList  = new ReorderableList(colorPropertyNames, typeof(string), false, true, false, false);

        floatNameList.drawElementCallback = EditFloatString;
        floatNameList.drawHeaderCallback  = FloatHeaderGUI;

        vectorNameList.drawElementCallback = EditVectorString;
        vectorNameList.drawHeaderCallback  = VectorHeaderGUI;

        colorNameList.drawElementCallback = EditColorString;
        colorNameList.drawHeaderCallback  = ColorHeaderGUI;

        void EditFloatString(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginDisabled(index >= floatPropertyCount);
            floatPropertyNames[index] = EditorGUI.DelayedTextField(rect, floatPropertyNames[index]);
            EditorGUI.EndDisabled();
        }

        void EditVectorString(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginDisabled(index >= vectorPropertyCount);
            vectorPropertyNames[index] = EditorGUI.DelayedTextField(rect, vectorPropertyNames[index]);
            EditorGUI.EndDisabled();
        }

        void EditColorString(Rect rect, int index, bool isActive, bool isFocused)
        {
            EditorGUI.BeginDisabled(index >= colorPropertyCount);
            colorPropertyNames[index] = EditorGUI.DelayedTextField(rect, colorPropertyNames[index]);
            EditorGUI.EndDisabled();
        }

        return(new SettingsProvider("Project/VFX Volume Mixer", SettingsScope.Project)
        {
            guiHandler = searchContext => OpenGUI()
        });

        void FloatHeaderGUI(Rect r)
        {
            floatPropertyCount = EditorGUI.IntSlider(r, floatPropertyCount, 0, 8);
        }

        void VectorHeaderGUI(Rect r)
        {
            vectorPropertyCount = EditorGUI.IntSlider(r, vectorPropertyCount, 0, 8);
        }

        void ColorHeaderGUI(Rect r)
        {
            colorPropertyCount = EditorGUI.IntSlider(r, colorPropertyCount, 0, 8);
        }

        void OpenGUI()
        {
            DrawList("Float Properties", floatNameList);
            DrawList("Vector3 Properties", vectorNameList);
            DrawList("Color Properties", colorNameList);
        }
    }
Beispiel #8
0
        void OnGUI()
        {
            GUILayout.Space(5);
            Event evt       = Event.current;
            bool  hitEnter  = evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter);
            bool  hitEscape = evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Escape);

            if (hitEscape)
            {
                Close();
                GUIUtility.ExitGUI();
            }
            GUI.SetNextControlName("m_PreferencesName");
            EditorGUI.BeginChangeCheck();
            m_PresetName = EditorGUILayout.TextField(m_PresetName);
            m_PresetName = m_PresetName.TrimEnd();
            if (EditorGUI.EndChangeCheck())
            {
                UpdateCurrentInvalidChars();
            }

            if (!m_DidFocus)
            {
                m_DidFocus = true;
                EditorGUI.FocusTextInControl("m_PreferencesName");
            }

            if (m_CurrentInvalidChars.Length != 0)
            {
                EditorGUILayout.HelpBox(string.Format(s_InvalidCharsFormatString, m_CurrentInvalidChars), MessageType.Warning);
                minSize = new Vector2(k_Width, k_Height + k_HelpBoxHeight);
            }
            else
            {
                minSize = new Vector2(k_Width, k_Height);
            }

            bool canSaveLayout = m_PresetName.Length > 0 && m_CurrentInvalidChars.Length == 0;

            EditorGUI.BeginDisabled(!canSaveLayout);

            if (GUILayout.Button("Save") || hitEnter && canSaveLayout)
            {
                Close();

                if (OverlayPresetManager.Exists(m_Window.GetType(), m_PresetName))
                {
                    if (!EditorUtility.DisplayDialog("Overwrite preset?",
                                                     "Do you want to overwrite '" + m_PresetName + "' preset?",
                                                     "Overwrite", "Cancel"))
                    {
                        GUIUtility.ExitGUI();
                    }
                }

                save(m_PresetName);

                GUIUtility.ExitGUI();
            }
            else
            {
                m_DidFocus = false;
            }

            EditorGUI.EndDisabled();
        }