void OnGUI()
    {
        Event e = Event.current;

        using (var scrollScope = new EditorGUILayout.ScrollViewScope(scrollPos))
        {
            scrollPos = scrollScope.scrollPosition;
            for (int i = 0; i < shaderMappings.Count; i++)
            {
                using (var vScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    using (var hScope = new EditorGUILayout.HorizontalScope())
                    {
                        string prefix = shaderMappings[i].show.target ? "-" : "+";
                        EditorGUILayout.LabelField($"{prefix} {shaderMappings[i].sourceShader.name}", EditorStyles.boldLabel);
                        if (EditorGUILayout.DropdownButton(new GUIContent(shaderMappings[i].targetShader ? shaderMappings[i].targetShader.name : "Target Shader"), FocusType.Passive))
                        {
                            var menu  = new GenericMenu();
                            var infos = ShaderUtil.GetAllShaderInfo();
                            foreach (var info in infos)
                            {
                                var j = i;
                                menu.AddItem(new GUIContent(info.name), shaderMappings[i].targetShader && shaderMappings[i].targetShader.name.Equals(info.name), () =>
                                {
                                    shaderMappings[j].AssignTarget(Shader.Find(info.name));
                                });
                            }
                            menu.ShowAsContext();
                        }
                    }
                    Rect r = GUILayoutUtility.GetLastRect();
                    if (e.type == EventType.MouseDown && e.button == 0 && r.Contains(e.mousePosition))
                    {
                        shaderMappings[i].show.target = !shaderMappings[i].show.target;
                    }
                    using (var fadeScope = new EditorGUILayout.FadeGroupScope(shaderMappings[i].show.faded))
                    {
                        if (fadeScope.visible)
                        {
                            if (shaderMappings[i].targetShader == null)
                            {
                                continue;
                            }
                            if (shaderMappings[i].targetShader == shaderMappings[i].sourceShader)
                            {
                                continue;
                            }
                            EditorGUI.indentLevel++;
                            using (var vScope2 = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                            {
                                foreach (var prop in shaderMappings[i].sourceShaderProps)
                                {
                                    var j = i;
                                    using (var hScope = new EditorGUILayout.HorizontalScope())
                                    {
                                        EditorGUILayout.LabelField(prop.name);
                                        if (shaderMappings[i].targetShaderProps.ContainsKey(prop.type))
                                        {
                                            if (EditorGUILayout.DropdownButton(new GUIContent(shaderMappings[i].propertyMapping.ContainsKey(prop) ? shaderMappings[i].propertyMapping[prop].name : "None"), FocusType.Passive))
                                            {
                                                var menu = new GenericMenu();
                                                menu.AddItem(new GUIContent("None"), false, () =>
                                                {
                                                    shaderMappings[j].propertyMapping.Remove(prop);
                                                });
                                                foreach (var p in shaderMappings[i].targetShaderProps[prop.type])
                                                {
                                                    menu.AddItem(new GUIContent(p.name), false, () =>
                                                    {
                                                        shaderMappings[j].propertyMapping[prop] = p;
                                                    });
                                                }
                                                menu.ShowAsContext();
                                            }
                                        }
                                        else
                                        {
                                            EditorGUILayout.LabelField($"No {prop.type} properties");
                                        }
                                    }
                                }
                            }
                            EditorGUI.indentLevel--;
                            using (var hScope = new EditorGUILayout.HorizontalScope(EditorStyles.helpBox))
                            {
                                GUILayout.FlexibleSpace();
                                if (GUILayout.Button(new GUIContent("Material List", "List of materials that will be converted")))
                                {
                                    var materials = AssetDatabase.FindAssets("t:Material").Select(guid => AssetDatabase.LoadAssetAtPath <Material>(AssetDatabase.GUIDToAssetPath(guid))).Where(m => m.shader == shaderMappings[i].sourceShader);
                                    MaterialConverterListWindow.Open(materials.ToArray());
                                }
                                if (GUILayout.Button("Convert Materials"))
                                {
                                    var targetShader = shaderMappings[i].targetShader;
                                    var materials    = AssetDatabase.FindAssets("t:Material").Select(guid => AssetDatabase.LoadAssetAtPath <Material>(AssetDatabase.GUIDToAssetPath(guid))).Where(m => m.shader == shaderMappings[i].sourceShader);
                                    foreach (var mat in materials)
                                    {
                                        foreach (var key in shaderMappings[i].propertyMapping.Keys)
                                        {
                                            switch (key.type)
                                            {
                                            case ShaderUtil.ShaderPropertyType.Color:
                                                shaderMappings[i].propertyMapping[key].value = mat.GetColor(key.name);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.Float:
                                            case ShaderUtil.ShaderPropertyType.Range:
                                                shaderMappings[i].propertyMapping[key].value = mat.GetFloat(key.name);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.TexEnv:
                                                shaderMappings[i].propertyMapping[key].value = mat.GetTexture(key.name);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.Vector:
                                                shaderMappings[i].propertyMapping[key].value = mat.GetVector(key.name);
                                                break;
                                            }
                                        }
                                        mat.shader = shaderMappings[i].targetShader;
                                        foreach (var key in shaderMappings[i].propertyMapping.Keys)
                                        {
                                            switch (key.type)
                                            {
                                            case ShaderUtil.ShaderPropertyType.Color:
                                                // Debug.Log($"SetColor: {(Color)shaderMappings[i].propertyMapping[key].value}");
                                                mat.SetColor(shaderMappings[i].propertyMapping[key].name, (Color)shaderMappings[i].propertyMapping[key].value);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.Float:
                                            case ShaderUtil.ShaderPropertyType.Range:
                                                // Debug.Log($"SetFloat: {(float)shaderMappings[i].propertyMapping[key].value}");
                                                mat.SetFloat(shaderMappings[i].propertyMapping[key].name, (float)shaderMappings[i].propertyMapping[key].value);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.TexEnv:
                                                // Debug.Log($"SetTexture: {(Texture)shaderMappings[i].propertyMapping[key].value}");
                                                mat.SetTexture(shaderMappings[i].propertyMapping[key].name, (Texture)shaderMappings[i].propertyMapping[key].value);
                                                break;

                                            case ShaderUtil.ShaderPropertyType.Vector:
                                                // Debug.Log($"SetVector: {(Vector4)shaderMappings[i].propertyMapping[key].value}");
                                                mat.SetVector(shaderMappings[i].propertyMapping[key].name, (Vector4)shaderMappings[i].propertyMapping[key].value);
                                                break;
                                            }
                                        }
                                    }
                                    shaderMappings[i] = new ShaderMapping(targetShader, this);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
        override public void OnInspectorGUI()
        {
            DrawDefaultInspector();
            var UIManagerButton = target as UIManagerButton;

            EditorGUI.indentLevel++;

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicFilled = EditorGUILayout.ObjectField("Background", UIManagerButton.basicFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicText   = EditorGUILayout.ObjectField("Text", UIManagerButton.basicText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC_ONLY_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicOnlyIconFilled = EditorGUILayout.ObjectField("Background", UIManagerButton.basicOnlyIconFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicOnlyIconIcon   = EditorGUILayout.ObjectField("Icon", UIManagerButton.basicOnlyIconIcon, typeof(Image), true) as Image;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC_WITH_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicWithIconFilled = EditorGUILayout.ObjectField("Background", UIManagerButton.basicWithIconFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicWithIconIcon   = EditorGUILayout.ObjectField("Icon", UIManagerButton.basicWithIconIcon, typeof(Image), true) as Image;
                    UIManagerButton.basicWithIconText   = EditorGUILayout.ObjectField("Text", UIManagerButton.basicWithIconText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC_OUTLINE)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicOutlineBorder         = EditorGUILayout.ObjectField("Border", UIManagerButton.basicOutlineBorder, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineFilled         = EditorGUILayout.ObjectField("Filled", UIManagerButton.basicOutlineFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineText           = EditorGUILayout.ObjectField("Text", UIManagerButton.basicOutlineText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                    UIManagerButton.basicOutlineTextHighligted = EditorGUILayout.ObjectField("Text Highlighted", UIManagerButton.basicOutlineTextHighligted, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC_OUTLINE_ONLY_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicOutlineOOBorder          = EditorGUILayout.ObjectField("Border", UIManagerButton.basicOutlineOOBorder, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineOOFilled          = EditorGUILayout.ObjectField("Filled", UIManagerButton.basicOutlineOOFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineOOIcon            = EditorGUILayout.ObjectField("Icon", UIManagerButton.basicOutlineOOIcon, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineOOIconHighlighted = EditorGUILayout.ObjectField("Icon Highlighted", UIManagerButton.basicOutlineOOIconHighlighted, typeof(Image), true) as Image;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.BASIC_OUTLINE_WITH_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.basicOutlineWOBorder          = EditorGUILayout.ObjectField("Border", UIManagerButton.basicOutlineWOBorder, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineWOFilled          = EditorGUILayout.ObjectField("Filled", UIManagerButton.basicOutlineWOFilled, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineWOIcon            = EditorGUILayout.ObjectField("Icon", UIManagerButton.basicOutlineWOIcon, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineWOIconHighlighted = EditorGUILayout.ObjectField("Icon Highlighted", UIManagerButton.basicOutlineWOIconHighlighted, typeof(Image), true) as Image;
                    UIManagerButton.basicOutlineWOText            = EditorGUILayout.ObjectField("Text", UIManagerButton.basicOutlineWOText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                    UIManagerButton.basicOutlineWOTextHighligted  = EditorGUILayout.ObjectField("Text Highlighted", UIManagerButton.basicOutlineWOTextHighligted, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.RADIAL_ONLY_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.radialOOBackground = EditorGUILayout.ObjectField("Background", UIManagerButton.radialOOBackground, typeof(Image), true) as Image;
                    UIManagerButton.radialOOIcon       = EditorGUILayout.ObjectField("Icon", UIManagerButton.radialOOIcon, typeof(Image), true) as Image;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.RADIAL_OUTLINE_ONLY_ICON)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.radialOutlineOOBorder          = EditorGUILayout.ObjectField("Border", UIManagerButton.radialOutlineOOBorder, typeof(Image), true) as Image;
                    UIManagerButton.radialOutlineOOFilled          = EditorGUILayout.ObjectField("Filled", UIManagerButton.radialOutlineOOFilled, typeof(Image), true) as Image;
                    UIManagerButton.radialOutlineOOIcon            = EditorGUILayout.ObjectField("Icon", UIManagerButton.radialOutlineOOIcon, typeof(Image), true) as Image;
                    UIManagerButton.radialOutlineOOIconHighlighted = EditorGUILayout.ObjectField("Icon Highlighted", UIManagerButton.radialOutlineOOIconHighlighted, typeof(Image), true) as Image;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.ROUNDED)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.roundedBackground = EditorGUILayout.ObjectField("Background", UIManagerButton.roundedBackground, typeof(Image), true) as Image;
                    UIManagerButton.roundedText       = EditorGUILayout.ObjectField("Text", UIManagerButton.roundedText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(UIManagerButton.buttonType == UIManagerButton.ButtonType.ROUNDED_OUTLINE)))
            {
                if (group.visible == true)
                {
                    UIManagerButton.roundedOutlineBorder         = EditorGUILayout.ObjectField("Border", UIManagerButton.roundedOutlineBorder, typeof(Image), true) as Image;
                    UIManagerButton.roundedOutlineFilled         = EditorGUILayout.ObjectField("Filled", UIManagerButton.roundedOutlineFilled, typeof(Image), true) as Image;
                    UIManagerButton.roundedOutlineText           = EditorGUILayout.ObjectField("Text", UIManagerButton.roundedOutlineText, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                    UIManagerButton.roundedOutlineTextHighligted = EditorGUILayout.ObjectField("Text Highlighted", UIManagerButton.roundedOutlineTextHighligted, typeof(TextMeshProUGUI), true) as TextMeshProUGUI;
                }
            }
        }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.LabelField("Tweeners settings", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            tweenEffect.doMove      = GUILayout.Toggle(tweenEffect.doMove, "Use DOMove Tweener");
            tweenEffect.doRotate    = GUILayout.Toggle(tweenEffect.doRotate, "Use DORotate Tweener");
            tweenEffect.doScale     = GUILayout.Toggle(tweenEffect.doScale, "Use DOScale Tweener");
            tweenEffect.doFadeAlpha = GUILayout.Toggle(tweenEffect.doFadeAlpha, "Use DOFadeAlpha Tweener");

            using (new EditorGUI.DisabledScope(!(tweenEffect.doScale && tweenEffect.doMove)))
                tweenEffect.isSimultaneos = GUILayout.Toggle(tweenEffect.isSimultaneos, "Use Simultaneosly");

            #region doMove

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(tweenEffect.doMove)))
            {
                if (group.visible)
                {
                    EditorGUILayout.LabelField("DoMove Settings", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    tweenEffect.initialPos = EditorGUILayout.Vector3Field("Initial Position", tweenEffect.initialPos);
                    tweenEffect.finalPos   = EditorGUILayout.Vector3Field("Final Position", tweenEffect.finalPos);
                    //EditorGUILayout.PrefixLabel("Duration");
                    //tweenEffect.moveDuration = EditorGUILayout.Slider(tweenEffect.moveDuration, 0f, 5f);
                    tweenEffect.moveDuration = EditorGUILayout.Slider("Duration", tweenEffect.moveDuration, 0f, 5f);

                    EditorGUI.indentLevel--;
                }
            }
            #endregion

            #region doRotate

            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(tweenEffect.doRotate)))
            {
                if (group.visible)
                {
                    EditorGUILayout.LabelField("DoRotate Settings", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    tweenEffect.initialAngle = EditorGUILayout.Vector3Field("Initial Angle", tweenEffect.initialAngle);
                    tweenEffect.finalAngle   = EditorGUILayout.Vector3Field("Final Angle", tweenEffect.finalAngle);
                    //EditorGUILayout.PrefixLabel("Duration");
                    tweenEffect.rotateDuration = EditorGUILayout.Slider("Duration", tweenEffect.rotateDuration, 0f, 5f);

                    EditorGUI.indentLevel--;
                }
            }
            #endregion

            #region doScale
            if (tweenEffect.doScale)
            {
                EditorGUILayout.LabelField("DoScale Settings", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                tweenEffect.initialScale = EditorGUILayout.Vector3Field("Initial Scale", tweenEffect.initialScale);
                tweenEffect.finalScale   = EditorGUILayout.Vector3Field("Final Scale", tweenEffect.finalScale);
                if (!tweenEffect.isSimultaneos)
                {
                    tweenEffect.scaleDuration = EditorGUILayout.Slider("Duration", tweenEffect.scaleDuration, 0f, 5f);
                }
                EditorGUI.indentLevel--;
            }
            #endregion

            #region doFadeAlpha
            if (tweenEffect.doFadeAlpha)
            {
                EditorGUILayout.LabelField("DoFadeAlpha Settings", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                tweenEffect.initialAlpha = EditorGUILayout.Slider("Initial Alpha", tweenEffect.initialAlpha, 0f, 1f);
                tweenEffect.finalAlpha   = EditorGUILayout.Slider("Final Alpha", tweenEffect.finalAlpha, 0f, 1f);

                if (!tweenEffect.isSimultaneos)
                {
                    tweenEffect.fadeDuration = EditorGUILayout.Slider("Duration", tweenEffect.fadeDuration, 0f, 5f);
                }
                EditorGUI.indentLevel--;
            }
            #endregion

            EditorGUI.indentLevel--;
        }
    override public void OnInspectorGUI()
    {
        QcCylinderMesh mesh = target as QcCylinderMesh;

        mesh.properties.radius    = EditorGUILayout.Slider("Radius", mesh.properties.radius, 0.01f, 10);
        mesh.properties.topRadius = EditorGUILayout.Slider("Top Radius", mesh.properties.topRadius, 0.0f, 10);
        mesh.properties.height    = EditorGUILayout.Slider("Height", mesh.properties.height, 0.1f, 10);

        mesh.properties.offset =
            EditorGUILayout.Vector3Field("Offset", mesh.properties.offset);

        mesh.properties.sides =
            EditorGUILayout.IntSlider("Sides", mesh.properties.sides, 8, 64);

        mesh.properties.sliceOn   = EditorGUILayout.Toggle("Slice On", mesh.properties.sliceOn);
        mesh.properties.sliceFrom = EditorGUILayout.Slider("Slice From", mesh.properties.sliceFrom, 0.0f, 360);
        mesh.properties.sliceTo   = EditorGUILayout.Slider("Slice To", mesh.properties.sliceTo, 0.0f, 360);


        EditorGUILayout.Space();
        mesh.properties.option =
            (QcCylinderMesh.QcCylinderProperties.Options)EditorGUILayout.EnumPopup("Option", mesh.properties.option);

        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.option !=
                                                                       QcCylinderMesh.QcCylinderProperties.Options.BeveledEdge)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.beveledEdge.width =
                    EditorGUILayout.Slider("Width", mesh.properties.beveledEdge.width, 0.001f,
                                           (mesh.properties.height * 0.5f < mesh.properties.radius) ? mesh.properties.height * 0.5f : mesh.properties.radius);
                EditorGUI.indentLevel--;
            }
        }

        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.option !=
                                                                       QcCylinderMesh.QcCylinderProperties.Options.Hollow)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.hollow.thickness =
                    EditorGUILayout.Slider("Thickness", mesh.properties.hollow.thickness, 0.001f, mesh.properties.radius);

                mesh.properties.hollow.height =
                    EditorGUILayout.Slider("Height", mesh.properties.hollow.height, 0.1f, mesh.properties.height);
                EditorGUI.indentLevel--;
            }
        }

        mesh.properties.genTextureCoords = EditorGUILayout.Toggle("Gen Texture Coords", mesh.properties.genTextureCoords);
        mesh.properties.addCollider      = EditorGUILayout.Toggle("Add Collider", mesh.properties.addCollider);

        ShowVertexCount(mesh);

        CheckValues(mesh);

        if (oldProp.Modified(mesh.properties))
        {
            mesh.RebuildGeometry();

            oldProp.CopyFrom(mesh.properties);
        }
    }
    public void EditorGUILayoutExamples()
    {
        EditorGUILayout.LabelField("Hello World!");

        Rect rect = EditorGUILayout.GetControlRect(false, 50);

        GUI.Button(rect, GUIContent.none);


        gradient = EditorGUILayout.GradientField("Gradient", gradient);
        //EditorGUILayout.HelpBox("Hello, World !", MessageType.Info);
        //EditorGUILayout.HelpBox("Hello, World !", MessageType.Error);
        EditorGUILayout.HelpBox("Hello, World !", MessageType.Warning);
        //EditorGUILayout.HelpBox("Hello, World !", MessageType.None);
        EditorGUILayout.SelectableLabel("This is a selectable label");

        EditorGUILayout.DropdownButton(GUIContent.none, FocusType.Keyboard);

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal("Toolbar", GUILayout.ExpandWidth(true));
        {
            if (GUILayout.Button("Clear", "ToolbarButton", GUILayout.Width(45f)))
            {
                Debug.Log("You click Clear button");
            }
            // Create space between Clear and Collapse button.
            GUILayout.Space(5f);
            // Create toggles button.
            collapsed   = GUILayout.Toggle(collapsed, "Collapse", "ToolbarButton");
            clearOnPlay = GUILayout.Toggle(clearOnPlay, "Clear on Play", "ToolbarButton");
            // Push content to be what they should be. (ex. width)
            GUILayout.FlexibleSpace();
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EditorToolbar(vertexTool);

        bounds      = EditorGUILayout.BoundsField("Bounds", bounds);
        doubleValue = EditorGUILayout.DelayedDoubleField("Delayed Double", doubleValue);

        BuildTargetGroup buildTargetGroup = EditorGUILayout.BeginBuildTargetSelectionGrouping();

        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField($"BuildTarget:{buildTargetGroup}");
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.EndBuildTargetSelectionGrouping();


        using (var v = new EditorGUILayout.VerticalScope("button"))
        {
            Rect r = new Rect(v.rect);
            r.height = r.height / 2;
            if (GUI.Button(r, GUIContent.none))
            {
                Debug.Log("Go here");
            }
            GUILayout.Label("I'm inside the button");
            GUILayout.Label("So am I");
            GUILayout.Label($"{v.rect.width} x {v.rect.height}");
        }

        //
        m_ShowExtraFields.target = EditorGUILayout.ToggleLeft("Show extra fields", m_ShowExtraFields.target);

        //Extra block that can be toggled on and off.
        using (var group = new EditorGUILayout.FadeGroupScope(m_ShowExtraFields.faded))
        {
            if (group.visible)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PrefixLabel("Color");
                m_Color = EditorGUILayout.ColorField(m_Color);
                EditorGUILayout.PrefixLabel("Text");
                m_String = EditorGUILayout.TextField(m_String);
                EditorGUILayout.PrefixLabel("Number");
                m_Number = EditorGUILayout.IntSlider(m_Number, 0, 10);
                EditorGUI.indentLevel--;
            }
        }


        using (var h = new EditorGUILayout.HorizontalScope())
        {
            using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos, GUILayout.Width(100), GUILayout.Height(100)))
            {
                scrollPos = scrollView.scrollPosition;
                GUILayout.Label(t);
            }
            if (GUILayout.Button("Add More Text", GUILayout.Width(100), GUILayout.Height(100)))
            {
                t += " \nAnd this is more text!";
            }
        }
        if (GUILayout.Button("Clear"))
        {
            t = "";
        }

        using (var posGroup = new EditorGUILayout.ToggleGroupScope("Align position", posGroupEnabled))
        {
            EditorGUI.indentLevel++;
            posGroupEnabled = posGroup.enabled;
            pos[0]          = EditorGUILayout.Toggle("x", pos[0]);
            pos[1]          = EditorGUILayout.Toggle("y", pos[1]);
            pos[2]          = EditorGUILayout.Toggle("z", pos[2]);
            EditorGUI.indentLevel--;
        }
    }
    override public void OnInspectorGUI()
    {
        QcSectionMesh mesh = target as QcSectionMesh;

        mesh.properties.width  = EditorGUILayout.Slider("Width", mesh.properties.width, 0.1f, 10);
        mesh.properties.depth  = EditorGUILayout.Slider("Depth", mesh.properties.depth, 0.01f, 10);
        mesh.properties.height = EditorGUILayout.Slider("Height", mesh.properties.height, 0.1f, 10);

        mesh.properties.offset =
            EditorGUILayout.Vector3Field("Offset", mesh.properties.offset);

        mesh.properties.type =
            (QcSectionMesh.QcSectionProperties.Types)EditorGUILayout.EnumPopup("Type", mesh.properties.type);


        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.type !=
                                                                       QcSectionMesh.QcSectionProperties.Types.LType)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.backThickness = EditorGUILayout.Slider("Back Thickness", mesh.properties.backThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.sideThickness = EditorGUILayout.Slider("Side Thickness", mesh.properties.sideThickness, 0.01f, mesh.properties.width * 0.95f);
                mesh.properties.capThickness  = EditorGUILayout.Toggle("Cap Thickness", mesh.properties.capThickness);
                using (new EditorGUI.DisabledScope(!mesh.properties.capThickness))
                {
                    EditorGUI.indentLevel++;
                    mesh.properties.backCap = EditorGUILayout.Slider("Back Cap", mesh.properties.backCap, 0.01f, mesh.properties.depth * 0.95f);
                    mesh.properties.sideCap = EditorGUILayout.Slider("Side Cap", mesh.properties.sideCap, 0.01f, mesh.properties.width * 0.95f);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }

        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.type !=
                                                                       QcSectionMesh.QcSectionProperties.Types.IType)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.frontThickness = EditorGUILayout.Slider("Front Thickness", mesh.properties.frontThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.backThickness  = EditorGUILayout.Slider("Back Thickness", mesh.properties.backThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.sideThickness  = EditorGUILayout.Slider("Side Thickness", mesh.properties.sideThickness, 0.01f, mesh.properties.width * 0.95f);
                mesh.properties.capThickness   = EditorGUILayout.Toggle("Cap Thickness", mesh.properties.capThickness);
                using (new EditorGUI.DisabledScope(!mesh.properties.capThickness))
                {
                    EditorGUI.indentLevel++;
                    mesh.properties.frontCap = EditorGUILayout.Slider("Front Cap", mesh.properties.frontCap, 0.01f, mesh.properties.depth * 0.95f);
                    mesh.properties.backCap  = EditorGUILayout.Slider("Back Cap", mesh.properties.backCap, 0.01f, mesh.properties.depth * 0.95f);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }

        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.type !=
                                                                       QcSectionMesh.QcSectionProperties.Types.CType)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.frontThickness = EditorGUILayout.Slider("Front Thickness", mesh.properties.frontThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.backThickness  = EditorGUILayout.Slider("Back Thickness", mesh.properties.backThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.sideThickness  = EditorGUILayout.Slider("Side Thickness", mesh.properties.sideThickness, 0.01f, mesh.properties.width * 0.95f);
                mesh.properties.capThickness   = EditorGUILayout.Toggle("Cap Thickness", mesh.properties.capThickness);
                using (new EditorGUI.DisabledScope(!mesh.properties.capThickness))
                {
                    EditorGUI.indentLevel++;
                    mesh.properties.frontCap = EditorGUILayout.Slider("Front Cap", mesh.properties.frontCap, 0.01f, mesh.properties.depth * 0.95f);
                    mesh.properties.backCap  = EditorGUILayout.Slider("Back Cap", mesh.properties.backCap, 0.01f, mesh.properties.depth * 0.95f);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }

        using (var group =
                   new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mesh.properties.type !=
                                                                       QcSectionMesh.QcSectionProperties.Types.TType)))
        {
            if (group.visible == false)
            {
                EditorGUI.indentLevel++;
                mesh.properties.backThickness = EditorGUILayout.Slider("Back Thickness", mesh.properties.backThickness, 0.01f, mesh.properties.depth * 0.95f);
                mesh.properties.sideThickness = EditorGUILayout.Slider("Side Thickness", mesh.properties.sideThickness, 0.01f, mesh.properties.width * 0.95f);
                mesh.properties.capThickness  = EditorGUILayout.Toggle("Cap Thickness", mesh.properties.capThickness);
                using (new EditorGUI.DisabledScope(!mesh.properties.capThickness))
                {
                    EditorGUI.indentLevel++;
                    mesh.properties.backCap = EditorGUILayout.Slider("Back Cap", mesh.properties.backCap, 0.01f, mesh.properties.depth * 0.95f);
                    mesh.properties.sideCap = EditorGUILayout.Slider("Side Cap", mesh.properties.sideCap, 0.01f, mesh.properties.width * 0.95f);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }


        mesh.properties.genTextureCoords = EditorGUILayout.Toggle("Gen Texture Coords", mesh.properties.genTextureCoords);

        mesh.properties.addCollider = EditorGUILayout.Toggle("Add Collider", mesh.properties.addCollider);

        ShowVertexCount(mesh);

        CheckValues(mesh);

        if (oldProp.Modified(mesh.properties))
        {
            mesh.RebuildGeometry();
            oldProp.CopyFrom(mesh.properties);
        }
    }
        /// <summary>
        /// The Unity OnInspectorGUI() method.
        /// </summary>
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUI.enabled = false;
            EditorGUILayout.PropertyField(_script, true, new GUILayoutOption[0]);
            GUI.enabled = true;

            var pointcloudVisualizerScript = target as PointcloudVisualizer;

            EditorGUILayout.PropertyField(
                _pointColor,
                new GUIContent(
                    "Point Color",
                    GetTooltip(pointcloudVisualizerScript, "PointColor")));

            EditorGUILayout.PropertyField(
                _defaultSize,
                new GUIContent(
                    "Default Size",
                    GetTooltip(pointcloudVisualizerScript, "_defaultSize")));

            EditorGUILayout.PropertyField(
                _maxPointCount,
                new GUIContent(
                    "Max Point Count",
                    GetTooltip(pointcloudVisualizerScript, "_maxPointCount")));

            EditorGUILayout.PropertyField(
                _enablePopAnimation,
                new GUIContent(
                    "Enable Pop Animation",
                    GetTooltip(pointcloudVisualizerScript, "EnablePopAnimation")));

            // Hide animation related fields if the pop animation is disabled.
            using (var group = new EditorGUILayout.FadeGroupScope(
                       Convert.ToSingle(pointcloudVisualizerScript.EnablePopAnimation)))
            {
                if (group.visible == true)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(
                        _maxPointsToAddPerFrame,
                        new GUIContent(
                            "Max Points To Add Per Frame",
                            GetTooltip(pointcloudVisualizerScript, "MaxPointsToAddPerFrame")));

                    EditorGUILayout.PropertyField(
                        _animationDuration,
                        new GUIContent(
                            "Animation Duration",
                            GetTooltip(pointcloudVisualizerScript, "AnimationDuration")));

                    EditorGUILayout.PropertyField(
                        _popSize,
                        new GUIContent(
                            "Pop Size",
                            GetTooltip(pointcloudVisualizerScript, "_popSize")));

                    EditorGUI.indentLevel--;
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #8
0
        public override void OnInspectorGUI()
        {
//			if (myWindow == null)
//				myWindow = (LMGEditorWindow)EditorWindow.GetWindow (typeof(LMGEditorWindow));
            serializedObject.Update();
            if (serializedObject == null)
            {
                return;
            }
            Init();

            var trg = (MapGeneratorSetUp)target;

            if (trg == null)
            {
                return;
            }

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField(new GUIContent("Level/Map to Generate"), EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.indentLevel++;

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(level, new GUIContent("Level/Map Texture"));
            if (EditorGUI.EndChangeCheck())
            {
                if (myWindow == null)
                {
                    myWindow = (LMGEditorWindow)EditorWindow.GetWindow(typeof(LMGEditorWindow));
                }
                myWindow.SetTexture((Texture2D)level.objectReferenceValue);
            }

            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField(new GUIContent("Block Size", "Unity units (1/100 pixel)"), EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.indentLevel++;

            EditorGUILayout.PropertyField(size, new GUIContent("Size", "Size to represent one pixel"));

            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField(new GUIContent("Entities and Blocks to Generate"), EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.indentLevel++;

            EditorGUILayout.PropertyField(entities, new GUIContent("Entities", "Entities in Level/Map"), true);

            EditorGUILayout.PropertyField(objects, new GUIContent("Objects", "Objects to make Level/Map"), true);

            EditorGUILayout.PropertyField(misc, new GUIContent("Misc Objects", "Decoration for the Level/Map"), true);
            if (misc.arraySize > 0)
            {
                EditorGUI.indentLevel++;

                rotCollapse = EditorGUILayout.Foldout(rotCollapse, new GUIContent("Random Rotation", "Random values between 2 vectors."), true);

                if (rotCollapse)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(minRotation, new GUIContent("Minimun", "Minimun rotation factor"));

                    EditorGUILayout.PropertyField(maxRotation, new GUIContent("Maximun", "Maximun rotation factor"));

                    EditorGUILayout.Space();
                    EditorGUI.indentLevel--;
                }

                scaleCollapse = EditorGUILayout.Foldout(scaleCollapse, new GUIContent("Random Scale", "Random values between 2 vectors."), true);

                if (scaleCollapse)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(minScale, new GUIContent("Minimun", "Minimun scale factor"));

                    EditorGUILayout.PropertyField(maxScale, new GUIContent("Maximun", "Maximun scale factor"));

                    EditorGUILayout.Space();
                    EditorGUI.indentLevel--;
                }
            }
            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField(new GUIContent("More Options", "Check if need"), EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUI.indentLevel++;

            EditorGUILayout.PropertyField(exOp, new GUIContent("Extra Options", "Extra objects to place"));
            if (!exOp.boolValue)
            {
                horizontal.boolValue = false;
            }
            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(trg.extraOptions))) {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(player, new GUIContent("Player", "If player is needed to be place"));
                    EditorGUILayout.PropertyField(horizontal, new GUIContent("Horizontal", "Is your game horizontaly placed"));
                    EditorGUI.indentLevel--;
//					using (var group2 = new EditorGUILayout.FadeGroupScope (Convert.ToSingle (trg.horizontal))) {
//						if (group2.visible) {
                    objCollapse = EditorGUILayout.Foldout(objCollapse, new GUIContent("Path Objects", "Prefabs for creating a path."), true);
                    if (objCollapse)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(straight, new GUIContent("Straight Path", "Straight path prefab"));
                        EditorGUILayout.PropertyField(curve, new GUIContent("Corner Path", "Corner path prefab"));
                        EditorGUILayout.PropertyField(cross, new GUIContent("Cross Section Path", "Cross Section path prefab"));
                        EditorGUILayout.PropertyField(begin, new GUIContent("Begining Path", "Begining path prefab"));
                        EditorGUILayout.PropertyField(end, new GUIContent("Ending Path", "Ending path prefab"));
                        EditorGUILayout.Space();
                        EditorGUI.indentLevel--;
                    }
                    colorCollapse = EditorGUILayout.Foldout(colorCollapse, new GUIContent("Path Colors", "Color for placing the path."), true);
                    if (colorCollapse)
                    {
                        EditorGUI.indentLevel++;

                        EditorGUILayout.BeginHorizontal();
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(pathColor, new GUIContent("Path Color", "Straight and corner path color"));
                        if (EditorGUI.EndChangeCheck() && myWindow != null)
                        {
                            myWindow.SetColor(pathColor.colorValue, "Path");
                        }
                        if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.MaxWidth(40)))
                        {
                            if (myWindow == null)
                            {
                                myWindow = (LMGEditorWindow)EditorWindow.GetWindow(typeof(LMGEditorWindow));
                            }
                            if (straight.objectReferenceValue != null && curve.objectReferenceValue != null)
                            {
                                myWindow.SetColor(pathColor.colorValue, "Path");
                            }
                            else
                            {
                                Debug.LogWarning("No prefab for straight path or corner has been asigned, check you references");
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(beginColor, new GUIContent("Begining Color", "Begining path color"));
                        if (EditorGUI.EndChangeCheck() && myWindow != null)
                        {
                            myWindow.SetColor(beginColor.colorValue, "Begining");
                        }
                        if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.MaxWidth(40)))
                        {
                            if (myWindow == null)
                            {
                                myWindow = (LMGEditorWindow)EditorWindow.GetWindow(typeof(LMGEditorWindow));
                            }
                            if (begin.objectReferenceValue != null)
                            {
                                myWindow.SetColor(beginColor.colorValue, "Begining");
                            }
                            else
                            {
                                Debug.LogWarning("No prefab for begining has been asigned, check you references");
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(endColor, new GUIContent("Ending Color", "Ending path color"));
                        if (EditorGUI.EndChangeCheck() && myWindow != null)
                        {
                            myWindow.SetColor(endColor.colorValue, "Ending");
                        }
                        if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.MaxWidth(40)))
                        {
                            if (myWindow == null)
                            {
                                myWindow = (LMGEditorWindow)EditorWindow.GetWindow(typeof(LMGEditorWindow));
                            }
                            if (end.objectReferenceValue != null)
                            {
                                myWindow.SetColor(endColor.colorValue, "Ending");
                            }
                            else
                            {
                                Debug.LogWarning("No prefab for ending has been asigned, check you references");
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.Space();
                        EditorGUI.indentLevel--;
                    }
//						}
//					}
                }
            }
            //
            //		EditorGUILayout.Space ();
            //
            //		EditorGUILayout.BeginHorizontal();
            //
            //		GUILayout.FlexibleSpace ();
            //
            //		if(GUILayout.Button (generate, EditorStyles.miniButtonLeft, miniButtonWidth)){
            //
            //			trg.GenerateLevel ();
            //
            //		}
            //
            //		if(GUILayout.Button (createPrefab, EditorStyles.miniButtonMid, miniButtonWidth)){
            //
            //			trg.CreatePrefab ();
            //
            //		}
            //
            //		if(GUILayout.Button (clear, EditorStyles.miniButtonRight, miniButtonWidth)){
            //
            //			trg.Clean();
            //
            //		}
            //		GUILayout.FlexibleSpace ();
            //
            //		EditorGUILayout.EndHorizontal ();

            EditorGUILayout.Space();
            EditorGUI.indentLevel = 0;
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
            EditorUtility.SetDirty(trg);
        }
Beispiel #9
0
    private GUIStyle guiStyle = new GUIStyle(); //create a new variable

    override public void OnInspectorGUI()
    {
        var triggerEvents = target as TriggerEvents;

        guiStyle.fontSize         = 12;          //change the font size
        guiStyle.normal.textColor = Color.white; //change the font size

        GUILayout.Space(10);
        GUILayout.Label("Type", guiStyle);
        GUILayout.Space(5);

        triggerEvents.oneTimeActivate = GUILayout.Toggle(triggerEvents.oneTimeActivate, " Activate Only 1 Time");

        GUILayout.Space(20);

        triggerEvents.interactable = GUILayout.Toggle(triggerEvents.interactable, " Is Interactable");
        using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(triggerEvents.interactable)))
        {
            if (group.visible == true)
            {
                EditorGUI.indentLevel++;
                GUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Interaction Text");
                triggerEvents.interactText = EditorGUILayout.TextArea(triggerEvents.interactText);
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
            }
        }
        GUILayout.Space(20);

        triggerEvents.subtitles = GUILayout.Toggle(triggerEvents.subtitles, " Is Subtitles");
        using (var sub = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(triggerEvents.subtitles)))
        {
            if (sub.visible == true)
            {
                EditorGUI.indentLevel++;

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.autoSubtitles = GUILayout.Toggle(triggerEvents.autoSubtitles, " Automatic Start");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.buttonProgression = GUILayout.Toggle(triggerEvents.buttonProgression, " Progress With 'Enter'");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.pauseWhileSubtitles = GUILayout.Toggle(triggerEvents.pauseWhileSubtitles, " Pause Game While Subtitles");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.triggerOnSubs = GUILayout.Toggle(triggerEvents.triggerOnSubs, " Trigger First Actions On Subtitles Start");
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.triggerAfterSubs = GUILayout.Toggle(triggerEvents.triggerAfterSubs, " Trigger Second Actions On Subtitles End");
                GUILayout.EndHorizontal();

                GUILayout.Space(20);

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); GUILayout.Label("Pages", guiStyle);
                GUILayout.EndHorizontal();

                EditorGUI.indentLevel++;
                DrawDefaultInspector();
                EditorGUI.indentLevel--;

                GUILayout.Space(20);

                GUILayout.BeginHorizontal();
                GUILayout.Space(20); GUILayout.Label("Cycle Text Speed", guiStyle);
                GUILayout.EndHorizontal();

                GUILayout.Space(5);
                GUILayout.BeginHorizontal();
                GUILayout.Space(20); triggerEvents.dynamicDelay = GUILayout.Toggle(triggerEvents.dynamicDelay, " Dynamic Delay");
                GUILayout.EndHorizontal();

                EditorGUI.indentLevel++;
                using (var delay = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(triggerEvents.dynamicDelay)))
                {
                    if (delay.visible == false)
                    {
                        EditorGUI.indentLevel++;
                        GUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel("Custom (Sec)");
                        triggerEvents.textDelay = EditorGUILayout.FloatField(triggerEvents.textDelay);
                        GUILayout.EndHorizontal();
                        EditorGUI.indentLevel--;
                    }
                    if (delay.visible == true)
                    {
                        EditorGUI.indentLevel++;
                        GUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel("Words Per Sec");
                        triggerEvents.wordsPerSecond = EditorGUILayout.IntSlider(triggerEvents.wordsPerSecond, 1, 15);
                        GUILayout.EndHorizontal();
                        EditorGUI.indentLevel--;
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
            }
        }
    }
        private void DrawDefaultsWhenTranslationForLanguageIsNotFound()
        {
            EditorGUILayout.LabelField("When Translation For a Language Is Not Found...", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(defaultToWhenTranslationNotFound, DefaultTextToLabel);

            // Check if we want to show the Default Language field
            bool showField = false;

            if (supportedLanguages.objectReferenceValue != null)
            {
                switch (defaultToWhenTranslationNotFound.enumValueIndex)
                {
                case (int)TranslationDictionary.TranslationNotFoundDefaults.DefaultLanguageOrNull:
                case (int)TranslationDictionary.TranslationNotFoundDefaults.DefaultLanguageOrEmptyString:
                case (int)TranslationDictionary.TranslationNotFoundDefaults.DefaultLanguageOrPresetMessage:
                    showField = true;

                    break;
                }
            }
            showDefaultLanguageForTranslationNotFound.target = showField;

            // Draw the default language field
            using (EditorGUILayout.FadeGroupScope defaultLanguageGroup = new EditorGUILayout.FadeGroupScope(showDefaultLanguageForTranslationNotFound.faded))
            {
                if ((defaultLanguageGroup.visible == true) && (showField == true))
                {
                    // Show default language field
                    EditorGUI.BeginChangeCheck();
                    SupportedLanguagesEditor.DrawSupportedLanguages(DefaultLanguageLabel, defaultLanguageWhenTranslationNotFound, ((SupportedLanguages)supportedLanguages.objectReferenceValue));
                    if (EditorGUI.EndChangeCheck() == true)
                    {
                        SupportedLanguages newLanguage = ((SupportedLanguages)supportedLanguages.objectReferenceValue);
                        if (newLanguage != null)
                        {
                            foreach (TranslationCollectionEditor editor in translationStatus)
                            {
                                editor.SupportedLanguages = newLanguage;
                            }
                        }
                    }
                }
            }

            // Check if we want to show the Preset Message field
            showField = false;
            switch (defaultToWhenTranslationNotFound.enumValueIndex)
            {
            case (int)TranslationDictionary.TranslationNotFoundDefaults.PresetMessage:
            case (int)TranslationDictionary.TranslationNotFoundDefaults.DefaultLanguageOrPresetMessage:
                showField = true;
                break;
            }
            showPresetMessageForTranslationNotFound.target = showField;

            // Draw the preset message field
            using (EditorGUILayout.FadeGroupScope presetMessageGroup = new EditorGUILayout.FadeGroupScope(showPresetMessageForTranslationNotFound.faded))
            {
                if (presetMessageGroup.visible == true)
                {
                    // Show preset message field
                    EditorGUILayout.PropertyField(presetMessageWhenTranslationNotFound, PresetMessageLabel);
                }
            }

            // Draw the replace empty string field
            replaceEmptyStringWithDefaultText.boolValue = EditorGUILayout.ToggleLeft("Replace Empty String With Default Text", replaceEmptyStringWithDefaultText.boolValue);
        }
        /*private void CheckTypes()
         * {
         *  foreach (var v in varRPC.variables.references)
         *  {
         *      Variable.DataType varType = (Variable.DataType)v.variable.type;
         *      if (varType == Variable.DataType.Null ||
         *      varType == Variable.DataType.GameObject ||
         *      varType == Variable.DataType.Sprite ||
         *      varType == Variable.DataType.Texture2D)
         *      {
         *          hasForbiddenTypes = true;
         *      }
         *      else
         *      {
         *          hasForbiddenTypes = false;
         *      }
         *  }
         * }*/

        public override void OnInspectorGUI()
        {
            if (serializedObject == null)
            {
                return;
            }

            base.OnInspectorGUI();
            localVars = target as LocalVariables;

            if (localVars.transform.root.gameObject.GetComponent <NetworkItem>())
            {
                return;
            }

            if (this.section == null)
            {
                this.section = new Section("Network Settings", "ActionNetwork.png", this.Repaint);
            }

            if (!initialized)
            {
                network = localVars.transform.root.gameObject.GetComponent <LocalVariablesNetwork>();

                //if(actionsNetwork != null) actionsRPC = ArrayUtility.Find(actionsNetwork.actions, p => p.actions == actions);
                if (network != null)
                {
                    serializedNetwork = new SerializedObject(network);
                    varRPC            = network.localVars.Find(p => p.variables == localVars);
                    index             = network.localVars.IndexOf(varRPC);
                }
                hasComponent = varRPC != null;
                initialized  = true;
                //CheckTypes();
            }

            bool hasChanged = false;

            this.section.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.section.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUI.BeginChangeCheck();
                    hasComponent = EditorGUILayout.Toggle(GUI_SYNC, hasComponent);
                    hasChanged   = EditorGUI.EndChangeCheck();

                    if (varRPC != null)
                    {
                        /*if (hasChanged)
                         * {
                         *  CheckTypes();
                         * }
                         * if (hasForbiddenTypes)
                         * {*/
                        EditorGUILayout.HelpBox(GUI_FORBID_TYPES, MessageType.Info);
                        //}
                    }
                    EditorGUILayout.EndVertical();
                }
            }

            if (hasChanged)
            {
                if (varRPC != null && network)
                {
                    Debug.Log("Removed LocalVariables");
                    network.localVars.Remove(varRPC);
                    if (network.localVars.Count == 0)
                    {
                        PhotonView pv = network.photonView;

                        DestroyImmediate(network, true);

                        /*if (!pv.GetComponent<CharacterNetwork>() ||
                         *  !pv.GetComponent<StatsNetwork>() ||
                         *  !pv.GetComponent<ActionsNetwork>())
                         * {
                         *  DestroyImmediate(pv, true);
                         * }*/
                    }

                    varRPC  = null;
                    network = null;

                    initialized = false;
                }
                else
                {
                    network = localVars.transform.root.gameObject.GetComponent <LocalVariablesNetwork>() ?? localVars.transform.root.gameObject.AddComponent <LocalVariablesNetwork>();

                    SerializedObject serializedObject = new UnityEditor.SerializedObject(network);

                    varRPC = new LocalVariablesNetwork.VarRPC()
                    {
                        variables = localVars
                    };
                    network.localVars.Add(varRPC);

                    Debug.LogFormat("Added LocalVariables: {0}", varRPC.variables.gameObject.name);

                    serializedObject.ApplyModifiedProperties();
                    serializedObject.Update();

                    hasComponent = true;
                }
                hasChanged = false;
            }
            EditorGUILayout.Space();
        }
Beispiel #12
0
    public override void OnInspectorGUI()
    {
        // base.OnInspectorGUI();

        serializedObject.Update();
        EditorGUILayout.PropertyField(pointProperty);
        EditorGUILayout.PropertyField(factor);

        factor.floatValue = PowerSlider("Power Slider:", 0.1f, 1000f, 10f, factor.floatValue);
        serializedObject.ApplyModifiedProperties();

        EditorGUILayout.BeginVertical();

        EditorGUILayout.LabelField("label");
        tmp1 = EditorGUILayout.Slider("slider", tmp1, 0, 1);
        tmp2 = EditorGUILayout.IntSlider("int slider", tmp2, 0, 10);
        tmp3 = EditorGUILayout.Toggle("toggle", tmp3);
        tmp4 = EditorGUILayout.ColorField("color", tmp4);

        using (var posGroup = new EditorGUILayout.ToggleGroupScope("Align position", toggleGroup))
        {
            toggleGroup = posGroup.enabled;
            tmp5        = EditorGUILayout.TextField("text", tmp5);
            if (GUILayout.Button("button"))
            {
                Debug.Log("click button");
            }
        }

        m_ShowExtraFields.target = EditorGUILayout.ToggleLeft("Show extra fields", m_ShowExtraFields.target);
        using (var group = new EditorGUILayout.FadeGroupScope(m_ShowExtraFields.faded))
        {
            if (group.visible)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PrefixLabel("Color");
                m_Color = EditorGUILayout.ColorField(m_Color);
                EditorGUILayout.PrefixLabel("Text");
                m_String = EditorGUILayout.TextField(m_String);
                EditorGUILayout.PrefixLabel("Number");
                m_Number = EditorGUILayout.IntSlider(m_Number, 0, 10);
                EditorGUI.indentLevel--;
            }
        }


        textAsset = EditorGUILayout.ObjectField("text field", textAsset, typeof(TextAsset), true) as TextAsset;
        using (var h = new EditorGUILayout.HorizontalScope(EditorStyles.helpBox))
        {
            using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos, GUILayout.Width(100), GUILayout.Height(100)))
            {
                scrollPos = scrollView.scrollPosition;
                text      = EditorGUILayout.TextArea(text);
            }
            if (GUILayout.Button("Read Text", GUILayout.Width(100), GUILayout.Height(100)))
            {
                text = textAsset ? textAsset.text : "Read Text Completed";
            }
            if (GUILayout.Button("Clear", GUILayout.Width(100), GUILayout.Height(100)))
            {
                text = "";
            }
        }

        foldout = EditorGUILayout.Foldout(foldout, "Fold Out");
        if (foldout)
        {
            EditorGUILayout.HelpBox("message", MessageType.Info);
            curveX   = EditorGUILayout.CurveField("curve X", curveX);
            gradient = EditorGUILayout.GradientField("gradient", gradient);
        }

        // Make an inspector-window-like titlebar.
        fold = EditorGUILayout.InspectorTitlebar(fold, target);
        if (fold)
        {
            EditorGUILayout.Space();
            position = EditorGUILayout.Vector3Field("Position", position);
        }

        tagStr = EditorGUILayout.TagField("Tag for Objects:", tagStr);

        enmPar = (EnumTest)EditorGUILayout.EnumFlagsField("Enum test", enmPar);
        index  = EditorGUILayout.Popup(index, options);

        newIndex = ShaderKeywordRadioGeneric("Outline Normals", newIndex, new[]
        {
            new GUIContent("R", "Use regular vertex normals"),
            new GUIContent("VC", "Use vertex colors as normals (with smoothed mesh)"),
            new GUIContent("T", "Use tangents as normals (with smoothed mesh)"),
            new GUIContent("UV2", "Use second texture coordinates as normals (with smoothed mesh)")
        });

        EditorGUILayout.EndVertical();
    }
Beispiel #13
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        Material targetMat = target as Material;

        // Update inspector if user changed shader.
        if (targetMat.shader.name != "Colr/Master Shader")
        {
            Repaint();
            EditorUtility.SetDirty(target);
            return;
        }

        var shdr = serializedObject.FindProperty("m_Shader");

        if (isVisible && !shdr.hasMultipleDifferentValues && shdr.objectReferenceValue != null)
        {
            string[] keywordsCurrent = targetMat.shaderKeywords;
            EditorGUI.BeginChangeCheck();

            if (targets == null || targets.Length == 0)
            {
                return;
            }

            TextureProperty(GetMaterialProperty(targets, "_MainTex"), "Texture");
            EditorGUILayout.Separator();

            ColorProperty(GetMaterialProperty(targets, "_TopColor"), "Top Color");
            ColorProperty(GetMaterialProperty(targets, "_BottomColor"), "Bottom Color");
            EditorGUILayout.Separator();

            // ---- FRONT ----
            frontMode        = (ColorMode)EditorGUILayout.EnumPopup("Front color override", frontMode);
            showFront.target = frontMode != ColorMode.OFF;
            using (var group = new EditorGUILayout.FadeGroupScope(showFront.faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;

                    if (frontMode == ColorMode.GRADIENT)
                    {
                        ColorProperty(GetMaterialProperty(targets, "_FrontTopColor"), "Front Top Color");
                        ColorProperty(GetMaterialProperty(targets, "_FrontBottomColor"), "Front Bottom Color");
                    }
                    else
                    {
                        ColorProperty(GetMaterialProperty(targets, "_FrontTopColor"), "Color");
                    }

                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Separator();

            // ---- BACK ----
            backMode        = (ColorMode)EditorGUILayout.EnumPopup("Back color override", backMode);
            showBack.target = backMode != ColorMode.OFF;
            using (var group = new EditorGUILayout.FadeGroupScope(showBack.faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;

                    if (backMode == ColorMode.GRADIENT)
                    {
                        ColorProperty(GetMaterialProperty(targets, "_BackTopColor"), "Back Top Color");
                        ColorProperty(GetMaterialProperty(targets, "_BackBottomColor"), "Back Bottom Color");
                    }
                    else
                    {
                        ColorProperty(GetMaterialProperty(targets, "_BackTopColor"), "Color");
                    }

                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Separator();

            // ---- LEFT ----
            leftMode        = (ColorMode)EditorGUILayout.EnumPopup("Left color override", leftMode);
            showLeft.target = leftMode != ColorMode.OFF;
            using (var group = new EditorGUILayout.FadeGroupScope(showLeft.faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;

                    if (leftMode == ColorMode.GRADIENT)
                    {
                        ColorProperty(GetMaterialProperty(targets, "_LeftTopColor"), "Left Top Color");
                        ColorProperty(GetMaterialProperty(targets, "_LeftBottomColor"), "Left Bottom Color");
                    }
                    else
                    {
                        ColorProperty(GetMaterialProperty(targets, "_LeftTopColor"), "Color");
                    }

                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Separator();

            // ---- RIGHT ----
            rightMode        = (ColorMode)EditorGUILayout.EnumPopup("Right color override", rightMode);
            showRight.target = rightMode != ColorMode.OFF;
            using (var group = new EditorGUILayout.FadeGroupScope(showRight.faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;

                    if (rightMode == ColorMode.GRADIENT)
                    {
                        ColorProperty(GetMaterialProperty(targets, "_RightTopColor"), "Right Top Color");
                        ColorProperty(GetMaterialProperty(targets, "_RightBottomColor"), "Right Bottom Color");
                    }
                    else
                    {
                        ColorProperty(GetMaterialProperty(targets, "_RightTopColor"), "Color");
                    }

                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Separator();

            // ---- FOG ----
            fogBottom = EditorGUILayout.Toggle("Fade bottom to fog", fogBottom);
            EditorGUILayout.Separator();

            // ---- ADDITIVE ----
            if (fogBottom)
            {
                independentSides = true;
            }
            else
            {
                independentSides = EditorGUILayout.Toggle("Do not mix colors of sides", independentSides);
                EditorGUILayout.Separator();
            }

            // ---- GRADIENT ----
            if (frontMode != ColorMode.SOLID || backMode != ColorMode.SOLID ||
                leftMode != ColorMode.SOLID || rightMode != ColorMode.SOLID ||
                fogBottom)
            {
                FloatProperty(GetMaterialProperty(targets, "_GradientYStartPos"), "Gradient start Y");
                float h = FloatProperty(GetMaterialProperty(targets, "_GradientHeight"), "Gradient height");
                if (h < 0)
                {
                    targetMat.SetFloat("_GradientHeight", 0);
                }
                EditorGUILayout.Separator();
            }

            ColorProperty(GetMaterialProperty(targets, "_LightTint"), "Light Color");
            EditorGUILayout.Separator();

            ColorProperty(GetMaterialProperty(targets, "_AmbientColor"), "Ambient Color");
            RangeProperty(GetMaterialProperty(targets, "_AmbientPower"), "Ambient Power");
            EditorGUILayout.Separator();

            lightmapOn = ArrayUtility.Contains(keywordsCurrent, LIGHTMAP_COLR_ON);
            using (var group = new EditorGUILayout.ToggleGroupScope("Enable Lightmap", lightmapOn))
            {
                lightmapOn = group.enabled;
                ColorProperty(GetMaterialProperty(targets, "_LightmapColor"), "Lightmap Color");
                RangeProperty(GetMaterialProperty(targets, "_LightmapPower"), "Lightmap Power");
            }
            EditorGUILayout.Separator();

            RangeProperty(GetMaterialProperty(targets, "_Rotation"), "Gradient Angle");
            GetMaterialProperty(targets, "_Offset").vectorValue =
                EditorGUILayout.Vector3Field("Angle Origin",
                                             GetMaterialProperty(targets, "_Offset").vectorValue);
            EditorGUILayout.Separator();

            // If a value changed.
            if (EditorGUI.EndChangeCheck())
            {
                ApplyProperties();
            }
        }
    }
Beispiel #14
0
        // PAINT METHODS: -------------------------------------------------------------------------

        public override void OnInspectorGUI()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            if (STYLE_LABEL == null)
            {
                STYLE_LABEL          = new GUIStyle(EditorStyles.label);
                STYLE_LABEL.richText = true;
            }

            if (this.statsAssetHash != this.statsAsset.GetHashCode() ||
                this.attrsAssetHash != this.attrsAsset.GetHashCode() ||
                this.statsEditorData.Count != this.statsAsset.stats.Length)
            {
                this.OnEnable();
                serializedObject.ApplyModifiedProperties();
            }

            serializedObject.Update();

            this.PaintAttributes();

            int statsSize = this.statsAsset.stats.Length;

            for (int i = 0; i < statsSize; ++i)
            {
                StatAsset statAsset = this.statsAsset.stats[i];
                if (statAsset.isHidden)
                {
                    continue;
                }

                string uname = statAsset.uniqueID;

                this.PaintStatHeader(statAsset, i);

                using (var group = new EditorGUILayout.FadeGroupScope(this.statsEditorData[i].isExpanded.faded))
                {
                    if (group.visible)
                    {
                        EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());
                        EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);
                        this.PaintStatBody(statAsset, this.spStatsOverrides[uname]);
                        EditorGUI.EndDisabledGroup();
                        EditorGUILayout.EndVertical();
                    }
                }
            }

            this.PaintStatusEffects();

            EditorGUILayout.Space();

            this.spSaveStats.boolValue = EditorGUILayout.ToggleLeft(
                this.spSaveStats.displayName,
                this.spSaveStats.boolValue
                );

            GlobalEditorID.Paint(this.instance);
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #15
0
        private void DrawAboutCinemaSuiteSection()
        {
            // Draw the About Cinema Suite Section
            Rect aboutRect = EditorGUILayout.GetControlRect(GUILayout.Width(base.position.width - 22));

            GUI.Box(new Rect(aboutRect.x - 4, aboutRect.y, aboutRect.width + 8, aboutRect.height), string.Empty, EditorStyles.toolbar);
            showCinemaSuiteAbout.target = EditorGUI.Foldout(aboutRect, showCinemaSuiteAbout.target, "About Cinema Suite");

#if UNITY_5
            using (var group = new EditorGUILayout.FadeGroupScope(showCinemaSuiteAbout.faded))
            {
                if (group.visible)
                {
#else
            {
                if (showCinemaSuiteAbout.target)
                {
#endif

                    // Header
                    EditorGUILayout.BeginHorizontal();
                    //GUILayout.Label("<b><size=30>Cinema Suite</size></b>");
                    GUILayout.Label(cinemaSuiteLogo);

                    // Web and Social Media Links
                    if (GUILayout.Button(websiteIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("http://www.cinema-suite.com");
                    }
                    if (GUILayout.Button(forumIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("http://cinema-suite.com/forum");
                    }
                    if (GUILayout.Button(facebookIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://www.facebook.com/CinemaSuiteInc/");
                    }
                    if (GUILayout.Button(twitterIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://twitter.com/CinemaSuiteInc");
                    }
                    if (GUILayout.Button(youtubeIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://www.youtube.com/cinemasuiteinc");
                    }

                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(8f);

                    // About us
                    GUILayout.Label("We are a team who are passionate about Video Games and are dedicated to creating useful software extensions for video game developers.");

                    // Special thanks
                    GUILayout.Label("We would like to extend a special thanks to the Canada Media Fund.");
                    GUILayout.Label(cmfLogo);

                    GUILayout.Space(16f);

                    // Legal Stuff
                    legalStuff = EditorGUILayout.Foldout(legalStuff, new GUIContent("Legal Stuff"));
                    if (legalStuff)
                    {
                        legalScrollPosition = GUILayout.BeginScrollView(legalScrollPosition, false, true, GUILayout.Height(200f));
                        GUILayout.TextArea(DISCLAIMER1 + DISCLAIMER2 + DISCLAIMER3 + DISCLAIMER4 + DISCLAIMER5 + DISCLAIMER6);

                        GUILayout.EndScrollView();
                    }
                }
            }
        }
        public override void OnInspectorGUI()
        {
            if (serializedObject == null)
            {
                return;
            }

            base.OnInspectorGUI();

            EditorGUILayout.BeginVertical();
            GUILayout.Space(-3);

            if (this.section == null)
            {
                this.section = new Section("Network Settings", GetTexture("ActionNetwork.png"), this.Repaint);
            }

            if (!initialized)
            {
                characterNetwork = character.GetComponent <CharacterNetwork>();
                if (characterNetwork != null && characterNetworkEditor == null)
                {
                    characterNetworkEditor = (CharacterNetworkEditor)Editor.CreateEditor(characterNetwork, typeof(CharacterNetworkEditor));
                }

                hasComponent = characterNetwork != null;
                initialized  = true;
            }

            bool hasChanged = false;

            this.section.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.section.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUI.BeginChangeCheck();
                    hasComponent = EditorGUILayout.Toggle(GUI_SYNC, hasComponent);
                    hasChanged   = EditorGUI.EndChangeCheck();

                    if (characterNetworkEditor != null)
                    {
                        characterNetworkEditor.serializedObject.Update();
                        characterNetworkEditor.PaintInspector();
                        characterNetworkEditor.serializedObject.ApplyModifiedProperties();
                    }
                    EditorGUILayout.EndVertical();
                }
            }

            if (hasChanged)
            {
                if (characterNetwork != null)
                {
                    DestroyImmediate(characterNetworkEditor);
                    DestroyImmediate(characterNetwork, true);
                    EditorGUIUtility.ExitGUI();

                    characterNetwork       = null;
                    characterNetworkEditor = null;
                    initialized            = false;
                }
                else
                {
                    characterNetwork = character.GetComponent <CharacterNetwork>() ?? character.gameObject.AddComponent <CharacterNetwork>();

                    characterNetwork.SetupPhotonView();

                    characterNetworkEditor     = (CharacterNetworkEditor)Editor.CreateEditor(characterNetwork, typeof(CharacterNetworkEditor));
                    characterNetwork.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;

                    hasComponent = true;
                }
                hasChanged = false;
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }
        public override void OnInspectorGUI()
        {
            if (serializedObject == null)
            {
                return;
            }

            base.OnInspectorGUI();
            stats = target as Stats;

            bool statsChanged = this.statsAsset2 == null ? false : this.statsAssetHash2 != this.statsAsset2.GetHashCode();
            bool attrsChanged = this.attrsAsset2 == null ? false : this.attrsAssetHash2 != this.attrsAsset2.GetHashCode();

            if (!initialized || statsChanged || attrsChanged)
            {
                this.ManualOnEnable();
                initialized = true;
                serializedObject.ApplyModifiedProperties();
            }

            if (this.section == null)
            {
                this.section = new Section("Network Settings", "ActionNetwork.png", this.Repaint);
            }

            bool hasChanged = false;

            this.section.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.section.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUI.BeginChangeCheck();
                    hasComponent = EditorGUILayout.Toggle(GUI_SYNC, hasComponent);
                    hasChanged   = EditorGUI.EndChangeCheck();

                    if (statsNetwork != null)
                    {
                        EditorGUI.BeginChangeCheck();
                        PaintAttributes();
                        EditorGUILayout.Space();
                        PaintStats();
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedStatObject.ApplyModifiedPropertiesWithoutUndo();
                        }
                    }

                    EditorGUILayout.EndVertical();
                }
            }

            if (hasChanged)
            {
                if (statsNetwork != null)
                {
                    DestroyImmediate(statsNetwork, true);
                    statsNetwork = null;
                    initialized  = false;
                }
                else
                {
                    statsNetwork = stats.gameObject.GetComponent <StatsNetwork>() ?? stats.gameObject.AddComponent <StatsNetwork>();
                    statsNetwork.SetupPhotonView();

                    serializedStatObject = new UnityEditor.SerializedObject(statsNetwork);

                    serializedStatObject.ApplyModifiedProperties();
                    serializedStatObject.Update();

                    hasComponent = true;
                }
                hasChanged = false;
            }
            EditorGUILayout.Space();
        }
    public override void OnInspectorGUI()
    {
        bl_SocialCounter myTarget = (bl_SocialCounter)target;

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.LabelField("Global", EditorStyles.boldLabel);
        myTarget.UpdateEach        = EditorGUILayout.Slider("Update Each:", myTarget.UpdateEach, 10, 9999);
        myTarget.HideOnNonInternet = EditorGUILayout.ToggleLeft("Hide On Non Internet?", myTarget.HideOnNonInternet, EditorStyles.toolbarButton);
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.LabelField("Social Settings", EditorStyles.boldLabel);
        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect = EditorGUILayout.GetControlRect();

        showFacebook.target = EditorGUI.Foldout(foldoutRect, showFacebook.target, "Facebok", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showFacebook.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.Facebook_ID = EditorGUILayout.TextField("Facebook URL:", myTarget.Facebook_ID);
                EditorGUILayout.EndVertical();
            }
        }

        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect2 = EditorGUILayout.GetControlRect();

        showTwitter.target = EditorGUI.Foldout(foldoutRect2, showTwitter.target, "Twitter", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showTwitter.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.Twitter_User = EditorGUILayout.TextField("Twitter User", myTarget.Twitter_User);
                EditorGUILayout.EndVertical();
            }
        }


        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect3 = EditorGUILayout.GetControlRect();

        showYoutube.target = EditorGUI.Foldout(foldoutRect3, showYoutube.target, "Youtube", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showYoutube.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.ChannelID  = EditorGUILayout.TextField("Youtube Channel ID", myTarget.ChannelID);
                myTarget.YoutubeKey = EditorGUILayout.TextField("Youtube API Key", myTarget.YoutubeKey);
                EditorGUILayout.EndVertical();
            }
        }


        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect4 = EditorGUILayout.GetControlRect();

        showInstagram.target = EditorGUI.Foldout(foldoutRect4, showInstagram.target, "Instagram", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showInstagram.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.Instagram_UserID     = EditorGUILayout.TextField("Instagram Username", myTarget.Instagram_UserID);
                myTarget.Instagram_AcessToken = EditorGUILayout.TextField("Instagram Access Toke", myTarget.Instagram_AcessToken);
                EditorGUILayout.EndVertical();
            }
        }


        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect5 = EditorGUILayout.GetControlRect();

        showGoogle.target = EditorGUI.Foldout(foldoutRect5, showGoogle.target, "Google Plus", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showGoogle.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.GooglePlus_User = EditorGUILayout.TextField("GooglePlus ID", myTarget.GooglePlus_User);
                myTarget.GooglePlus_Key  = EditorGUILayout.TextField("GooglePlus API Key", myTarget.GooglePlus_Key);
                EditorGUILayout.EndVertical();
            }
        }

        EditorGUILayout.BeginVertical(skin.FindStyle("header"));
        Rect foldoutRect6 = EditorGUILayout.GetControlRect();

        showGithub.target = EditorGUI.Foldout(foldoutRect6, showGithub.target, "Github", true);
        EditorGUILayout.EndVertical();

        using (var typeGroup = new EditorGUILayout.FadeGroupScope(showGithub.faded))
        {
            if (typeGroup.visible)
            {
                EditorGUILayout.BeginVertical(skin.FindStyle("content"));
                myTarget.Github_User = EditorGUILayout.TextField("Github Username", myTarget.Github_User);
                EditorGUILayout.EndVertical();
            }
        }
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(myTarget);
        }
    }
Beispiel #19
0
        public override void OnInspectorGUI()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            settings.Update();

            // Update AnimBool options. For properties changed they will be smoothly interpolated.
            UpdateShowOptions(false);

            settings.DrawLightType();

            EditorGUILayout.Space();

            // When we are switching between two light types that don't show the range (directional and area lights)
            // we want the fade group to stay hidden.
            using (var group = new EditorGUILayout.FadeGroupScope(1.0f - m_AnimDirOptions.faded))
                if (group.visible)
                {
                    settings.DrawRange(m_AnimAreaOptions.target);
                }

            // Spot angle
            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimSpotOptions.faded))
                if (group.visible)
                {
                    DrawSpotAngle();
                }

            // Area width & height
            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimAreaOptions.faded))
                if (group.visible)
                {
                    settings.DrawArea();
                }

            settings.DrawColor();

            EditorGUILayout.Space();

            CheckLightmappingConsistency();
            using (var group = new EditorGUILayout.FadeGroupScope(1.0f - m_AnimAreaOptions.faded))
                if (group.visible)
                {
                    Light light = target as Light;
                    if (light.type != LightType.Disc)
                    {
                        settings.DrawLightmapping();
                    }
                }

            settings.DrawIntensity();

            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimLightBounceIntensity.faded))
                if (group.visible)
                {
                    settings.DrawBounceIntensity();
                }

            ShadowsGUI();

            settings.DrawRenderMode();
            settings.DrawCullingMask();
            Light cLight = target as Light;

            int lightLayer = cLight.renderingLayerMask;

            string[] names = Enum.GetNames(typeof(RenderingLayerMask));
            EditorGUI.BeginChangeCheck();
            lightLayer = EditorGUILayout.MaskField(s_Styles.layerMaskContent, lightLayer, names);

            if (EditorGUI.EndChangeCheck())
            {
                cLight.renderingLayerMask = lightLayer;
                Debug.Log(cLight.renderingLayerMask);
            }

            EditorGUILayout.Space();

#if UNITY_2019_1_OR_NEWER
            var sceneLighting = SceneView.lastActiveSceneView.sceneLighting;
#else
            var sceneLighting = SceneView.lastActiveSceneView.m_SceneLighting;
#endif

            if (SceneView.lastActiveSceneView != null && !sceneLighting)
            {
                EditorGUILayout.HelpBox(s_Styles.DisabledLightWarning.text, MessageType.Warning);
            }

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #20
0
        private void PaintCharacterBasicProperties()
        {
            this.sectionProperties1.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.sectionProperties1.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUILayout.LabelField("Basics:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField("Save/Load:", EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(this.spSave);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.Space();

                    EditorGUILayout.LabelField("Character Visuals:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.spGender);
                    EditorGUILayout.PropertyField(this.spHeadAllIndex);
                    EditorGUILayout.PropertyField(this.spHeadNoIndex);
                    EditorGUILayout.PropertyField(this.spEyebrowIndex);
                    EditorGUILayout.PropertyField(this.spFacialHairIndex);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.LabelField("Character Colors:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.spPrimaryColor);
                    EditorGUILayout.PropertyField(this.spSecondaryColor);
                    EditorGUILayout.PropertyField(this.spLeatherPrimaryColor);
                    EditorGUILayout.PropertyField(this.spLeatherSecondaryColor);
                    EditorGUILayout.PropertyField(this.spMetalPrimaryColor);
                    EditorGUILayout.PropertyField(this.spMetalSecondaryColor);
                    EditorGUILayout.PropertyField(this.spMetalDarkColor);
                    EditorGUILayout.PropertyField(this.spHairColor);
                    EditorGUILayout.PropertyField(this.spSkinColor);
                    EditorGUILayout.PropertyField(this.spStubbleColor);
                    EditorGUILayout.PropertyField(this.spScarColor);
                    EditorGUILayout.PropertyField(this.spBodyArtColor);
                    EditorGUILayout.PropertyField(this.spEyeColor);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.EndVertical();
                }
            }

            this.sectionProperties2.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.sectionProperties2.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUILayout.LabelField("Equipment Visuals:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.spTorsoIndex);
                    EditorGUILayout.PropertyField(this.spArmUpperRightIndex);
                    EditorGUILayout.PropertyField(this.spArmUpperLeftIndex);
                    EditorGUILayout.PropertyField(this.spArmLowerRightIndex);
                    EditorGUILayout.PropertyField(this.spArmLowerLeftIndex);
                    EditorGUILayout.PropertyField(this.spHandRightIndex);
                    EditorGUILayout.PropertyField(this.spHandLeftIndex);
                    EditorGUILayout.PropertyField(this.spHipsIndex);
                    EditorGUILayout.PropertyField(this.spLegRightIndex);
                    EditorGUILayout.PropertyField(this.spLegLeftIndex);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.LabelField("Extras:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.spHeadCoveringsBaseHairIndex);
                    EditorGUILayout.PropertyField(this.spHeadCoveringsNoFacialHairIndex);
                    EditorGUILayout.PropertyField(this.spHeadCoveringsNoHairIndex);
                    EditorGUILayout.PropertyField(this.spHairIndex);
                    EditorGUILayout.PropertyField(this.spHelmetIndex);
                    EditorGUILayout.PropertyField(this.spBackAttackmentIndex);
                    EditorGUILayout.PropertyField(this.spShoulderAttachmentRightIndex);
                    EditorGUILayout.PropertyField(this.spShoudlerAttachmentLeftIndex);
                    EditorGUILayout.PropertyField(this.spElbowAttachmendRightIndex);
                    EditorGUILayout.PropertyField(this.spElbowAttachmentLeftIndex);
                    EditorGUILayout.PropertyField(this.spHipsAttachmentIndex);
                    EditorGUILayout.PropertyField(this.spKneeAttachmentRightIndex);
                    EditorGUILayout.PropertyField(this.spKneeAttachmentLeftIndex);
                    EditorGUILayout.PropertyField(this.spElfEarIndex);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.EndVertical();
                }
            }

            this.sectionProperties3.PaintSection();
            using (var group = new EditorGUILayout.FadeGroupScope(this.sectionProperties3.state.faded))
            {
                if (group.visible)
                {
                    EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());

                    EditorGUILayout.HelpBox("Automatically Populated by Drag & Dropping a Prefab in the box below.", MessageType.Info);

                    EditorGUILayout.LabelField("References:", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(this.spMaleHeadAllElements);
                    EditorGUILayout.PropertyField(this.spMaleHeadNoElements);
                    EditorGUILayout.PropertyField(this.spMaleEyebrows);
                    EditorGUILayout.PropertyField(this.spMaleFacialHair);
                    EditorGUILayout.PropertyField(this.spMaleTorso);
                    EditorGUILayout.PropertyField(this.spMaleArmUpperRight);
                    EditorGUILayout.PropertyField(this.spMaleArmUpperLeft);
                    EditorGUILayout.PropertyField(this.spMaleArmLowerRight);
                    EditorGUILayout.PropertyField(this.spMaleArmLowerLeft);
                    EditorGUILayout.PropertyField(this.spMaleHandRight);
                    EditorGUILayout.PropertyField(this.spMaleHandLeft);
                    EditorGUILayout.PropertyField(this.spMaleHips);
                    EditorGUILayout.PropertyField(this.spMaleLegRight);
                    EditorGUILayout.PropertyField(this.spMaleLegLeft);
                    EditorGUILayout.PropertyField(this.spFemaleHeadAllElements);
                    EditorGUILayout.PropertyField(this.spFemaleHeadNoElements);
                    EditorGUILayout.PropertyField(this.spFemaleEyebrows);
                    EditorGUILayout.PropertyField(this.spFemaleFacialHair);
                    EditorGUILayout.PropertyField(this.spFemaleTorso);
                    EditorGUILayout.PropertyField(this.spFemaleArmUpperRight);
                    EditorGUILayout.PropertyField(this.spFemaleArmUpperLeft);
                    EditorGUILayout.PropertyField(this.spFemaleArmLowerRight);
                    EditorGUILayout.PropertyField(this.spFemaleArmLowerLeft);
                    EditorGUILayout.PropertyField(this.spFemaleHandRight);
                    EditorGUILayout.PropertyField(this.spFemaleHandLeft);
                    EditorGUILayout.PropertyField(this.spFemaleHips);
                    EditorGUILayout.PropertyField(this.spFemaleLegRight);
                    EditorGUILayout.PropertyField(this.spFemaleLegLeft);
                    EditorGUILayout.PropertyField(this.spHeadCoveringsBaseHair);
                    EditorGUILayout.PropertyField(this.spHeadCoveringsNoFacialHair);
                    EditorGUILayout.PropertyField(this.spHeadCoveringsNoHair);
                    EditorGUILayout.PropertyField(this.spHair);
                    EditorGUILayout.PropertyField(this.spHelmet);
                    EditorGUILayout.PropertyField(this.spBackAttackment);
                    EditorGUILayout.PropertyField(this.spShoulderAttachmentRight);
                    EditorGUILayout.PropertyField(this.spShoulderAttachmentLeft);
                    EditorGUILayout.PropertyField(this.spElbowAttachmendRight);
                    EditorGUILayout.PropertyField(this.spElbowAttachmentLeft);
                    EditorGUILayout.PropertyField(this.spHipsAttachment);
                    EditorGUILayout.PropertyField(this.spKneeAttachmentRight);
                    EditorGUILayout.PropertyField(this.spKneeAttachmentLeft);
                    EditorGUILayout.PropertyField(this.spElfEar);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.EndVertical();
                }
            }
        }
        public override void OnInspectorGUI()
        {
            so.Update();
            GUILayout.Label(texture, GUILayout.MaxHeight(100), GUILayout.MinHeight(80));

            GUIStyle boldFoldout = new GUIStyle(EditorStyles.foldout);

            boldFoldout.fontStyle    = FontStyle.Bold;
            f_show_TV_mode.boolValue = CustomUI.Foldout("TV mode", f_show_TV_mode.boolValue);
            animFolds[0].target      = f_show_TV_mode.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[0].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    _enableTVmode.boolValue             = EditorGUILayout.BeginToggleGroup("enable TV mode", _enableTVmode.boolValue);
                    _VHSNoise.objectReferenceValue      = EditorGUILayout.ObjectField("Noise Texture", _VHSNoise.objectReferenceValue, typeof(Texture), false);
                    _textureIntensity.floatValue        = EditorGUILayout.Slider("Texture intensity", _textureIntensity.floatValue, 0f, 8f);
                    _offsetColor.floatValue             = EditorGUILayout.Slider("Color offset", _offsetColor.floatValue, 0f, 0.1f);
                    _VerticalOffsetFrequency.floatValue = EditorGUILayout.Slider("Vertical offset frequency", _VerticalOffsetFrequency.floatValue, 0f, 100f);
                    _verticalOffset.floatValue          = EditorGUILayout.Slider("Vertical offset", _verticalOffset.floatValue, 0f, 1f);
                    _OffsetDistortion.floatValue        = EditorGUILayout.Slider("Distortion offset", _OffsetDistortion.floatValue, 3500f, 1f);
                    _scan.boolValue            = EditorGUILayout.Toggle("Scan", _scan.boolValue);
                    _adjustLines.floatValue    = EditorGUILayout.Slider("Lines adjustment", _adjustLines.floatValue, 1f, 10f);
                    _scanLinesColor.colorValue = EditorGUILayout.ColorField("Scan lines color", _scanLinesColor.colorValue);
                    _hardScan.floatValue       = EditorGUILayout.Slider("Hard scan", _hardScan.floatValue, -8f, -16f);
                    _resolution.floatValue     = EditorGUILayout.Slider("Resolution", _resolution.floatValue, 16f, 1f);
                    maskDark.floatValue        = EditorGUILayout.Slider("Mask dark", maskDark.floatValue, 0, 2);
                    maskLight.floatValue       = EditorGUILayout.Slider("Mask light", maskLight.floatValue, 0, 2);
                    warp.vector4Value          = EditorGUILayout.Vector4Field("Warp", warp.vector4Value);
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Space();
            //
            f_show_Old_TV_mode.boolValue = CustomUI.Foldout("Old Film Filter", f_show_Old_TV_mode.boolValue);
            animFolds[11].target         = f_show_Old_TV_mode.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[11].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    o_Enable_Old_TV_effects.boolValue = EditorGUILayout.BeginToggleGroup("Old Film Effect Properties", o_Enable_Old_TV_effects.boolValue);
                    o_burn.floatValue     = EditorGUILayout.Slider("Burn", o_burn.floatValue, -2f, 4f);
                    o_sceneCut.floatValue = EditorGUILayout.Slider("Image Cut", o_sceneCut.floatValue, 0f, 16f);
                    o_contrast.floatValue = EditorGUILayout.Slider("Contrast", o_contrast.floatValue, 0f, 5f);
                    o_FPS.floatValue      = EditorGUILayout.Slider("Frames Per Second", o_FPS.floatValue, 0f, 60f);
                    o_Fade.floatValue     = EditorGUILayout.Slider("Fade", o_Fade.floatValue, 0, 1f);
                    EditorGUILayout.EndToggleGroup();
                    o_Enable_negative_props.boolValue = EditorGUILayout.BeginToggleGroup("Negative Properties", o_Enable_negative_props.boolValue);
                    o_Luminosity.floatValue           = EditorGUILayout.Slider("Luminosity", o_Luminosity.floatValue, 0f, 2f);
                    o_Negative.floatValue             = EditorGUILayout.Slider("Negative", o_Negative.floatValue, 0f, 1f);
                    o_Vignette.floatValue             = EditorGUILayout.Slider("Grey Vignette", o_Vignette.floatValue, 0f, 1f);

                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Space();
            //
            f_show_Bleed.boolValue = CustomUI.Foldout("Bleed Effect", f_show_Bleed.boolValue);
            animFolds[2].target    = f_show_Bleed.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[2].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    b_Bleed.boolValue = EditorGUILayout.BeginToggleGroup("Enable Bleed Effect", b_Bleed.boolValue);
                    indP();
                    b_LinesMode.intValue = EditorGUILayout.Popup("Vertical Resolution", b_LinesMode.intValue,
                                                                 new string[4] {
                        "Full", "240 ", "480 ", "Users"
                    });

                    if (b_LinesMode.intValue == 0)
                    {
                        b_ScreenLinesNum.floatValue = Screen.currentResolution.height;
                    }
                    if (b_LinesMode.intValue == 1)
                    {
                        b_ScreenLinesNum.floatValue = 240;
                    }
                    if (b_LinesMode.intValue == 2)
                    {
                        b_ScreenLinesNum.floatValue = 480;
                    }
                    if (b_LinesMode.intValue == 3)
                    {
                        b_ScreenLinesNum.floatValue = EditorGUILayout.FloatField("Lines Per Height", b_ScreenLinesNum.floatValue);
                    }

                    b_Mode.intValue = EditorGUILayout.Popup("Bleed Mode", b_Mode.intValue,
                                                            new string[4] {
                        "Old Three Phase", "Three Phase", "Two Phase (slow)", "Custom Curve"
                    });

                    if (b_Mode.intValue == 0)
                    {
                        b_BleedLength.intValue = 24;
                    }
                    if (b_Mode.intValue == 1)
                    {
                        b_BleedLength.intValue = 24;
                    }
                    if (b_Mode.intValue == 2)
                    {
                        b_BleedLength.intValue = 32;
                    }
                    if (b_Mode.intValue == 3)
                    {
                        b_BleedCurveSync.boolValue = EditorGUILayout.Toggle("I and Q Sync", b_BleedCurveSync.boolValue);

                        b_BleedCurve1.animationCurveValue = EditorGUILayout.CurveField("Curve Y", b_BleedCurve1.animationCurveValue);
                        if (b_BleedCurveSync.boolValue)
                        {
                            b_BleedCurve2.animationCurveValue = EditorGUILayout.CurveField("Curve I,Q", b_BleedCurve2.animationCurveValue);
                        }
                        else
                        {
                            b_BleedCurve2.animationCurveValue = EditorGUILayout.CurveField("Curve I", b_BleedCurve2.animationCurveValue);
                            b_BleedCurve3.animationCurveValue = EditorGUILayout.CurveField("Curve Q", b_BleedCurve3.animationCurveValue);
                        }

                        b_BleedLength.intValue = (int)EditorGUILayout.Slider("Bleed Length", b_BleedLength.intValue, 0.0f, 50.0f);

                        EditorGUILayout.HelpBox("Note: \n1. Bigger 'Bleed Length' values cause slow performance.", MessageType.Info);
                    }

                    b_BleedAmount.floatValue = EditorGUILayout.Slider("Bleed Stretch", b_BleedAmount.floatValue, 0.0f, 15.0f);
                    indM();
                    b_BleedDebug.boolValue = EditorGUILayout.Toggle("Debug Bleed Curve", b_BleedDebug.boolValue);
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();

            f_show_colorPalette.boolValue = CustomUI.Foldout("Color Palette", f_show_colorPalette.boolValue);
            animFolds[3].target           = f_show_colorPalette.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[3].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    enableColorPalette.boolValue = EditorGUILayout.BeginToggleGroup("Enable Color Palette", enableColorPalette.boolValue);
                    indP();
                    colorPresetIndex.intValue    = EditorGUILayout.Popup("Color Preset", colorPresetIndex.intValue, palettePresets);
                    resolutionModeIndex.intValue = EditorGUILayout.Popup("Resolution Mode", resolutionModeIndex.intValue, new string[2] {
                        "Resolution", "Pixel Size"
                    });
                    switch (resolutionModeIndex.intValue)
                    {
                    case 0:
                        resolution.vector2IntValue = EditorGUILayout.Vector2IntField("Resolution", resolution.vector2IntValue);

                        break;

                    case 1:
                        pixelSize.intValue = EditorGUILayout.IntSlider("Pixel Size", pixelSize.intValue, 1, 256);

                        break;

                    default:
                        break;
                    }
                    dither.floatValue  = EditorGUILayout.Slider("Dithering", dither.floatValue, 0f, 1f);
                    opacity.floatValue = EditorGUILayout.Slider("Opacity", opacity.floatValue, 0f, 1f);
                    indM();
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //

            EditorGUILayout.Space();

            f_show_Fisheye.boolValue = CustomUI.Foldout("Fisheye", f_show_Fisheye.boolValue);
            animFolds[4].target      = f_show_Fisheye.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[4].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    f_Fisheye.boolValue = EditorGUILayout.BeginToggleGroup("Enable Fisheye", f_Fisheye.boolValue);
                    indP();
                    f_FisheyeType.intValue = EditorGUILayout.Popup("Type", f_FisheyeType.intValue,
                                                                   new string[2] {
                        "Default", "Hyperspace"
                    });
                    f_FisheyeBend.floatValue = EditorGUILayout.Slider("Bend", f_FisheyeBend.floatValue, 0.0f, 50.0f);
                    f_CutoffX.floatValue     = EditorGUILayout.Slider("Cutoff X", f_CutoffX.floatValue, 0.0f, 50.0f);
                    f_CutoffY.floatValue     = EditorGUILayout.Slider("Cutoff Y", f_CutoffY.floatValue, 0.0f, 50.0f);
                    f_FadeX.floatValue       = EditorGUILayout.Slider("Cutoff Fade X", f_FadeX.floatValue, 0.0f, 50.0f);
                    f_FadeY.floatValue       = EditorGUILayout.Slider("Cutoff Fade Y", f_FadeY.floatValue, 0.0f, 50.0f);
                    indM();
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            f_show_Vignette.boolValue = CustomUI.Foldout("Vignette", f_show_Vignette.boolValue);
            animFolds[5].target       = f_show_Vignette.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[5].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    v_Vignette.boolValue = EditorGUILayout.BeginToggleGroup("enable Vignette", v_Vignette.boolValue);
                    indP();
                    v_VignetteAmount.floatValue = EditorGUILayout.Slider("Amount", v_VignetteAmount.floatValue, 0.0f, 5.0f);
                    v_VignetteSpeed.floatValue  = EditorGUILayout.Slider("Pulse Speed", v_VignetteSpeed.floatValue, 0.0f, 5.0f);
                    indM();
                    EditorGUILayout.Space();
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            // Bottom Noise
            f_show_Bottom_Noise_mode.boolValue = CustomUI.Foldout("Bottom Noise", f_show_Bottom_Noise_mode.boolValue);
            animFolds[6].target = f_show_Bottom_Noise_mode.boolValue;

            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[6].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    b_BottomNoiseTexture.objectReferenceValue = EditorGUILayout.ObjectField("Bottom Noise Texture", b_BottomNoiseTexture.objectReferenceValue, typeof(Texture2D), false);
                    b_useBottomNoise.boolValue   = EditorGUILayout.Toggle("Enable bottom noise", b_useBottomNoise.boolValue);
                    b_bottomIntensity.floatValue = EditorGUILayout.Slider("Bottom intensity", b_bottomIntensity.floatValue, 0.0f, 3f);
                    b_bottomHeight.floatValue    = EditorGUILayout.Slider("Bottom height", b_bottomHeight.floatValue, 0.0f, 0.5f);
                    b_useBottomStretch.boolValue = EditorGUILayout.Toggle("Enable bottom stretch", b_useBottomStretch.boolValue);
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            //
            f_show_Glitch_Effects.boolValue = CustomUI.Foldout("Glitch Effects", f_show_Glitch_Effects.boolValue);
            animFolds[12].target            = f_show_Glitch_Effects.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[12].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    g_enable_glitch.boolValue = EditorGUILayout.BeginToggleGroup("Enable Glitch 1", g_enable_glitch.boolValue);
                    g_strength.floatValue     = EditorGUILayout.Slider("Strength", g_strength.floatValue, 0f, 2f);
                    g_speed.floatValue        = EditorGUILayout.Slider("Speed", g_speed.floatValue, 0f, 1f);
                    g_fade.floatValue         = EditorGUILayout.Slider("Fade", g_fade.floatValue, 0f, 1f);

                    EditorGUILayout.EndToggleGroup();

                    g_enable_glitch2.boolValue = EditorGUILayout.BeginToggleGroup("Enable Glitch 2", g_enable_glitch2.boolValue);
                    g_2intensity.floatValue    = EditorGUILayout.Slider("Intensity", g_2intensity.floatValue, 0f, 2f);
                    g_2resolution.floatValue   = EditorGUILayout.Slider("Resolution", g_2resolution.floatValue, 1f, 2f);
                    //g_fade.floatValue = EditorGUILayout.Slider("Fade", g_fade.floatValue, 0f, 1f);

                    EditorGUILayout.EndToggleGroup();

                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Space();
            //
            f_show_Noise.boolValue = CustomUI.Foldout("Noise", f_show_Noise.boolValue);
            animFolds[7].target    = f_show_Noise.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[7].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    n_NoiseMode.intValue = EditorGUILayout.Popup("Vertical Resolution", n_NoiseMode.intValue,
                                                                 new string[2] {
                        "Global", "Custom"
                    });
                    if (n_NoiseMode.intValue == 0)
                    {
                        n_NoiseLinesAmountY.floatValue = b_ScreenLinesNum.floatValue;
                    }
                    if (n_NoiseMode.intValue == 1)
                    {
                        indP();
                        n_NoiseLinesAmountY.floatValue = EditorGUILayout.FloatField("Noise Lines Amount Y", n_NoiseLinesAmountY.floatValue);
                        indM();
                    }
                    n_NoiseSignalProcessing.floatValue = EditorGUILayout.Slider("Noise Signal Processing", n_NoiseSignalProcessing.floatValue, 0.0f, 1.0f);
                    EditorGUILayout.Space();

                    f_Granularity.boolValue = EditorGUILayout.Toggle("Granularity", f_Granularity.boolValue);
                    indP();
                    f_GranularityAmount.floatValue = EditorGUILayout.Slider("Granularity Alpha", f_GranularityAmount.floatValue, 0.0f, 0.1f);
                    indM();

                    f_SignalNoise.boolValue = EditorGUILayout.Toggle("Signal Noise", f_SignalNoise.boolValue);
                    indP();
                    f_SignalNoiseAmount.floatValue = EditorGUILayout.Slider("Signal Amount", f_SignalNoiseAmount.floatValue, 0f, 1f);
                    f_SignalNoisePower.floatValue  = EditorGUILayout.Slider("Signal Power", f_SignalNoisePower.floatValue, 0f, 1f);
                    indM();

                    f_LineNoise.boolValue = EditorGUILayout.Toggle("Line Noise", f_LineNoise.boolValue);
                    indP();
                    f_LineNoiseAmount.floatValue = EditorGUILayout.Slider("Alpha", f_LineNoiseAmount.floatValue, 0.0f, 10.0f);
                    f_LineNoiseSpeed.floatValue  = EditorGUILayout.Slider("Speed", f_LineNoiseSpeed.floatValue, 0.0f, 10.0f);
                    indM();
                    f_TapeNoise.boolValue = EditorGUILayout.Toggle("Tape Noise", f_TapeNoise.boolValue);
                    indP();
                    f_TapeNoiseTH.floatValue     = EditorGUILayout.Slider("Tape Amount", f_TapeNoiseTH.floatValue, 0.0f, 1.5f);
                    f_TapeNoiseSpeed.floatValue  = EditorGUILayout.Slider("Tape Speed", f_TapeNoiseSpeed.floatValue, 0.0f, 1.5f);
                    f_TapeNoiseAmount.floatValue = EditorGUILayout.Slider("Tape Alpha", f_TapeNoiseAmount.floatValue, 0.0f, 1.5f);
                    indM();
                    EditorGUILayout.Space();
                    EditorGUI.indentLevel--;
                }
            }
            //
            //Video or image Jitter occurs when the horizontal lines of video image frames are randomly displaced due to the corruption of synchronization signals or electromagnetic interference during video transmission.
            EditorGUILayout.Space();
            f_show_Jitter.boolValue = CustomUI.Foldout("Video Shake Filter", f_show_Jitter.boolValue);
            animFolds[8].target     = f_show_Jitter.boolValue;

            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[8].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    JitterInfo = EditorGUILayout.Foldout(JitterInfo, "info", EditorStyles.foldout);
                    if (JitterInfo)
                    {
                        EditorGUILayout.HelpBox("Video or image shake occurs when the horizontal lines of video image frames are randomly displaced due to the corruption of synchronization signals or electromagnetic interference during video transmission.", MessageType.Info);
                    }
                    j_ScanLines.boolValue = EditorGUILayout.Toggle("Show Lines", j_ScanLines.boolValue);
                    //indP();
                    j_ScanLinesWidth.floatValue = EditorGUILayout.Slider("Lines Width", j_ScanLinesWidth.floatValue, 0.0f, 20.0f);
                    //indM();
                    EditorGUILayout.Space();

                    j_LinesFloat.boolValue = EditorGUILayout.Toggle("Floating Lines", j_LinesFloat.boolValue);
                    //indP();
                    j_LinesSpeed.floatValue = EditorGUILayout.Slider("Lines Speed", j_LinesSpeed.floatValue, -3.0f, 3.0f);
                    //indM();
                    j_Stretch.boolValue = EditorGUILayout.Toggle("Stretch Noise", j_Stretch.boolValue);
                    EditorGUILayout.Space();

                    j_JitterHorizontal.boolValue = EditorGUILayout.Toggle("Horizontal Interlacing", j_JitterHorizontal.boolValue);
                    //indP();
                    j_JitterHorizAmount.floatValue = EditorGUILayout.Slider("Horizontal Amount", j_JitterHorizAmount.floatValue, 0.0f, 5.0f);
                    //indM();
                    j_JitterVertical.boolValue = EditorGUILayout.Toggle("Shake", j_JitterVertical.boolValue);
                    //indP();
                    j_VertAmount.floatValue = EditorGUILayout.Slider("Shake Amount", j_VertAmount.floatValue, 0.0f, 15.0f);
                    j_VertSpeed.floatValue  = EditorGUILayout.Slider("Vertical Shake Speed", j_VertSpeed.floatValue, 0.0f, 5.0f);
                    //indM();
                    EditorGUILayout.Space();

                    j_TwitchHorizontal.boolValue = EditorGUILayout.Toggle("Twitch Horizontal", j_TwitchHorizontal.boolValue);
                    //indP();
                    j_TwitchHorizFreq.floatValue = EditorGUILayout.Slider("Horizontal Frequency", j_TwitchHorizFreq.floatValue, 0.0f, 5.0f);
                    //indM();
                    j_TwitchVertical.boolValue = EditorGUILayout.Toggle("Twitch Vertical", j_TwitchVertical.boolValue);
                    //indP();
                    j_TwitchVertFreq.floatValue = EditorGUILayout.Slider("Vertical Frequency", j_TwitchVertFreq.floatValue, 0.0f, 5.0f);
                    //indM();
                    EditorGUILayout.Space();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            f_show_Signal.boolValue = CustomUI.Foldout("Picture Correction", f_show_Signal.boolValue);
            animFolds[9].target     = f_show_Signal.boolValue;

            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[9].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    p_PictureCorrection.boolValue = EditorGUILayout.BeginToggleGroup("Picture correction enable", p_PictureCorrection.boolValue);
                    indP();
                    p_PictureCorr1.floatValue  = EditorGUILayout.Slider("Shift 1", p_PictureCorr1.floatValue, -0.25f, 0.25f);
                    p_PictureCorr2.floatValue  = EditorGUILayout.Slider("Shift 2", p_PictureCorr2.floatValue, -0.25f, 0.25f);
                    p_PictureCorr3.floatValue  = EditorGUILayout.Slider("Shift 3", p_PictureCorr3.floatValue, -0.25f, 0.25f);
                    p_PictureShift1.floatValue = EditorGUILayout.Slider("Adjust 1", p_PictureShift1.floatValue, -2.0f, 2.0f);
                    p_PictureShift2.floatValue = EditorGUILayout.Slider("Adjust 2", p_PictureShift2.floatValue, -2.0f, 2.0f);
                    p_PictureShift3.floatValue = EditorGUILayout.Slider("Adjust 3", p_PictureShift3.floatValue, -2.0f, 2.0f);

                    p_Gamma.floatValue = EditorGUILayout.Slider("Gamma", p_Gamma.floatValue, 0.0f, 2.0f);
                    indM();
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            f_show_Artefacts.boolValue = CustomUI.Foldout("Artefacts", f_show_Artefacts.boolValue);
            animFolds[10].target       = f_show_Artefacts.boolValue;

            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[10].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    a_Artefacts.boolValue = EditorGUILayout.BeginToggleGroup("Enable Artefacts", a_Artefacts.boolValue);
                    indP();
                    a_ArtefactsThreshold.floatValue  = EditorGUILayout.Slider("Input Cutoff", a_ArtefactsThreshold.floatValue, 0.0f, 1.0f);
                    a_ArtefactsAmount.floatValue     = EditorGUILayout.Slider("Input Amount", a_ArtefactsAmount.floatValue, 0.0f, 3.0f);
                    a_ArtefactsFadeAmount.floatValue = EditorGUILayout.Slider("Fade", a_ArtefactsFadeAmount.floatValue, 0.0f, 1.0f);
                    a_ArtefactsColor.colorValue      = EditorGUILayout.ColorField("Color", a_ArtefactsColor.colorValue);
                    indM();
                    a_ArtefactsDebug.boolValue = EditorGUILayout.Toggle("Render Artefacts only", a_ArtefactsDebug.boolValue);
                    EditorGUILayout.EndToggleGroup();
                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            f_show_Bypass.boolValue = CustomUI.Foldout("Custom Texture", f_show_Bypass.boolValue);
            animFolds[1].target     = f_show_Bypass.boolValue;
            //
            using (var group = new EditorGUILayout.FadeGroupScope(animFolds[1].faded))
            {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    enableCustomTexture.boolValue  = EditorGUILayout.BeginToggleGroup("Enable Custom Texture", enableCustomTexture.boolValue);
                    bypassTex.objectReferenceValue = EditorGUILayout.ObjectField("Bypass Texture", bypassTex.objectReferenceValue, typeof(Texture), false);
                    spriteTex.objectReferenceValue = EditorGUILayout.ObjectField("Sprite Texture", spriteTex.objectReferenceValue, typeof(Sprite), false);
                    EditorGUILayout.Space();
                    EditorGUILayout.EndToggleGroup();
                    EditorGUI.indentLevel--;
                }
            }
            //
            EditorGUILayout.Space();
            independentTimeOn.boolValue = EditorGUILayout.Toggle("Use unscaled time", independentTimeOn.boolValue);

            // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
            so.ApplyModifiedProperties();
        }
Beispiel #22
0
        public override void OnInspectorGUI()
        {
            Game2DWater water2D        = target as Game2DWater;
            bool        hasRefraction  = false;
            bool        hasReflection  = false;
            bool        hasAudioSource = water2D.GetComponent <AudioSource> () != null;

            Material water2DMaterial = water2D.GetComponent <MeshRenderer> ().sharedMaterial;

            if (water2DMaterial)
            {
                hasRefraction = water2DMaterial.IsKeywordEnabled("Water2D_Refraction");
                hasReflection = water2DMaterial.IsKeywordEnabled("Water2D_Reflection");
            }
            if (PrefabUtility.GetPrefabType(target) == PrefabType.Prefab)
            {
                hasRefraction = true;
                hasReflection = true;
            }

            serializedObject.Update();

            if (!isMultiEditing)
            {
                DrawFixScalingField();
            }

            waterPropertiesExpanded.target = EditorGUILayout.Foldout(waterPropertiesExpanded.target, waterPropertiesFoldoutLabel, true);
            using (var group = new EditorGUILayout.FadeGroupScope(waterPropertiesExpanded.faded)) {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.LabelField(meshPropertiesLabel, EditorStyles.boldLabel);
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(waterSize, waterSizeLabel);
                    EditorGUILayout.PropertyField(subdivisionsCountPerUnit, subdivisionsCountPerUnitLabel);

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(wavePropertiesLabel, EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(stiffness, stiffnessLabel);
                    EditorGUILayout.PropertyField(spread, spreadLabel);
                    EditorGUILayout.Slider(damping, 0f, 1f, dampingLabel);
                    EditorGUILayout.PropertyField(useCustomBoundaries, useCustomBoundariesLabel);
                    if (useCustomBoundaries.boolValue)
                    {
                        EditorGUILayout.PropertyField(firstCustomBoundary, firstCustomBoundaryLabel);
                        EditorGUILayout.PropertyField(secondCustomBoundary, secondCustomBoundaryLabel);
                    }

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(disturbancePropertiesLabel, EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(minimumDisturbance, minimumDisturbanceLabel);
                    EditorGUILayout.PropertyField(maximumDisturbance, maximumDisturbanceLabel);
                    EditorGUILayout.PropertyField(velocityMultiplier, velocityMultiplierLabel);

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(collisionPropertiesLabel, EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(collisionMinimumDepth, collisionMinimumDepthLabel);
                    EditorGUILayout.PropertyField(collisionMaximumDepth, collisionMaximumDepthLabel);
                    EditorGUILayout.PropertyField(collisionMask, collisionMaskLabel);

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField(miscLabel, EditorStyles.boldLabel);
                    EditorGUILayout.Slider(buoyancyEffectorSurfaceLevel, 0f, 1f, buoyancyEffectorSurfaceLevelLabel);
                    if (!isMultiEditing)
                    {
                        DrawEdgeColliderPropertyField();
                    }

                    EditorGUI.indentLevel--;
                }
            }

            if (hasRefraction)
            {
                refractionPropertiesExpanded.target = EditorGUILayout.Foldout(refractionPropertiesExpanded.target, refractionPropertiesFoldoutLabel, true);
                using (var group = new EditorGUILayout.FadeGroupScope(refractionPropertiesExpanded.faded)) {
                    if (group.visible)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(refractionCullingMask, cameraCullingMaskLabel);
                        EditorGUILayout.Slider(refractionRenderTextureResizeFactor, 0f, 1f, refractionRenderTextureResizeFactorLabel);
                        EditorGUI.indentLevel--;
                    }
                }
            }

            if (hasReflection)
            {
                reflectionPropertiesExpanded.target = EditorGUILayout.Foldout(reflectionPropertiesExpanded.target, reflectionPropertiesFoldoutLabel, true);
                using (var group = new EditorGUILayout.FadeGroupScope(reflectionPropertiesExpanded.faded)) {
                    if (group.visible)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(reflectionCullingMask, cameraCullingMaskLabel);
                        EditorGUILayout.Slider(reflectionRenderTextureResizeFactor, 0f, 1f, reflectionRenderTextureResizeFactorLabel);
                        EditorGUILayout.PropertyField(reflectionZOffset, reflectionZOffsetLabel);
                        EditorGUI.indentLevel--;
                    }
                }
            }

            renderingSettingsExpanded.target = EditorGUILayout.Foldout(renderingSettingsExpanded.target, renderingSettingsFoldoutLabel, true);
            using (var group = new EditorGUILayout.FadeGroupScope(renderingSettingsExpanded.faded)) {
                if (group.visible)
                {
                    EditorGUI.indentLevel++;
                    if (hasReflection || hasRefraction)
                    {
                        EditorGUILayout.PropertyField(farClipPlane, farClipPlaneLabel);
                        EditorGUILayout.PropertyField(renderPixelLights, renderPixelLightsLabel);
                        EditorGUILayout.PropertyField(allowMSAA, allowMSAALabel);
                        EditorGUILayout.PropertyField(allowHDR, allowHDRLabel);
                    }
                    DrawSortingLayerField(sortingLayerID, sortingOrder);
                    EditorGUI.indentLevel--;
                }
            }

            if (hasAudioSource)
            {
                audioSettingsExpanded.target = EditorGUILayout.Foldout(audioSettingsExpanded.target, audioSettingsFoldoutLabel, true);
                using (var group = new EditorGUILayout.FadeGroupScope(audioSettingsExpanded.faded)) {
                    if (group.visible)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(splashAudioClip, splashAudioClipLabel);
                        EditorGUILayout.Slider(minimumAudioPitch, -3f, 3f, minimumAudioPitchLabel);
                        EditorGUILayout.Slider(maximumAudioPitch, -3f, 3f, maximumAudioPicthLabel);
                        EditorGUILayout.HelpBox(audioPitchMessage, MessageType.None, true);
                        EditorGUI.indentLevel--;
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox(audioSourceMesage, MessageType.None, true);
            }

            if (!hasRefraction)
            {
                EditorGUILayout.HelpBox(refractionMessage, MessageType.None, true);
            }
            if (!hasReflection)
            {
                EditorGUILayout.HelpBox(reflectionMessage, MessageType.None, true);
            }

            serializedObject.ApplyModifiedProperties();
        }
        // INSPECTOR: --------------------------------------------------------------------------------------------------

        public override void OnInspectorGUI()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            serializedObject.Update();
            this.UpdateSubEditors(this.instance.actions);

            int  removeActionIndex    = -1;
            int  duplicateActionIndex = -1;
            int  copyActionIndex      = -1;
            bool forceRepaint         = false;
            bool actionsCollapsed     = true;

            int spActionsSize = this.spActions.arraySize;

            for (int i = 0; i < spActionsSize; ++i)
            {
                bool forceSortRepaint = this.editorSortableList.CaptureSortEvents(this.handleRect[i], i);
                forceRepaint = forceSortRepaint || forceRepaint;

                GUILayout.BeginVertical();
                ItemReturnOperation returnOperation = this.PaintActionHeader(i);
                if (returnOperation.removeIndex)
                {
                    removeActionIndex = i;
                }
                if (returnOperation.copyIndex)
                {
                    copyActionIndex = i;
                }
                if (returnOperation.duplicateIndex)
                {
                    duplicateActionIndex = i;
                }

                actionsCollapsed &= this.isExpanded[i].target;
                using (var group = new EditorGUILayout.FadeGroupScope(this.isExpanded[i].faded))
                {
                    if (group.visible)
                    {
                        EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());
                        if (this.subEditors[i] != null)
                        {
                            this.subEditors[i].OnInspectorGUI();
                        }
                        else
                        {
                            EditorGUILayout.HelpBox(MSG_UNDEF_ACTION_1, MessageType.Warning);
                            EditorGUILayout.HelpBox(MSG_UNDEF_ACTION_2, MessageType.None);
                        }
                        EditorGUILayout.EndVertical();
                    }
                }

                GUILayout.EndVertical();

                if (UnityEngine.Event.current.type == EventType.Repaint)
                {
                    this.objectRect[i] = GUILayoutUtility.GetLastRect();
                }

                this.editorSortableList.PaintDropPoints(this.objectRect[i], i, spActionsSize);
            }

            Rect rectControls   = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());
            Rect rectAddActions = new Rect(
                rectControls.x,
                rectControls.y,
                SelectTypePanel.WINDOW_WIDTH,
                rectControls.height
                );

            Rect rectPaste = new Rect(
                rectAddActions.x + rectAddActions.width,
                rectControls.y,
                25f,
                rectControls.height
                );

            Rect rectPlay = new Rect(
                rectControls.x + rectControls.width - 25f,
                rectControls.y,
                25f,
                rectControls.height
                );

            Rect rectCollapse = new Rect(
                rectPlay.x - 25f,
                rectPlay.y,
                25f,
                rectPlay.height
                );

            Rect rectUnused = new Rect(
                rectPaste.x + rectPaste.width,
                rectControls.y,
                rectControls.width - ((rectPaste.x + rectPaste.width) - rectControls.x) - rectPlay.width - rectCollapse.width,
                rectControls.height
                );

            if (GUI.Button(rectAddActions, "Add Action", CoreGUIStyles.GetToggleButtonLeftAdd()))
            {
                SelectTypePanel selectTypePanel = new SelectTypePanel(this.AddNewAction, "Actions", typeof(IAction));
                PopupWindow.Show(this.addActionsButtonRect, selectTypePanel);
            }

            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                this.addActionsButtonRect = rectAddActions;
            }

            EditorGUI.BeginDisabledGroup(CLIPBOARD_IACTION == null);
            GUIContent gcPaste = InteractionUtilities.Get(InteractionUtilities.Icon.Paste);

            if (GUI.Button(rectPaste, gcPaste, CoreGUIStyles.GetButtonMid()))
            {
                IAction actionInstance = (IAction)this.instance.gameObject.AddComponent(CLIPBOARD_IACTION.GetType());
                EditorUtility.CopySerialized(CLIPBOARD_IACTION, actionInstance);

                this.spActions.AddToObjectArray(actionInstance);
                this.AddSubEditorElement(actionInstance, -1, true);

                DestroyImmediate(CLIPBOARD_IACTION.gameObject, true);
                CLIPBOARD_IACTION = null;
            }
            EditorGUI.EndDisabledGroup();

            GUI.Label(rectUnused, "", CoreGUIStyles.GetToggleButtonMidOn());

            GUIContent gcToggle = (actionsCollapsed
               ? InteractionUtilities.Get(InteractionUtilities.Icon.Collapse)
               : InteractionUtilities.Get(InteractionUtilities.Icon.Expand)
                                   );

            EditorGUI.BeginDisabledGroup(this.instance.actions.Length == 0);
            if (GUI.Button(rectCollapse, gcToggle, CoreGUIStyles.GetButtonMid()))
            {
                for (int i = 0; i < this.subEditors.Length; ++i)
                {
                    this.SetExpand(i, !actionsCollapsed);
                }
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(!EditorApplication.isPlaying);
            GUIContent gcPlay = InteractionUtilities.Get(InteractionUtilities.Icon.Play);

            if (GUI.Button(rectPlay, gcPlay, CoreGUIStyles.GetButtonRight()))
            {
                this.instance.Execute(this.instance.gameObject, () => { return; });
            }
            EditorGUI.EndDisabledGroup();

            if (removeActionIndex >= 0)
            {
                IAction source = (IAction)this.spActions.GetArrayElementAtIndex(removeActionIndex).objectReferenceValue;

                this.spActions.RemoveFromObjectArrayAt(removeActionIndex);
                this.RemoveSubEditorsElement(removeActionIndex);
                DestroyImmediate(source, true);
            }

            if (copyActionIndex >= 0)
            {
                IAction    source    = (IAction)this.subEditors[copyActionIndex].target;
                GameObject clipboard = new GameObject("ActionClipboard")
                {
                    hideFlags = HideFlags.HideAndDontSave
                };

                CLIPBOARD_IACTION = (IAction)clipboard.AddComponent(source.GetType());
                EditorUtility.CopySerialized(source, CLIPBOARD_IACTION);
            }

            if (duplicateActionIndex >= 0)
            {
                int srcIndex = duplicateActionIndex;
                int dstIndex = duplicateActionIndex + 1;

                IAction source = (IAction)this.subEditors[srcIndex].target;
                IAction copy   = (IAction)this.instance.gameObject.AddComponent(source.GetType());

                this.spActions.InsertArrayElementAtIndex(dstIndex);
                this.spActions.GetArrayElementAtIndex(dstIndex).objectReferenceValue = copy;

                EditorUtility.CopySerialized(source, copy);
                this.AddSubEditorElement(copy, dstIndex, true);
            }

            EditorSortableList.SwapIndexes swapIndexes = this.editorSortableList.GetSortIndexes();
            if (swapIndexes != null)
            {
                this.spActions.MoveArrayElement(swapIndexes.src, swapIndexes.dst);
                this.MoveSubEditorsElement(swapIndexes.src, swapIndexes.dst);
            }

            if (EditorApplication.isPlaying)
            {
                forceRepaint = true;
            }
            if (forceRepaint)
            {
                this.Repaint();
            }
            serializedObject.ApplyModifiedProperties();
        }
        // PAINT METHODS: -------------------------------------------------------------------------

        public override void OnInspectorGUI()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }

            serializedObject.Update();
            this.UpdateSubEditors(this.instance.stats);

            int  removeIndex  = -1;
            bool forceRepaint = false;

            int spActionsSize = this.spStats.arraySize;

            for (int i = 0; i < spActionsSize; ++i)
            {
                bool forceSortRepaint = this.editorSortableList.CaptureSortEvents(this.handleRect[i], i);
                forceRepaint = forceSortRepaint || forceRepaint;

                GUILayout.BeginVertical();
                if (this.PaintStatHeader(i))
                {
                    removeIndex = i;
                }

                using (var group = new EditorGUILayout.FadeGroupScope(this.isExpanded[i].faded))
                {
                    if (group.visible)
                    {
                        EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());
                        if (this.subEditors[i] != null)
                        {
                            this.subEditors[i].OnInspectorGUI();
                        }
                        else
                        {
                            EditorGUILayout.HelpBox(MSG_UNDEF_STAT_1, MessageType.Warning);
                            EditorGUILayout.HelpBox(MSG_UNDEF_STAT_2, MessageType.None);
                        }

                        EditorGUILayout.EndVertical();
                    }
                }

                GUILayout.EndVertical();

                if (Event.current.type == EventType.Repaint)
                {
                    this.objectRect[i] = GUILayoutUtility.GetLastRect();
                }

                this.editorSortableList.PaintDropPoints(this.objectRect[i], i, spActionsSize);
            }

            if (GUILayout.Button("Create Stat"))
            {
                StatAsset statAsset = DatabaseStatsEditor.AddStatsAsset();
                int       addIndex  = this.spStats.arraySize;

                this.spStats.InsertArrayElementAtIndex(addIndex);
                this.spStats.GetArrayElementAtIndex(addIndex).objectReferenceValue = statAsset;
                this.AddSubEditorElement(statAsset, addIndex, true);
            }

            if (removeIndex >= 0)
            {
                StatAsset source = (StatAsset)this.spStats.GetArrayElementAtIndex(removeIndex).objectReferenceValue;

                this.spStats.RemoveFromObjectArrayAt(removeIndex);
                this.RemoveSubEditorsElement(removeIndex);
                DestroyImmediate(source, true);
            }

            EditorSortableList.SwapIndexes swapIndexes = this.editorSortableList.GetSortIndexes();
            if (swapIndexes != null)
            {
                this.spStats.MoveArrayElement(swapIndexes.src, swapIndexes.dst);
                this.MoveSubEditorsElement(swapIndexes.src, swapIndexes.dst);
            }

            if (EditorApplication.isPlaying)
            {
                forceRepaint = true;
            }
            if (forceRepaint)
            {
                this.Repaint();
            }

            serializedObject.ApplyModifiedPropertiesWithoutUndo();
        }
