Exemple #1
0
        private void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            typeName     = EditorGUILayout.TextField("Type Name", typeName);
            bindingFlags = (BindingFlags)EditorGUILayout.EnumFlagsField(bindingFlags);
            if (GUILayout.Button("Get Type Info"))
            {
                GetTypeInfo();
            }

            if (type != null)
            {
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                DrawInfo(ref foldouts[0], "Fields", fieldList);
                DrawInfo(ref foldouts[2], "Properties", propertyList);
                DrawInfo(ref foldouts[1], "Methods", methodList);
                DrawInfo(ref foldouts[3], "Enum Names", enumNameList);
                EditorGUILayout.EndScrollView();
            }
            else
            {
                EditorGUILayout.HelpBox("Not a valid type", MessageType.Info);
            }
        }
Exemple #2
0
        private static void DrawImporterListElement(Rect rect, int index, ReorderableList list, string targetTypeName)
        {
            SerializedProperty importer      = list.serializedProperty.GetArrayElementAtIndex(index);
            SerializedProperty m_Preset      = importer.FindPropertyRelative("m_Preset");
            SerializedProperty m_Association = importer.FindPropertyRelative("m_Association");
            SerializedProperty m_Recursive   = importer.FindPropertyRelative("m_Recursive");

            rect.y     += 1;
            rect.height = EditorGUIUtility.singleLineHeight;
            rect        = EZEditorGUIUtility.DrawReorderableListIndex(rect, index, list);
            float width = (rect.width - recursiveToggleWidth) * 0.5f;

            rect.width = width - margin;

            Color guiColor = GUI.color;

            if (m_Preset.objectReferenceValue != null && (m_Preset.objectReferenceValue as Preset).GetTargetFullTypeName() != targetTypeName)
            {
                GUI.color = Color.red;
            }
            EditorGUI.PropertyField(rect, m_Preset, GUIContent.none);
            GUI.color = guiColor;

            rect.x += width;
            EditorGUI.PropertyField(rect, m_Association, GUIContent.none);
            rect.x    += width;
            rect.width = recursiveToggleWidth;
            EditorGUI.PropertyField(rect, m_Recursive, GUIContent.none);
        }
Exemple #3
0
        protected void DrawExtensionListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect        = EZEditorGUIUtility.DrawReorderableListIndex(rect, m_ExtensionList, index);
            rect.height = EditorGUIUtility.singleLineHeight;
            SerializedProperty extension = extensionList.serializedProperty.GetArrayElementAtIndex(index);

            EditorGUI.PropertyField(rect, extension, GUIContent.none);
        }
        private void DrawEnumNameListElement(Rect rect, int index, ReorderableList list)
        {
            var info = enumNameList.list[index] as string;

            rect        = EZEditorGUIUtility.DrawReorderableListIndex(rect, index, list);
            rect.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.TextField(rect, info);
        }
 public override void OnInspectorGUI()
 {
     EZEditorGUIUtility.MonoBehaviourTitle(path);
     serializedObject.Update();
     EditorGUILayout.PropertyField(m_PathMode);
     EditorGUILayout.PropertyField(m_ClosedPath);
     serializedObject.ApplyModifiedProperties();
 }
