Ejemplo n.º 1
0
        public ShapeEditorWindowPopup(PopupMode popupMode, ShapeEditor.Project project, Action <ShapeEditorWindowPopup> onApply) : base()
        {
            this.popupMode = popupMode;

            // read the extrude settings from the project.
            extrudeDepth                 = project.extrudeDepth;
            extrudeClipDepth             = project.extrudeClipDepth;
            extrudeScale                 = project.extrudeScale;
            revolve360                   = project.revolve360;
            revolveSteps                 = project.revolveSteps;
            revolveSpiralSloped          = project.revolveSpiralSloped;
            convexBrushes                = project.convexBrushes;
            GlobalPivotPosition_Position = project.globalPivot.position;

            this.onApply = (self) =>
            {
                // store the extrude settings in the project.
                switch (popupMode)
                {
                case PopupMode.CreatePolygon:
                    project.extrudeScale  = extrudeScale;
                    project.convexBrushes = convexBrushes;
                    break;

                case PopupMode.RevolveShape:
                    project.extrudeScale        = extrudeScale;
                    project.convexBrushes       = convexBrushes;
                    project.revolve360          = revolve360;
                    project.revolveSteps        = revolveSteps;
                    project.revolveSpiralSloped = revolveSpiralSloped;
                    break;

                case PopupMode.ExtrudeShape:
                    project.extrudeScale  = extrudeScale;
                    project.convexBrushes = convexBrushes;
                    project.extrudeDepth  = extrudeDepth;
                    break;

                case PopupMode.ExtrudePoint:
                    project.extrudeScale  = extrudeScale;
                    project.convexBrushes = convexBrushes;
                    project.extrudeDepth  = extrudeDepth;
                    break;

                case PopupMode.ExtrudeBevel:
                    project.extrudeScale     = extrudeScale;
                    project.convexBrushes    = convexBrushes;
                    project.extrudeDepth     = extrudeDepth;
                    project.extrudeClipDepth = extrudeClipDepth;
                    break;
                }

                onApply(self);
                editorWindow.Close();
                EditorWindow.FocusWindowIfItsOpen <ShapeEditor.ShapeEditorWindow>();
            };
        }