Beispiel #25
0
        public override void OnInspectorGUI()
        {
            if ((parentViewElement != null && viewElement != parentViewElement) &&
                (parentViewElementGroup == null && viewElementGroup != parentViewElementGroup))
            {
                EditorGUILayout.HelpBox("ViewElement may not work property while it is a child of other ViewElement, please add ViewElementGroup on the root ViewElement", MessageType.Warning);
            }

            if (parentViewElementGroup || viewElementGroup)
            {
                string msg = viewElementGroup == null ? parentViewElementGroup.name : viewElementGroup.name;
                EditorGUILayout.HelpBox($"This ViewElement is managed by ViewElementGroup {msg}", MessageType.Info);
            }
            using (var change = new EditorGUI.ChangeCheckScope())
            {
                viewElement.transition = (ViewElement.TransitionType)EditorGUILayout.EnumPopup("ViewElement Transition", viewElement.transition);

                switch (viewElement.transition)
                {
                case ViewElement.TransitionType.Animator:
                    viewElement.animatorTransitionType  = (ViewElement.AnimatorTransitionType)EditorGUILayout.EnumPopup("Animator Transition", viewElement.animatorTransitionType);
                    viewElement.AnimationStateName_In   = EditorGUILayout.TextField("Show State Name", viewElement.AnimationStateName_In);
                    viewElement.AnimationStateName_Loop = EditorGUILayout.TextField("Loop State Name", viewElement.AnimationStateName_Loop);
                    viewElement.AnimationStateName_Out  = EditorGUILayout.TextField("Leave State Name", viewElement.AnimationStateName_Out);
                    if (viewElement.animator != null)
                    {
                        EditorGUILayout.HelpBox("Sepup Complete!", MessageType.Info);
                        if (GUILayout.Button("Reset", EditorStyles.miniButton))
                        {
                            viewElement.Setup();
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("There is no available Animator on GameObject or child.", MessageType.Error);
                        if (GUILayout.Button("Reset", EditorStyles.miniButton))
                        {
                            viewElement.Setup();
                        }
                    }
                    break;

                case ViewElement.TransitionType.CanvasGroupAlpha:
                    viewElement.canvasInEase  = (EaseStyle)EditorGUILayout.EnumPopup("Show Curve", viewElement.canvasInEase);
                    viewElement.canvasInTime  = EditorGUILayout.FloatField("Show Curve", viewElement.canvasInTime);
                    viewElement.canvasOutEase = (EaseStyle)EditorGUILayout.EnumPopup("Leave Curve", viewElement.canvasOutEase);
                    viewElement.canvasOutTime = EditorGUILayout.FloatField("Leave Curve", viewElement.canvasOutTime);

                    if (viewElement.canvasGroup == null)
                    {
                        EditorGUILayout.HelpBox("No CanvasGroup found on this GameObject", MessageType.Error);
                        if (GUILayout.Button("Add one", EditorStyles.miniButton))
                        {
                            viewElement.gameObject.AddComponent <CanvasGroup>();
                            EditorUtility.SetDirty(viewElement.gameObject);
                        }
                    }

                    break;

                case ViewElement.TransitionType.ActiveSwitch:
                    break;

                case ViewElement.TransitionType.Custom:
                    EditorGUILayout.HelpBox("Remember Invoke the 'Action' send from those UnityEvent's parameters at the end of your OnShow/OnLeave handler, or the ViewElement may not recovery to pool correctlly!", MessageType.Info);
                    EditorGUILayout.BeginVertical();
                    EditorGUILayout.PropertyField(onShowHandle, true);
                    EditorGUILayout.PropertyField(onLeaveHandle, true);
                    EditorGUILayout.EndVertical();
                    break;
                }

                viewElement.isSkipOutAnimation = EditorGUILayout.Toggle("Skip Out Animation", viewElement.isSkipOutAnimation);

                showV2Setting.target = EditorGUILayout.Foldout(showV2Setting.target, new GUIContent("V2 Setting", "Below scope is only used in V2 Version"));
                string hintText = "";
                using (var fade = new EditorGUILayout.FadeGroupScope(showV2Setting.faded))
                {
                    if (fade.visible)
                    {
                        viewElement.IsUnique = EditorGUILayout.Toggle("Is Unique", viewElement.IsUnique);

                        if (viewElement.IsUnique)
                        {
                            hintText = "Note : Injection will make target component into Singleton, if there is mutil several same component been inject, you will only be able to get the last injection";
                        }
                        else
                        {
                            hintText = "Only Unique ViewElement can be inject";
                        }
                        EditorGUILayout.HelpBox(hintText, MessageType.Info);
                    }
                }
                if (change.changed)
                {
                    EditorUtility.SetDirty(viewElement);
                }
            }
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #26
0
            public override void DrawWindow()
            {
                base.DrawWindow();

                float fadeGroupValue = 1;

                //Draw toggle above when values hiden
                if (showValues == false)
                {
                    if (showValues = GUILayout.Toggle(showValues, "", "fadeToggle2"))
                    {
                        fadeGroupValue = 1;
                    }
                    else
                    {
                        fadeGroupValue = 0.00001f;
                    }
                }

                using (var fadeScope = new EditorGUILayout.FadeGroupScope(fadeGroupValue))
                {
                    //Place holder for overlayWindow (graph) so GUI buttons work in GUILayout
                    GUILayout.Box("", "fieldGroup", GUILayout.Width(overlayWindowRect.width), GUILayout.Height(overlayWindowRect.height));

                    if (Event.current.type == EventType.Repaint)
                    {
                        overlayWindowRect           = GUILayoutUtility.GetLastRect();
                        overlayWindowRect.position += windowRect.position;
                    }

                    using (var horizontalScope = new EditorGUILayout.HorizontalScope("fieldGroup"))
                    {
                        using (var controlPointContainer = new EditorGUILayout.VerticalScope("box"))
                        {
                            GUILayout.Label("ControlPoint", "fieldHeader");

                            using (var pointScope = new EditorGUILayout.HorizontalScope())
                            {
                                GetSelectedPoint();

                                if (selectedPoint != -1)
                                {
                                    //Highlight Selected point
                                    selectionRect = ControlPoints[selectedPoint].Rect;

                                    //Coordinate values
                                    float valueX = ControlPoints[selectedPoint].Coordinate.x;
                                    valueX = EditorGUILayout.FloatField(" ", valueX, "floatField");

                                    float valueY = ControlPoints[selectedPoint].Coordinate.y;
                                    valueY = EditorGUILayout.FloatField(" ", valueY, "floatField");

                                    ControlPoints[selectedPoint].Coordinate = new Vector2(valueX, valueY);

                                    //Refresh on changed value
                                    if (ControlPoints[selectedPoint].Coordinate != outputModule.ControlPoints[selectedPoint])
                                    {
                                        Refresh();
                                    }
                                }
                            }
                        }
                    }

                    //Draw toggle on bottom when values visible
                    if (showValues)
                    {
                        if (showValues = GUILayout.Toggle(showValues, "", "fadeToggle"))
                        {
                            fadeGroupValue = 1;
                        }
                        else
                        {
                            fadeGroupValue = 0.00001f;
                        }
                    }
                }
            }
        public override void OnInspectorGUI()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            settings.Update();

            // Update AnimBool options. For properties changed they will be smoothly interpolated.
            UpdateShowOptions(false);

            settings.DrawLightType();

            EditorGUILayout.Space();

            // When we are switching between two light types that don't show the range (directional and area lights)
            // we want the fade group to stay hidden.
            using (var group = new EditorGUILayout.FadeGroupScope(1.0f - m_AnimDirOptions.faded))
                if (group.visible)
                {
                    settings.DrawRange(m_AnimAreaOptions.target);
                }

            // Spot angle
            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimSpotOptions.faded))
                if (group.visible)
                {
                    DrawSpotAngle();
                }

            // Area width & height
            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimAreaOptions.faded))
                if (group.visible)
                {
                    settings.DrawArea();
                }

            settings.DrawColor();

            EditorGUILayout.Space();

            using (var group = new EditorGUILayout.FadeGroupScope(1.0f - m_AnimAreaOptions.faded))
                if (group.visible)
                {
                    settings.DrawLightmapping();
                }

            settings.DrawIntensity();

            using (var group = new EditorGUILayout.FadeGroupScope(m_AnimLightBounceIntensity.faded))
                if (group.visible)
                {
                    settings.DrawBounceIntensity();
                }

            ShadowsGUI();

            settings.DrawRenderMode();
            settings.DrawCullingMask();

            EditorGUILayout.Space();