Exemple #6
0
        protected void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            if (materials.Length == 0)
            {
                EditorGUILayout.HelpBox("No Material Selected", MessageType.Info);
                return;
            }

            if (GUILayout.Button("Optimize Properties"))
            {
                for (int i = 0; i < materials.Length; i++)
                {
                    Material           material          = materials[i];
                    SerializedObject   serializedObject  = new SerializedObject(material);
                    SerializedProperty m_SavedProperties = serializedObject.FindProperty("m_SavedProperties");
                    SerializedProperty m_TexEnvs         = m_SavedProperties.FindPropertyRelative("m_TexEnvs");
                    SerializedProperty m_Floats          = m_SavedProperties.FindPropertyRelative("m_Floats");
                    SerializedProperty m_Colors          = m_SavedProperties.FindPropertyRelative("m_Colors");
                    EZShaderGUIUtility.OptimizeProperties(material, m_TexEnvs, m_Floats, m_Colors);
                }
            }

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            for (int i = 0; i < materials.Length; i++)
            {
                Material         material         = materials[i];
                SerializedObject serializedObject = new SerializedObject(material);

                GUI.enabled = false;
                EditorGUILayout.ObjectField(material, typeof(Material), true);
                GUI.enabled = true;

                EditorGUI.indentLevel++;

                EditorGUILayout.LabelField("Keywords", EditorStyles.boldLabel);
                SerializedProperty m_ShaderKeywords = serializedObject.FindProperty("m_ShaderKeywords");
                EZShaderGUIUtility.KeywordsGUI(material, m_ShaderKeywords);

                SerializedProperty m_SavedProperties = serializedObject.FindProperty("m_SavedProperties");
                SerializedProperty m_TexEnvs         = m_SavedProperties.FindPropertyRelative("m_TexEnvs");
                SerializedProperty m_Floats          = m_SavedProperties.FindPropertyRelative("m_Floats");
                SerializedProperty m_Colors          = m_SavedProperties.FindPropertyRelative("m_Colors");
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Extra Properties", EditorStyles.boldLabel);
                if (GUILayout.Button("Optimize"))
                {
                    EZShaderGUIUtility.OptimizeProperties(material, m_TexEnvs, m_Floats, m_Colors);
                }
                EditorGUILayout.EndHorizontal();
                EZShaderGUIUtility.ExtraPropertiesGUI(material, m_TexEnvs, m_Floats, m_Colors);

                serializedObject.ApplyModifiedProperties();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndScrollView();
        }
        private void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Format", format);

            EditorGUILayout.BeginHorizontal();
            timeText = EditorGUILayout.DelayedTextField("Date Time", timeText);
            if (GUILayout.Button("Parse"))
            {
                try
                {
                    time = DateTime.Parse(timeText);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Now"))
            {
                GetCurrentTime();
                GUI.FocusControl(null);
            }

            EditorGUILayout.Space();
            DrawLabel("ToLongDateString", time.ToLongDateString());
            DrawLabel("ToShortDateString", time.ToShortDateString());
            DrawLabel("ToLongTimeString", time.ToLongTimeString());
            DrawLabel("ToShortTimeString", time.ToShortTimeString());

            EditorGUILayout.Space();
            DrawLabel("Kind", time.Kind.ToString());
            DrawLabel("Year", time.Year.ToString());
            DrawLabel("Month", time.Month.ToString());
            DrawLabel("Day", time.Day.ToString());
            DrawLabel("Hour", time.Hour.ToString());
            DrawLabel("Minute", time.Minute.ToString());
            DrawLabel("Second", time.Second.ToString());
            DrawLabel("Millisecond", time.Millisecond.ToString());

            EditorGUILayout.Space();
            DrawLabel("DayOfWeek", time.DayOfWeek.ToString());
            DrawLabel("DayOfYear", time.DayOfYear.ToString());
            DrawLabel("TimeOfDay", time.TimeOfDay.ToString());
            DrawLabel("Ticks", time.Ticks.ToString());

            EditorGUILayout.Space();
            DrawLabel("ToBinary", time.ToBinary().ToString());
            DrawLabel("ToFileTime", time.ToFileTime().ToString());
            DrawLabel("ToFileTimeUtc", time.ToFileTimeUtc().ToString());
            DrawLabel("ToLocalTime", time.ToLocalTime().ToString());
            DrawLabel("ToOADate", time.ToOADate().ToString());
            DrawLabel("ToUniversalTime", time.ToUniversalTime().ToString());
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EZEditorGUIUtility.MonoBehaviourTitle(target as MonoBehaviour);

            elementList.DoLayoutList();

            serializedObject.ApplyModifiedProperties();
        }
 protected void OnGUI()
 {
     EZEditorGUIUtility.WindowTitle(this);
     DrawConfig();
     EditorGUILayout.Space();
     DrawButton();
     EditorGUILayout.Space();
     DrawPreview();
 }
 public override void OnInspectorGUI()
 {
     EZEditorGUIUtility.MonoBehaviourTitle(pathPoint);
     serializedObject.Update();
     EditorGUILayout.PropertyField(m_BrokenTangent);
     EditorGUILayout.PropertyField(m_StartTangent);
     EditorGUILayout.PropertyField(m_EndTangent);
     serializedObject.ApplyModifiedProperties();
 }
Exemple #11
0
        protected virtual void DrawPrefabListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect.y += 1;
            rect    = EZEditorGUIUtility.DrawReorderableListIndex(rect, m_Options, index);
            SerializedProperty prefab = optionList.serializedProperty.GetArrayElementAtIndex(index);

            rect.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.PropertyField(rect, prefab, GUIContent.none);
        }
        private void DrawAlwaysIncludedShaderListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty shaderProperty = m_AlwaysIncludedShaders.GetArrayElementAtIndex(index);

            rect        = EZEditorGUIUtility.DrawReorderableListIndex(rect, m_AlwaysIncludedShaders, index);
            rect.y     += 1;
            rect.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.PropertyField(rect, shaderProperty, GUIContent.none);
        }
