Exemplo n.º 1
0
        /// <summary>
        /// Draw "Paint Around Existing Tiles" toggle.
        /// </summary>
        /// <remarks>
        /// <para>This method should be called within horizontally flowing layout.</para>
        /// </remarks>
        protected void DrawPaintAroundExistingTilesOption()
        {
            if (!this.SupportsPaintAroundExistingTiles)
            {
                throw new InvalidOperationException("This tool does not support the 'Paint Around Existing Tiles' option. Consider overriding `SupportsPaintAroundExistingTiles`.");
            }

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.RectanglePaintAround, ToolUtility.PaintAroundExistingTiles),
                       TileLang.ParticularText("Property", "Paint Around Existing Tiles")
                       )) {
                Rect position = GUILayoutUtility.GetRect(33, 24);
                ToolUtility.PaintAroundExistingTiles = RotorzEditorGUI.HoverToggle(position, content, ToolUtility.PaintAroundExistingTiles, RotorzEditorStyles.Instance.FlatButtonNoMargin);
            }
        }
        /// <inheritdoc/>
        public override void OnToolOptionsGUI()
        {
            Rect position;

            GUILayout.BeginHorizontal();
            this.DrawStandardOptionsGUI();

            GUILayout.FlexibleSpace();

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.RectangleFill, ToolUtility.FillCenter),
                       TileLang.ParticularText("Property", "Fill Center")
                       )) {
                position = GUILayoutUtility.GetRect(21 + 12, 19 + 5);
                if (RotorzEditorGUI.HoverToggle(position, content, ToolUtility.FillCenter, RotorzEditorStyles.Instance.FlatButtonNoMargin))
                {
                    ToolUtility.FillCenter = true;
                }
            }

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.RectangleOutline, !ToolUtility.FillCenter),
                       TileLang.ParticularText("Property", "Draw Outline")
                       )) {
                position = GUILayoutUtility.GetRect(21 + 12, 19 + 5);
                if (RotorzEditorGUI.HoverToggle(position, content, !ToolUtility.FillCenter, RotorzEditorStyles.Instance.FlatButtonNoMargin))
                {
                    ToolUtility.FillCenter = false;
                }
            }

            RotorzEditorGUI.VerticalSeparatorLight();

            // "Paint Around Existing Tiles"
            this.DrawPaintAroundExistingTilesOption();

            GUILayout.Space(3);

            GUILayout.EndHorizontal();

            ExtraEditorGUI.SeparatorLight();
        }