#if UNITY_2019_1_OR_NEWER
            var sceneLighting = SceneView.lastActiveSceneView.sceneLighting;
#else
            var sceneLighting = SceneView.lastActiveSceneView.m_SceneLighting;
#endif

            if (SceneView.lastActiveSceneView != null && !sceneLighting)
            {
                EditorGUILayout.HelpBox(s_Styles.DisabledLightWarning.text, MessageType.Warning);
            }

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #28
0
    override public void OnInspectorGUI()
    {
        var brick = target as Brick;

        EditorGUILayout.PrefixLabel("Strenght");
        brick.strength = EditorGUILayout.IntSlider(brick.strength, 0, 20);
        EditorGUILayout.PrefixLabel("Brick Sprites");
        EditorGUI.indentLevel++;
        brick.basicBrick = (Sprite)EditorGUILayout.ObjectField("Basic Brick", brick.basicBrick, typeof(Sprite), true);
        brick.brick11    = (Sprite)EditorGUILayout.ObjectField("Broken Brick 1", brick.brick11, typeof(Sprite), true);
        brick.brick12    = (Sprite)EditorGUILayout.ObjectField("Broken Brick 2", brick.brick12, typeof(Sprite), true);
        brick.brick13    = (Sprite)EditorGUILayout.ObjectField("Broken Brick 3", brick.brick13, typeof(Sprite), true);
        brick.brick14    = (Sprite)EditorGUILayout.ObjectField("Broken Brick 4", brick.brick14, typeof(Sprite), true);
        EditorGUI.indentLevel--;
        brick.particle = (GameObject)EditorGUILayout.ObjectField("Particle Object", brick.particle, typeof(GameObject), true);
        brick.scoring  = EditorGUILayout.Toggle("Scoring", brick.scoring);
        EditorGUILayout.PrefixLabel("Bonus Object");
        EditorGUI.indentLevel++;
        brick.bonuses[0] = (GameObject)EditorGUILayout.ObjectField("Bonus 1", brick.bonuses[0], typeof(GameObject), true);
        brick.bonuses[1] = (GameObject)EditorGUILayout.ObjectField("Bonus 2", brick.bonuses[1], typeof(GameObject), true);
        brick.bonuses[2] = (GameObject)EditorGUILayout.ObjectField("Bonus 3", brick.bonuses[2], typeof(GameObject), true);
        brick.bonuses[3] = (GameObject)EditorGUILayout.ObjectField("Bonus 4", brick.bonuses[3], typeof(GameObject), true);
        brick.bonuses[4] = (GameObject)EditorGUILayout.ObjectField("Bonus 5", brick.bonuses[4], typeof(GameObject), true);
        brick.bonuses[5] = (GameObject)EditorGUILayout.ObjectField("Bonus 6", brick.bonuses[5], typeof(GameObject), true);
        brick.bonuses[6] = (GameObject)EditorGUILayout.ObjectField("Bonus 7", brick.bonuses[6], typeof(GameObject), true);
        brick.bonuses[7] = (GameObject)EditorGUILayout.ObjectField("Bonus 8", brick.bonuses[7], typeof(GameObject), true);
        EditorGUI.indentLevel--;
        brick.moving = EditorGUILayout.Toggle("Moving", brick.moving);

        using (var group = new EditorGUILayout.FadeGroupScope(brick.moving?1f:0f))
        {
            if (group.visible == true)
            {
                EditorGUI.indentLevel++;
                brick.type = (Brick.Mov)EditorGUILayout.EnumPopup("Type:", brick.type);
                EditorGUI.indentLevel++;
                EditorGUILayout.PrefixLabel("Speed");
                brick.movingSpeed = EditorGUILayout.Slider(brick.movingSpeed, -10f, 10f);
                using (var group2 = new EditorGUILayout.FadeGroupScope((int)brick.type == 0 ? 1f : 0f))
                {
                    if (group2.visible == true)
                    {
                        EditorGUILayout.PrefixLabel("Moving Distance");
                        brick.movingDistance = EditorGUILayout.Slider(brick.movingDistance, 0f, 10f);
                        EditorGUILayout.PrefixLabel("Moving Direction");
                        brick.movingDir = EditorGUILayout.Vector2Field("", brick.movingDir);
                    }
                }
                using (var group3 = new EditorGUILayout.FadeGroupScope((int)brick.type == 1 ? 1f : 0f))
                {
                    if (group3.visible == true)
                    {
                        EditorGUILayout.PrefixLabel("Radius");
                        brick.movingRadius = EditorGUILayout.Slider(brick.movingRadius, 0f, 10f);
                        EditorGUILayout.PrefixLabel("Start Angle");
                        brick.movingStartAngle = EditorGUILayout.Slider(brick.movingStartAngle, 0f, 360);
                        brick.rotating         = EditorGUILayout.Toggle("Rotating", brick.rotating);
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
            }
        }
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            if (GUI.changed)
            {
                Debug.Log("Button changed");
            }
            UIEditor.DrawImage("UIButtonLabel");

            GUILayout.BeginVertical("Box");
            GUILayout.Label("UI Button Properties", UIStyle.LabelBold);
            GUILayout.BeginVertical("HelpBox");
            EditorGUI.indentLevel++;
            _openSelectable = EditorGUILayout.Foldout(_openSelectable, new GUIContent("Selectable"), true, UIStyle.FoldoutBoldMini);
            if (_openSelectable)
            {
                base.OnInspectorGUI();
            }
            EditorGUI.indentLevel--;
            GUILayout.EndVertical();

            GUILayout.EndVertical();
            GUILayout.BeginVertical("Box");
            /////////////////////////////////
            GUILayout.BeginHorizontal();
            GUILayout.Label("UI Button Actions", UIStyle.LabelBold);
            if (GUILayout.Button(EditorGUIUtility.IconContent("Toolbar Minus"), "selectionRect"))
            {
                SetAllOpen(false);
            }
            if (GUILayout.Button(EditorGUIUtility.IconContent("Toolbar Plus"), "selectionRect"))
            {
                SetAllOpen(true);
            }

            EditorGUILayout.EndHorizontal();
            ///////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnClick_FieldsOpen.target = GUILayout.Toggle(m_OnClick_FieldsOpen.target, "Actions On Click()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnClickActions_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnClickActions_SerializedObject.isOpen.boolValue = m_OnClick_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnClick_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnClickActions_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnClick_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            ///////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnDoubleClick_FieldsOpen.target = GUILayout.Toggle(m_OnDoubleClick_FieldsOpen.target, "Actions On Double Click()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnDoubleClick_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnDoubleClick_SerializedObject.isOpen.boolValue = m_OnDoubleClick_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnDoubleClick_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnDoubleClick_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnDoubleClick_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            ///////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnLongClick_FieldsOpen.target = GUILayout.Toggle(m_OnLongClick_FieldsOpen.target, "Actions On Long Click()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnLongClick_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnLongClick_SerializedObject.isOpen.boolValue = m_OnLongClick_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnLongClick_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnLongClick_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnLongClick_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            /////////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnPointEnter_FieldsOpen.target = GUILayout.Toggle(m_OnPointEnter_FieldsOpen.target, "Actions On Pointer Enter()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnPointerEnter_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnPointerEnter_SerializedObject.isOpen.boolValue = m_OnPointEnter_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointEnter_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnPointerEnter_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnPointEnter_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            /////////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnPointExit_FieldsOpen.target = GUILayout.Toggle(m_OnPointExit_FieldsOpen.target, "Actions On Pointer Exit()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnPointerExit_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnPointerExit_SerializedObject.isOpen.boolValue = m_OnPointExit_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointExit_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnPointerExit_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnPointExit_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            ///////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnPointDown_FieldsOpen.target = GUILayout.Toggle(m_OnPointDown_FieldsOpen.target, "Actions On Pointer Down()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnPointerDown_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnPointerDown_SerializedObject.isOpen.boolValue = m_OnPointDown_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointDown_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnPointerDown_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnPointDown_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            ///////////////////////////////////
            GUI.backgroundColor = Color.gray;
            GUILayout.BeginVertical("HelpBox");
            GUI.backgroundColor = Color.white;
            EditorGUILayout.BeginHorizontal();
            m_OnPointUp_FieldsOpen.target = GUILayout.Toggle(m_OnPointUp_FieldsOpen.target, "Actions On Pointer Up()", UIStyle.ButtonMini);
            DrawActionMiniIcon(p_OnPointerUp_SerializedObject);
            EditorGUILayout.EndHorizontal();
            p_OnPointerUp_SerializedObject.isOpen.boolValue = m_OnPointUp_FieldsOpen.target;
            using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointUp_FieldsOpen.faded))
            {
                if (group.visible)
                {
                    DrawActionSetup(p_OnPointerUp_SerializedObject);
                }
            }
            GUILayout.EndVertical();
            if (m_OnPointUp_FieldsOpen.target)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            /////////////////////////////////



            GUILayout.EndVertical();
            EditorGUILayout.Space();
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #30
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        var t = target as BezierGenerator;

        _pushURow = EditorGUILayout.Toggle("Push U Row", _pushURow);
        if (_pushURow)
        {
            if (_pushVRow)
            {
                _pushVRow = false;
            }
        }

        _pushVRow = EditorGUILayout.Toggle("Push V Row", _pushVRow);
        if (_pushVRow)
        {
            if (_pushURow)
            {
                _pushURow = false;
            }
        }

        t.resolution = EditorGUILayout.IntSlider("Resolution", t.resolution, 2, 100);

        _showAddVRow.target = EditorGUILayout.ToggleLeft("Show add V row", _showAddVRow.target);
        using (var addVRow = new EditorGUILayout.FadeGroupScope(_showAddVRow.faded))
        {
            if (addVRow.visible)
            {
                _addVAtIndex = EditorGUILayout.IntSlider(_addVAtIndex, 0, t.vOrder + 1);
                if (GUILayout.Button("Add V Row"))
                {
                    CreateVRow(t, _addVAtIndex);
                }
            }
        }

        _showAddURow.target = EditorGUILayout.ToggleLeft("Show add U row", _showAddURow.target);
        using (var addURow = new EditorGUILayout.FadeGroupScope(_showAddURow.faded))
        {
            if (addURow.visible)
            {
                _addUAtIndex = EditorGUILayout.IntSlider(_addUAtIndex, 0, t.uOrder + 1);
                if (GUILayout.Button("Add U Row"))
                {
                    CreateURow(t, _addUAtIndex);
                }
            }
        }

        _showJoinOptions.target = EditorGUILayout.ToggleLeft("Show join options", _showJoinOptions.target);
        using (var joinGroup = new EditorGUILayout.FadeGroupScope(_showJoinOptions.faded))
        {
            if (joinGroup.visible)
            {
                _translateAllVertices = EditorGUILayout.Toggle("Translate all vertices", _translateAllVertices);
                this_JoinType         = (JoinType)EditorGUILayout.EnumPopup("This mesh join side", this_JoinType);
                oth_JoinType          = (JoinType)EditorGUILayout.EnumPopup("Other mesh join side", oth_JoinType);

                EditorGUI.BeginChangeCheck();
                _join = EditorGUILayout.ObjectField("Join to:", _join, typeof(BezierGenerator), true) as BezierGenerator;
                if (EditorGUI.EndChangeCheck())
                {
                    if (IsValidJoin(t, _join, this_JoinType, oth_JoinType))
                    {
                        JoinMeshes(t, _join, this_JoinType, oth_JoinType, _translateAllVertices);
                    }
                    _join = null;
                }
            }
        }
    }