Exemple #13
0
        protected void DrawPatternListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            rect = EZEditorGUIUtility.DrawReorderableListIndex(rect, m_PatternList, index);
            SerializedProperty pattern = patternList.serializedProperty.GetArrayElementAtIndex(index);
            float width = rect.width / 2; float margin = 5;

            EditorGUI.PropertyField(new Rect(rect.x, rect.y, width - margin, EditorGUIUtility.singleLineHeight), pattern.FindPropertyRelative("Key"), GUIContent.none);
            rect.x += width;
            EditorGUI.PropertyField(new Rect(rect.x, rect.y, width - margin, EditorGUIUtility.singleLineHeight), pattern.FindPropertyRelative("Value"), GUIContent.none);
        }
Exemple #14
0
        protected void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);
            bool wideMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;

            EditorGUI.BeginChangeCheck();
            target = EditorGUILayout.ObjectField("Target", target, typeof(Object), true);
            if (EditorGUI.EndChangeCheck())
            {
                if (target != null)
                {
                    serializedObject = new SerializedObject(target);
                }
                else
                {
                    serializedObject = null;
                }
            }
            enterChildren = EditorGUILayout.Toggle("Enter Children", enterChildren);
            showInvisible = EditorGUILayout.Toggle("Show Invisible", showInvisible);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);
            // change scene will destroy target
            if (target != null && serializedObject != null)
            {
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                serializedObject.Update();
                SerializedProperty sp = serializedObject.GetIterator();
                sp.Next(true);
                EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth / 2;
                if (showInvisible)
                {
                    do
                    {
                        PropertyField(sp);
                    }while (sp.Next(enterChildren));
                }
                else
                {
                    do
                    {
                        PropertyField(sp);
                    }while (sp.NextVisible(enterChildren));
                }
                EditorGUIUtility.labelWidth = 0;
                serializedObject.ApplyModifiedProperties();
                EditorGUILayout.EndScrollView();
            }

            EditorGUIUtility.wideMode = wideMode;
        }
        protected void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            if (GUILayout.Button("Clear"))
            {
                keywordInfoDict.Clear();
            }

            EditorGUILayout.Space();
            keywordStringFromWarning = EditorGUILayout.TextArea(keywordStringFromWarning, GUILayout.Height(80));
            if (GUILayout.Button("Get Keywords"))
            {
                GetKeywords();
            }
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            bool changed = false;
            int  index   = 0;

            foreach (var pair in keywordInfoDict)
            {
                KeywordInfo keywordInfo = pair.Value;
                EditorGUILayout.BeginHorizontal();
                keywordInfo.foldout = EditorGUILayout.Foldout(keywordInfo.foldout, index++.ToString("000 ") + keywordInfo.keyword);
                EditorGUILayout.LabelField("Count:" + keywordInfo.materials.Count, GUILayout.Width(80));
                EditorGUILayout.LabelField("IsGlobal:" + keywordInfo.isGlobal, GUILayout.Width(120));
                if (GUILayout.Button("Delete", GUILayout.Width(80)))
                {
                    foreach (Material mat in keywordInfo.materials)
                    {
                        mat.DisableKeyword(keywordInfo.keyword);
                        EditorUtility.SetDirty(mat);
                    }
                    Shader.DisableKeyword(keywordInfo.keyword);
                    changed = true;
                }
                EditorGUILayout.EndHorizontal();
                if (keywordInfo.foldout)
                {
                    EditorGUI.indentLevel++;
                    foreach (Material mat in keywordInfo.materials)
                    {
                        EditorGUILayout.ObjectField(mat, typeof(Material), true);
                    }
                    EditorGUI.indentLevel--;
                }
            }
            if (changed)
            {
                GetKeywords();
            }
            EditorGUILayout.EndScrollView();
        }