Exemplo n.º 3
0
        private void DrawDialogButtons()
        {
            if (GUILayout.Button(TileLang.ParticularText("Action", "OK"), ExtraEditorStyles.Instance.BigButton))
            {
                this.OnButtonOK();
            }

            GUILayout.Space(3);

            if (GUILayout.Button(TileLang.ParticularText("Action", "Cancel"), ExtraEditorStyles.Instance.BigButton))
            {
                this.OnButtonCancel();
            }

            if (this.onDefineOrientation2 != null)
            {
                GUILayout.FlexibleSpace();

                Rect togglePosition = GUILayoutUtility.GetRect(0, 34);
                togglePosition.x    += (togglePosition.width - 60) / 2;
                togglePosition.width = 60;

                using (var toggleContent = ControlContent.Basic(
                           image: this.RotationalSymmetry
                        ? RotorzEditorStyles.Skin.ToggleRotationalSymmetryOn
                        : RotorzEditorStyles.Skin.ToggleRotationalSymmetry
                           ,
                           tipText: TileLang.ParticularText("Action", "Toggle Rotational Symmetry")
                           )) {
                    this.RotationalSymmetry = RotorzEditorGUI.HoverToggle(togglePosition, toggleContent, this.RotationalSymmetry, GUI.skin.button);
                }
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(TileLang.ParticularText("Action", "Invert"), ExtraEditorStyles.Instance.BigButton))
            {
                this.OnButtonInvert();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draw standard options GUI using layout engine. This method should be called
        /// within a horizontally flowing layout.
        /// </summary>
        /// <example>
        /// <code language="csharp"><![CDATA[
        /// GUILayout.BeginHorizontal();
        /// {
        ///     DrawStandardOptionsGUI();
        /// }
        /// GUILayout.EndHorizontal();
        /// ]]></code>
        /// </example>
        protected void DrawStandardOptionsGUI()
        {
            Rect position = GUILayoutUtility.GetRect(77, 0);

            position.y -= 3;

            // Draw "Rotation" selector interface.
            EditorGUI.BeginChangeCheck();
            ToolUtility.Rotation = RotorzEditorGUI.RotationSelector(new Rect(position.x + 3, position.y, 39, 36), ToolUtility.Rotation);
            if (EditorGUI.EndChangeCheck())
            {
                SceneView.RepaintAll();
            }

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.Randomize, ToolUtility.RandomizeVariations),
                       TileLang.ParticularText("Property", "Randomize Variations")
                       )) {
                Rect togglePosition = position;
                togglePosition.x     += 3 + 39 + 5;
                togglePosition.y     += 1;
                togglePosition.width  = 32;
                togglePosition.height = 30;

                ToolUtility.RandomizeVariations = RotorzEditorGUI.HoverToggle(togglePosition, content, ToolUtility.RandomizeVariations);
            }

            if (this.EnableVariationShifting)
            {
                EditorGUI.BeginDisabledGroup(this.TemporarilyDisableVariationShifting);
                this.DrawVariationShifter();
                EditorGUI.EndDisabledGroup();
            }

            RotorzEditorGUI.VerticalSeparatorLight();
        }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public override void OnToolOptionsGUI()
        {
            GUILayout.BeginHorizontal();
            {
                this.DrawStandardOptionsGUI();

                GUILayout.FlexibleSpace();

                GUILayout.Space(5);

                EditorGUI.BeginChangeCheck();

                using (var content = ControlContent.Basic(
                           RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.BrushRound, ToolUtility.BrushNozzle == BrushNozzle.Round),
                           TileLang.Text("Round Nozzle")
                           )) {
                    Rect togglePosition = GUILayoutUtility.GetRect(28, 24);
                    if (RotorzEditorGUI.HoverToggle(togglePosition, content, ToolUtility.BrushNozzle == BrushNozzle.Round, RotorzEditorStyles.Instance.SmallFlatButton))
                    {
                        ToolUtility.BrushNozzle = BrushNozzle.Round;
                    }
                }

                using (var content = ControlContent.Basic(
                           RotorzEditorStyles.Skin.GetActive(RotorzEditorStyles.Skin.BrushSquare, ToolUtility.BrushNozzle == BrushNozzle.Square),
                           TileLang.Text("Square Nozzle")
                           )) {
                    Rect togglePosition = GUILayoutUtility.GetRect(28, 24);
                    if (RotorzEditorGUI.HoverToggle(togglePosition, content, ToolUtility.BrushNozzle == BrushNozzle.Square, RotorzEditorStyles.Instance.SmallFlatButton))
                    {
                        ToolUtility.BrushNozzle = BrushNozzle.Square;
                    }
                }

                // Repaint scene views if nozzle index has changed.
                if (EditorGUI.EndChangeCheck())
                {
                    SceneView.RepaintAll();
                }

                if (this.SupportsPaintAroundExistingTiles)
                {
                    RotorzEditorGUI.VerticalSeparatorLight();

                    this.DrawPaintAroundExistingTilesOption();
                }

                GUILayout.Space(3);
            }
            GUILayout.EndHorizontal();

            ExtraEditorGUI.SeparatorLight();

            bool usingNozzleRadius = (ToolUtility.BrushNozzle == BrushNozzle.Round);

            // Repaint scene views if brush radius has changed.
            EditorGUI.BeginChangeCheck();
            if (usingNozzleRadius)
            {
                this.NozzleRadius = EditorGUILayout.IntSlider(TileLang.ParticularText("Property", "Nozzle Radius"), this.NozzleRadius, 1, 10);
            }
            else
            {
                this.NozzleSize = EditorGUILayout.IntSlider(TileLang.ParticularText("Property", "Nozzle Size"), this.NozzleSize, 1, 19);
            }
            if (EditorGUI.EndChangeCheck())
            {
                SceneView.RepaintAll();
            }
        }