Exemplo n.º 1
0
    private void DrawLayer(MaterialProperty[] layer, MaterialEditor me, int layerIndex)
    {
        if (CardEditorUtils.DrawHeader("Layer " + layerIndex, "CardMaterialLayer" + layerIndex, false, false))
        {
            for (int i = 1; i < (int)LayerProperty.FLOWMAP; i++)
            {
                DrawProperty(layer[i], me);
            }

            MaterialProperty flowMap      = layer[(int)LayerProperty.FLOWMAP];
            bool             isUseFlowMap = flowMap.floatValue == 1;
            if (flowMap != null)
            {
                EditorGUI.BeginChangeCheck();
                isUseFlowMap = GUILayout.Toggle(isUseFlowMap, new GUIContent(flowMap.displayName));
                if (EditorGUI.EndChangeCheck())
                {
                    flowMap.floatValue = isUseFlowMap ? 1 : 0;
                    me.PropertiesChanged();
                    return;
                }
            }
            if (isUseFlowMap)
            {
                for (int i = (int)LayerProperty.FlowTex; i < (int)LayerProperty.Max; i++)
                {
                    DrawProperty(layer[i], me);
                }
            }
        }
    }
Exemplo n.º 2
0
    void DrawAnimationNode(CardAnimation ca)
    {
        if (CardEditorUtils.DrawHeader(ca.propertyName, ca.propertyName, false, false))
        {
            switch (ca.type)
            {
            case ShaderPropertyType.Color:
                for (int i = 0; i < ca.isDimensionUsed.Length; i++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(30);
                    ca.isDimensionUsed[i] = GUILayout.Toggle(ca.isDimensionUsed[i], GetColorDimensionName(i), GUILayout.Width(30));
                    if (ca.isDimensionUsed[i])
                    {
                        if (ca.curves[i] == null)
                        {
                            ca.curves[i] = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
                        }
                        EditorGUILayout.CurveField(ca.curves[i], GUILayout.Height(28));
                    }
                    GUILayout.EndHorizontal();
                }
                break;

            case ShaderPropertyType.Vector:
                for (int i = 0; i < ca.isDimensionUsed.Length; i++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(30);
                    ca.isDimensionUsed[i] = GUILayout.Toggle(ca.isDimensionUsed[i], GetVectorDimensionName(i), GUILayout.Width(30));
                    if (ca.isDimensionUsed[i])
                    {
                        if (ca.curves[i] == null)
                        {
                            ca.curves[i] = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
                        }
                        EditorGUILayout.CurveField(ca.curves[i], GUILayout.Height(28));
                    }
                    GUILayout.EndHorizontal();
                }
                break;

            case ShaderPropertyType.Float:
                GUILayout.BeginHorizontal();
                GUILayout.Space(30);
                ca.isDimensionUsed[0] = true;     // GUILayout.Toggle(ca.isDimensionUsed[0], GetVectorDimensionName(i), GUILayout.Width(30));
                //if (ca.isDimensionUsed[i])
                {
                    if (ca.curves[0] == null)
                    {
                        ca.curves[0] = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
                    }
                    EditorGUILayout.CurveField(ca.curves[0], GUILayout.Height(28));
                }
                GUILayout.EndHorizontal();
                break;

            case ShaderPropertyType.Range:
                break;

            case ShaderPropertyType.Texture:
                break;

            default:
                break;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("LoopType:");
            ca.loopType = (CardAnimation.LoopType)EditorGUILayout.EnumPopup(ca.loopType);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            if (GUILayout.Button("delete", GUILayout.Width(60)))
            {
                if (!needRemove.Contains(ca))
                {
                    needRemove.Add(ca);
                }
            }
            GUILayout.EndHorizontal();
        }
    }