Exemple #16
0
 protected void OnGUI()
 {
     EZEditorGUIUtility.WindowTitle(this);
     if (GUILayout.Button("Refresh"))
     {
         RefreshGuid();
     }
     EditorGUILayout.PrefixLabel("System Guid");
     EditorGUILayout.TextArea(systemGuid.ToString());
     EditorGUILayout.PrefixLabel("Unity Guid");
     EditorGUILayout.TextArea(unityGuid.ToString());
 }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EZMinMaxAttribute minMaxAttribute = attribute as EZMinMaxAttribute;

            EditorGUI.BeginProperty(position, label, property);

            if (property.propertyType == SerializedPropertyType.Float)
            {
                property.floatValue = EditorGUILayout.Slider(label, property.floatValue, minMaxAttribute.limitMin, minMaxAttribute.limitMax);
            }
            else if (property.propertyType == SerializedPropertyType.Integer)
            {
                property.intValue = EditorGUILayout.IntSlider(label, property.intValue, (int)minMaxAttribute.limitMin, (int)minMaxAttribute.limitMax);
            }
            else if (property.propertyType == SerializedPropertyType.Vector2 || property.propertyType == SerializedPropertyType.Vector4)
            {
                position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

                if (property.propertyType == SerializedPropertyType.Vector2)
                {
                    property.vector2Value = EZEditorGUIUtility.MinMaxSliderV2(position, property.vector2Value, minMaxAttribute.limitMin, minMaxAttribute.limitMax);
                }
                else if (property.propertyType == SerializedPropertyType.Vector4)
                {
                    if (minMaxAttribute.fixedLimit)
                    {
                        property.vector4Value = EZEditorGUIUtility.MinMaxSliderV4(position, property.vector4Value, minMaxAttribute.limitMin, minMaxAttribute.limitMax);
                    }
                    else
                    {
                        property.isExpanded = EditorGUI.Foldout(new Rect(position)
                        {
                            width = 0
                        }, property.isExpanded, GUIContent.none, false);
                        if (property.isExpanded)
                        {
                            property.vector4Value = EditorGUI.Vector4Field(position, "", property.vector4Value);
                        }
                        else
                        {
                            property.vector4Value = EZEditorGUIUtility.MinMaxSliderV4(position, property.vector4Value);
                        }
                    }
                }
            }
            else
            {
                EditorGUI.HelpBox(position, string.Format("EZMinMaxAttribute not suitable for {0}: {1}", property.type, property.name), MessageType.Warning);
            }

            EditorGUI.EndProperty();
        }
        private void DrawPropertyListHeader(Rect rect, ReorderableList list)
        {
            rect = EZEditorGUIUtility.CalcReorderableListHeaderRect(rect, list);
            float width = rect.width / 5;

            rect.width = width;
            EditorGUI.LabelField(rect, "DeclaringType");
            rect.x += rect.width;
            EditorGUI.LabelField(rect, "PropertyType");
            rect.x    += rect.width;
            rect.width = width * 3;
            EditorGUI.LabelField(rect, "PropertyName");
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EZEditorGUIUtility.ScriptableObjectTitle(target as ScriptableObject, !serializedObject.isEditingMultipleObjects);

            EditorGUILayout.LabelField("File Association", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(m_FilePatterns, true);
            EditorGUILayout.PropertyField(m_IncludePaths, true);
            EditorGUILayout.PropertyField(m_ExcludePaths, true);
            EditorGUI.indentLevel--;

            EditorGUILayout.LabelField("Analysis", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(m_InfoLineCount);
            EditorGUILayout.PropertyField(m_AuthorRegex);
            EditorGUILayout.PropertyField(m_CreateTimeRegex);
            EditorGUILayout.PropertyField(m_ValidLineRegex);
            EditorGUILayout.HelpBox(new StringBuilder()
                                    .AppendLine(@"'^\W*(\w+)[\S\s]*$': line contains word characters")
                                    .AppendLine(@"'^\W*(\S+)[\S\s]*$': line contains non-white-space characters")
                                    .ToString(), MessageType.Info);
            EditorGUI.indentLevel--;

            if (GUILayout.Button("Refresh"))
            {
                RefreshResult();
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Results", EditorStyles.boldLabel);
            foreach (var subAsset in AssetDatabase.LoadAllAssetRepresentationsAtPath(AssetDatabase.GetAssetPath(target)))
            {
                if (subAsset == null)
                {
                    continue;
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.ObjectField(subAsset.name, subAsset, typeof(EZScriptStatisticResult), false);
                if (GUILayout.Button("Remove", GUILayout.Width(80)))
                {
                    Undo.RecordObject(target, "Remove Result");
                    Undo.DestroyObjectImmediate(subAsset);
                    EditorUtility.SetDirty(target);
                    AssetDatabase.SaveAssets();
                }
                EditorGUILayout.EndHorizontal();
            }

            serializedObject.ApplyModifiedProperties();
        }
Exemple #20
0
        private void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            EditorGUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            rootTransform1 = (Transform)EditorGUILayout.ObjectField("Transform 1", rootTransform1, typeof(Transform), true);
            if (EditorGUI.EndChangeCheck())
            {
                pathMap1.Clear();
                if (rootTransform1 != null)
                {
                    GetChildPath("", rootTransform1, pathMap1);
                }
            }
            EditorGUI.BeginChangeCheck();
            rootTransform2 = (Transform)EditorGUILayout.ObjectField("Transform 2", rootTransform2, typeof(Transform), true);
            if (EditorGUI.EndChangeCheck())
            {
                pathMap2.Clear();
                if (rootTransform2 != null)
                {
                    GetChildPath("", rootTransform2, pathMap2);
                }
            }
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Copy TRS"))
            {
                rootTransform1.CopyTRSFrom(rootTransform2, true);
            }

            EditorGUILayout.Space();
            colorNormal   = GUI.backgroundColor;
            scrollPostion = EditorGUILayout.BeginScrollView(scrollPostion);
            EditorGUILayout.BeginHorizontal();
            if (rootTransform1 != null)
            {
                EditorGUILayout.BeginVertical();
                DrawTransformHierachy(rootTransform1, pathMap1, pathMap2);
                EditorGUILayout.EndVertical();
            }
            if (rootTransform2 != null)
            {
                EditorGUILayout.BeginVertical();
                DrawTransformHierachy(rootTransform2, pathMap2, pathMap1);
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndScrollView();
        }
Exemple #21
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EZEditorGUIUtility.MonoBehaviourTitle(target as MonoBehaviour);

            DrawOtherProperties();
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_AllowSwitchOff);
            EditorGUILayout.PropertyField(m_SwitchOnStart);
            EditorGUILayout.PropertyField(m_Next);
            optionList.DoLayoutList();

            serializedObject.ApplyModifiedProperties();
        }
Exemple #22
0
        public void DrawCopyListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty m_PathPair = m_CopyList.GetArrayElementAtIndex(index);
            SerializedProperty m_SrcPath  = m_PathPair.FindPropertyRelative("m_SrcPath");
            SerializedProperty m_DstPath  = m_PathPair.FindPropertyRelative("m_DstPath");

            rect    = EZEditorGUIUtility.DrawReorderableListIndex(rect, m_CopyList, index);
            rect.y += 1; rect.height = EditorGUIUtility.singleLineHeight;
            float width = rect.width / 2; float margin = 5; rect.width = width - margin;

            EditorGUI.PropertyField(rect, m_SrcPath, GUIContent.none);
            rect.x += width;
            EditorGUI.PropertyField(rect, m_DstPath, GUIContent.none);
        }
Exemple #23
0
        private static void DrawImporterListHeader(Rect rect, ReorderableList list)
        {
            rect.y += 1;
            rect    = EZEditorGUIUtility.DrawReorderableListCount(rect, list);
            float width = (rect.width - recursiveToggleWidth) * 0.5f;

            rect.width = width;
            EditorGUI.LabelField(rect, "Preset");
            rect.x += width;
            EditorGUI.LabelField(rect, "Association");
            rect.x    += width;
            rect.width = recursiveToggleWidth;
            EditorGUI.LabelField(rect, "Recursive");
        }
        public override void OnInspectorGUI()
        {
            EZEditorGUIUtility.MonoBehaviourTitle(framedImage);
            serializedObject.Update();

            EditorGUILayout.PropertyField(m_Sprite);
            EditorGUILayout.PropertyField(m_Color);
            EditorGUILayout.PropertyField(m_Material);
            EditorGUILayout.PropertyField(m_RaycastTarget);
            EditorGUILayout.PropertyField(m_FillAmount);
            EditorGUILayout.PropertyField(m_FillCenter);

            serializedObject.ApplyModifiedProperties();
        }
Exemple #25
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EZEditorGUIUtility.ScriptableObjectTitle(target as ScriptableObject, !serializedObject.isEditingMultipleObjects);

            EditorGUILayout.PropertyField(m_FilePath);
            if (GUILayout.Button("Open Folder"))
            {
                if (!string.IsNullOrEmpty(m_FilePath.stringValue))
                {
                    Directory.CreateDirectory(m_FilePath.stringValue);
                }
                string projectPath = Application.dataPath.Substring(0, Application.dataPath.Length - 7);
                Application.OpenURL(string.Format("file://{0}/{1}", projectPath, m_FilePath.stringValue));
            }

            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("Game View Capture is only available when playing", MessageType.Info);
            GUI.enabled = EditorApplication.isPlaying;
            if (GUILayout.Button("Game View Capture"))
            {
                if (!string.IsNullOrEmpty(m_FilePath.stringValue))
                {
                    Directory.CreateDirectory(m_FilePath.stringValue);
                }
                capturer.ScreenCapture(GetPath());
            }
            GUI.enabled = true;

            EditorGUILayout.Space();
            camera = (Camera)EditorGUILayout.ObjectField("Target Camera", camera, typeof(Camera), true);
            EditorGUILayout.PropertyField(m_Resolution);
            EditorGUILayout.PropertyField(m_TextureFormat);
            if (camera == null)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Camera Capture"))
            {
                if (!string.IsNullOrEmpty(m_FilePath.stringValue))
                {
                    Directory.CreateDirectory(m_FilePath.stringValue);
                }
                capturer.CameraCapture(camera, GetPath());
            }
            GUI.enabled = true;

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EZEditorGUIUtility.MonoBehaviourTitle(target as MonoBehaviour);

            EditorGUILayout.PropertyField(m_TransitionType);
            EditorGUI.indentLevel++;
            switch (m_TransitionType.enumValueIndex)
            {
            case (int)EZTransition.TransitionType.None:
                break;

            case (int)EZTransition.TransitionType.Scale:
                EditorGUILayout.PropertyField(m_RectTransform);
                EditorGUILayout.PropertyField(m_ScaleState.FindPropertyRelative("m_NormalScale"));
                EditorGUILayout.PropertyField(m_ScaleState.FindPropertyRelative("m_HighlightedScale"));
                EditorGUILayout.PropertyField(m_ScaleState.FindPropertyRelative("m_PressedScale"));
                EditorGUILayout.PropertyField(m_ScaleState.FindPropertyRelative("m_DisabledScale"));
                break;

            case (int)EZTransition.TransitionType.Size:
                EditorGUILayout.PropertyField(m_RectTransform);
                EditorGUILayout.PropertyField(m_SizeState.FindPropertyRelative("m_NormalSize"));
                EditorGUILayout.PropertyField(m_SizeState.FindPropertyRelative("m_HighlightedSize"));
                EditorGUILayout.PropertyField(m_SizeState.FindPropertyRelative("m_PressedSize"));
                EditorGUILayout.PropertyField(m_SizeState.FindPropertyRelative("m_DisabledSize"));
                break;

            case (int)EZTransition.TransitionType.OutlineDistance:
                EditorGUILayout.PropertyField(m_Outline);
                EditorGUILayout.PropertyField(m_OutlineDistanceState.FindPropertyRelative("m_NormalDistance"));
                EditorGUILayout.PropertyField(m_OutlineDistanceState.FindPropertyRelative("m_HighlightedDistance"));
                EditorGUILayout.PropertyField(m_OutlineDistanceState.FindPropertyRelative("m_PressedDistance"));
                EditorGUILayout.PropertyField(m_OutlineDistanceState.FindPropertyRelative("m_DisabledDistance"));
                break;

            case (int)EZTransition.TransitionType.OutlineColor:
                EditorGUILayout.PropertyField(m_Outline);
                EditorGUILayout.PropertyField(m_OutlineColorState.FindPropertyRelative("m_NormalColor"));
                EditorGUILayout.PropertyField(m_OutlineColorState.FindPropertyRelative("m_HighlightedColor"));
                EditorGUILayout.PropertyField(m_OutlineColorState.FindPropertyRelative("m_PressedColor"));
                EditorGUILayout.PropertyField(m_OutlineColorState.FindPropertyRelative("m_DisabledColor"));
                break;
            }
            EditorGUI.indentLevel--;

            serializedObject.ApplyModifiedProperties();
        }
        private void DrawMethodListHeader(Rect rect, ReorderableList list)
        {
            rect = EZEditorGUIUtility.CalcReorderableListHeaderRect(rect, list);
            float width = rect.width / 5;

            rect.width = width;
            EditorGUI.LabelField(rect, "DeclaringType");
            rect.x += rect.width;
            EditorGUI.LabelField(rect, "ReturnType");
            rect.x    += rect.width;
            rect.width = width * 2;
            EditorGUI.LabelField(rect, "MethodName");
            rect.x    += rect.width;
            rect.width = width - margin;
            EditorGUI.LabelField(rect, "IsStatic");
        }
 protected void OnGUI()
 {
     EZEditorGUIUtility.WindowTitle(this);
     scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
     for (int i = 0; i < texts.Length; i++)
     {
         Text text = texts[i];
         EditorGUILayout.BeginHorizontal();
         GUI.enabled = false;
         EditorGUILayout.ObjectField(text.gameObject, typeof(GameObject), true);
         GUI.enabled = true;
         text.font   = (Font)EditorGUILayout.ObjectField(text.font, typeof(Font), true);
         EditorGUILayout.EndHorizontal();
     }
     EditorGUILayout.EndScrollView();
 }
