示例#1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            base.BeginProperties(showColor: false);
            EditorGUILayout.PropertyField(propColorMode);

            bool    dEnabled = propAutoSetD.boolValue == false;
            Vector3 dAuto    = (target as Quad).DAuto;

            switch ((Quad.QuadColorMode)propColorMode.enumValueIndex)
            {
            case Quad.QuadColorMode.Single:
                ShapesUI.PosColorField("A", propA, base.propColor);
                ShapesUI.PosColorField("B", propB, base.propColor, false);
                ShapesUI.PosColorField("C", propC, base.propColor, false);
                ShapesUI.PosColorFieldSpecialOffState("D", propD, dAuto, base.propColor, false, dEnabled);
                break;

            case Quad.QuadColorMode.Horizontal:
                ShapesUI.PosColorField("A", propA, base.propColor);
                ShapesUI.PosColorField("B", propB, base.propColor, false);
                ShapesUI.PosColorField("C", propC, propColorC);
                ShapesUI.PosColorFieldSpecialOffState("D", propD, dAuto, propColorC, false, dEnabled);
                break;

            case Quad.QuadColorMode.Vertical:
                ShapesUI.PosColorField("A", propA, propColorD);
                ShapesUI.PosColorField("B", propB, propColorB);
                ShapesUI.PosColorField("C", propC, propColorB, false);
                ShapesUI.PosColorFieldSpecialOffState("D", propD, dAuto, propColorD, false, dEnabled);
                break;

            case Quad.QuadColorMode.PerCorner:
                ShapesUI.PosColorField("A", propA, base.propColor);
                ShapesUI.PosColorField("B", propB, propColorB);
                ShapesUI.PosColorField("C", propC, propColorC);
                ShapesUI.PosColorFieldSpecialOffState("D", propD, dAuto, propColorD, true, dEnabled);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            using (new EditorGUILayout.HorizontalScope()) {
                GUILayout.Label(GUIContent.none, GUILayout.Width(ShapesUI.POS_COLOR_FIELD_LABEL_WIDTH));
                EditorGUILayout.PropertyField(propAutoSetD, GUIContent.none, GUILayout.Width(16));
                GUILayout.Label("Auto-set D");
            }

            base.EndProperties();
        }
        public override void OnInspectorGUI()
        {
            base.BeginProperties(showColor: false);

            EditorGUILayout.PropertyField(propColorMode);
            if (propColorMode.enumValueIndex == (int)Triangle.TriangleColorMode.Single)
            {
                ShapesUI.PosColorField("A", propA, base.propColor);
                ShapesUI.PosColorField("B", propB, base.propColor, false);
                ShapesUI.PosColorField("C", propC, base.propColor, false);
            }
            else
            {
                ShapesUI.PosColorField("A", propA, base.propColor);
                ShapesUI.PosColorField("B", propB, propColorB);
                ShapesUI.PosColorField("C", propC, propColorC);
            }

            base.EndProperties();
        }