示例#1
0
    override public void OnInspectorGUI()
    {
        LightTilemapOcclusion2D script = target as LightTilemapOcclusion2D;

        script.tilemapType = (LightTilemapOcclusion2D.MapType)EditorGUILayout.EnumPopup("Tilemap Type", script.tilemapType);

        script.onlyColliders = EditorGUILayout.Toggle("Only Colliders", script.onlyColliders);

        GUISortingLayer.Draw(script.sortingLayer);

        if (GUILayout.Button("Update"))
        {
            script.Initialize();
        }

        if (GUI.changed)
        {
            script.Initialize();

            if (EditorApplication.isPlaying == false)
            {
                EditorUtility.SetDirty(target);
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            }
        }
    }
示例#2
0
    static void SortingLayer(LightingSettings.SortingLayer sortingLayer)
    {
        EditorGUI.BeginDisabledGroup(Lighting2D.ProjectSettings.renderingMode != RenderingMode.OnRender);

        GUISortingLayer.Draw(sortingLayer);

        EditorGUI.EndDisabledGroup();
    }
示例#3
0
    public static void Draw(SerializedObject serializedObject, MeshMode meshMode)
    {
        bool value = GUIFoldout.Draw("Mesh Mode", meshMode);

        if (value == false)
        {
            return;
        }

        EditorGUI.indentLevel++;

        SerializedProperty meshModeEnable = serializedObject.FindProperty("meshMode.enable");
        SerializedProperty meshModeAlpha  = serializedObject.FindProperty("meshMode.alpha");
        SerializedProperty meshModeShader = serializedObject.FindProperty("meshMode.shader");

        EditorGUILayout.PropertyField(meshModeEnable, new GUIContent("Enable"));

        meshModeAlpha.floatValue = EditorGUILayout.Slider("Alpha", meshModeAlpha.floatValue, 0, 1);

        EditorGUILayout.PropertyField(meshModeShader, new GUIContent("Shader"));

        if (meshModeShader.intValue == (int)MeshModeShader.Custom)
        {
            bool value2 = GUIFoldout.Draw("Materials", meshMode.materials);
            if (value2)
            {
                EditorGUI.indentLevel++;

                int count = meshMode.materials.Length;
                count = EditorGUILayout.IntSlider("Material Count", count, 0, 10);
                if (count != meshMode.materials.Length)
                {
                    System.Array.Resize(ref meshMode.materials, count);
                }

                for (int id = 0; id < meshMode.materials.Length; id++)
                {
                    Material material = meshMode.materials[id];

                    material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), true);

                    meshMode.materials[id] = material;
                }


                EditorGUI.indentLevel--;
            }
        }



        GUISortingLayer.Draw(serializedObject, meshMode.sortingLayer, "meshMode.");



        EditorGUI.indentLevel--;
    }
示例#4
0
    override public void OnInspectorGUI()
    {
        Slicer2DParticlesManager script = target as Slicer2DParticlesManager;

        GUISortingLayer.Draw(script.sortingLayer);

        if (GUI.changed)
        {
            if (EditorApplication.isPlaying == false)
            {
                EditorUtility.SetDirty(script);
            }
        }
    }
        public void EditorVisuals(Slicer2D.Visuals id)
        {
            EditorGUI.indentLevel = EditorGUI.indentLevel + 1;
            id.drawSlicer         = EditorGUILayout.Toggle("Enable Visuals", id.drawSlicer);

            if (id.drawSlicer == true)
            {
                GUISortingLayer.Draw(id.sortingLayer);

                id.zPosition   = EditorGUILayout.FloatField("Slicer Z", id.zPosition);
                id.slicerColor = (Color)EditorGUILayout.ColorField("Slicer Color", id.slicerColor);
                id.visualScale = EditorGUILayout.Slider("Slicer Scale", id.visualScale, 0.5f, 50f);

                id.lineBorder = EditorGUILayout.Toggle("Border", id.lineBorder);

                if (id.lineBorder == true)                   // Disable?
                {
                    id.borderScale = EditorGUILayout.Slider("Border Scale", id.borderScale, 1f, 5f);
                }

                id.lineWidth = EditorGUILayout.Slider("Line Width", id.lineWidth, 0.05f, 5f);

                id.minVertexDistance = EditorGUILayout.Slider("Min Vertex Distance", id.minVertexDistance, 0.05f, 5f);

                id.vertexSpace = EditorGUILayout.Slider("Vertex Space", id.vertexSpace, 0f, 1f);

                id.customMaterial = EditorGUILayout.Toggle("Custom Material", id.customMaterial);

                lineEndFoldout = EditorGUILayout.Foldout(lineEndFoldout, "Line Ending");
                if (lineEndFoldout)
                {
                    EditorGUI.indentLevel = EditorGUI.indentLevel + 2;

                    id.lineEndingType = (Slicer2D.LineEndingType)EditorGUILayout.EnumPopup("Type", id.lineEndingType);
                    if (id.lineEndingType == Slicer2D.LineEndingType.Circle)
                    {
                        id.lineEndingEdgeCount = (int)EditorGUILayout.Slider("Edges", id.lineEndingEdgeCount, 3, 30);
                    }

                    id.lineEndWidth = EditorGUILayout.Slider("Width", id.lineEndWidth, 0.05f, 5f);
                    id.lineEndSize  = EditorGUILayout.Slider("Size", id.lineEndSize, 0.05f, 5f);

                    id.customEndingsImage = EditorGUILayout.Toggle("Custom Image", id.customEndingsImage);

                    if (id.customEndingsImage)
                    {
                        id.customEndingImageMaterial = (Material)EditorGUILayout.ObjectField("Ending Material", id.customEndingImageMaterial, typeof(Material), true);
                    }

                    EditorGUI.indentLevel = EditorGUI.indentLevel - 2;
                }

                if (id.customMaterial)
                {
                    id.customFillMaterial    = (Material)EditorGUILayout.ObjectField("Fill", id.customFillMaterial, typeof(Material), true);
                    id.customBoarderMaterial = (Material)EditorGUILayout.ObjectField("Boarder", id.customBoarderMaterial, typeof(Material), true);
                }

                if (id.lineWidth < 0.01f)
                {
                    id.lineWidth = 0.01f;
                }

                if (id.lineEndSize < 0.05f)
                {
                    id.lineEndSize = 0.05f;
                }

                if (id.minVertexDistance < 0.05f)
                {
                    id.minVertexDistance = 0.05f;
                }
            }

            EditorGUI.indentLevel = EditorGUI.indentLevel - 1;
        }