Exemple #29
0
 public void DrawCopyListHeader(Rect rect)
 {
     rect = EZEditorGUIUtility.DrawReorderableListCount(rect, copyList);
     if (copyList.count == 0)
     {
         EditorGUI.LabelField(rect, "Copy List");
     }
     else
     {
         float width = rect.width / 2; float margin = 5;
         rect.y += 1; rect.width = width - margin;
         EditorGUI.LabelField(rect, "Src");
         rect.x += width;
         EditorGUI.LabelField(rect, "Dst");
     }
 }
        protected void OnGUI()
        {
            EZEditorGUIUtility.WindowTitle(this);

            EditorGUILayout.LabelField("Input", EditorStyles.boldLabel);
            inputString = EditorGUILayout.TextArea(inputString, GUILayout.MinHeight(height));

            EditorGUILayout.LabelField("Regex", EditorStyles.boldLabel);
            regexString = EditorGUILayout.TextArea(regexString, GUILayout.MinHeight(height));

            EditorGUILayout.LabelField("Matches", EditorStyles.boldLabel);
            try
            {
                if (string.IsNullOrEmpty(regexString))
                {
                    return;
                }
                foreach (Match match in Regex.Matches(inputString, regexString))
                {
#if UNITY_2018_1_OR_NEWER && NET_4_6
                    EditorGUILayout.LabelField(string.Format("Match:\tIndex: {0}\tName: {1}\tValue: {2}", match.Index, match.Name, match.Value));
#else
                    EditorGUILayout.LabelField(string.Format("Match:\tIndex: {0}\tValue: {1}", match.Index, match.Value));
#endif
                    EditorGUI.indentLevel++;
                    foreach (Group group in match.Groups)
                    {
#if UNITY_2018_1_OR_NEWER && NET_4_6
                        EditorGUILayout.LabelField(string.Format("Group:\tIndex: {0}\tName: {1}\tValue: {2}", group.Index, group.Name, group.Value));
#else
                        EditorGUILayout.LabelField(string.Format("Group:\tIndex: {0}\tValue: {1}", group.Index, group.Value));
#endif
                        EditorGUI.indentLevel++;
                        foreach (Capture capture in group.Captures)
                        {
                            EditorGUILayout.LabelField(string.Format("Capture:\tIndex: {0}\tValue: {1}", capture.Index, capture.Value));
                        }
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }
            }
            catch
            {
            }
        }