コード例 #1
0
        private void OnGUI_BrushSelection()
        {
            if (this.arrowStyle == null)
            {
                this.arrowStyle = new GUIStyle(GUI.skin.label);
                this.arrowStyle.stretchHeight = true;
                this.arrowStyle.alignment     = TextAnchor.MiddleCenter;
            }

            GUILayout.BeginVertical();
            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Source Brush"), RotorzEditorStyles.Instance.BoldLabel);
            {
                this.sourceBrush = RotorzEditorGUI.BrushField(this.sourceBrush);
                EditorGUILayout.Space();
                this.sourceBrush = this.DrawBrushPreviewField(this.sourceBrush);
            }
            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();
            GUILayout.Label("=>", this.arrowStyle);
            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();
            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Replacement Brush"), RotorzEditorStyles.Instance.BoldLabel);
            {
                this.replacementBrush = RotorzEditorGUI.BrushField(this.replacementBrush);
                EditorGUILayout.Space();
                this.replacementBrush = this.DrawBrushPreviewField(this.replacementBrush);
            }
            GUILayout.EndVertical();
        }
コード例 #2
0
        /// <inheritdoc/>
        public override void OnGUI()
        {
            GUILayout.Space(10f);

            this.DrawBrushNameField();

            GUILayout.Space(10f);

            ExtraEditorGUI.AbovePrefixLabel(TileLang.Text("Select target brush to create duplicate from:"));

            var targetBrush = this.Context.GetSharedProperty <Brush>(BrushCreatorSharedPropertyKeys.TargetBrush);

            targetBrush = RotorzEditorGUI.BrushField(targetBrush);
            this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.TargetBrush, targetBrush);
        }
コード例 #3
0
        /// <inheritdoc/>
        public override void OnGUI()
        {
            GUILayout.Label(TileLang.Text("Create new brush that is based upon an existing brush to override properties and materials."), EditorStyles.wordWrappedLabel);
            GUILayout.Space(10f);

            this.DrawBrushNameField();

            GUILayout.Space(10f);

            ExtraEditorGUI.AbovePrefixLabel(TileLang.Text("Select target brush to create an alias of:"));
            var targetBrush = this.Context.GetSharedProperty <Brush>(BrushCreatorSharedPropertyKeys.TargetBrush);

            targetBrush = RotorzEditorGUI.BrushField(targetBrush, false);
            this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.TargetBrush, targetBrush);

            RotorzEditorGUI.MiniFieldDescription(TileLang.Text("Note: You cannot create an alias of another alias brush."));
        }
コード例 #4
0
        /// <inheritdoc/>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var attr = attribute as BrushPropertyAttribute;

            bool initialShowMixedValue = EditorGUI.showMixedValue;

            EditorGUI.showMixedValue = property.hasMultipleDifferentValues;

            EditorGUI.BeginChangeCheck();
            var brush = RotorzEditorGUI.BrushField(
                position,
                label.text,
                property.objectReferenceValue as Brush,
                attr != null ? attr.AllowAlias : true,
                attr != null ? attr.AllowMaster : true
                );

            if (EditorGUI.EndChangeCheck())
            {
                property.objectReferenceValue = brush;
            }

            EditorGUI.showMixedValue = initialShowMixedValue;
        }
コード例 #5
0
        /// <inheritdoc/>
        public override void OnGUI()
        {
            // Permit shortcut key "F3".
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.F3)
            {
                Event.current.Use();
                this.ShowTargetBrushInDesigner();
                GUIUtility.ExitGUI();
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.BeginHorizontal(GUILayout.Width(114));
                {
                    // Draw preview.
                    string tooltipText = !this.isTargetMasterBrush ? TileLang.Text("Double-click to edit target...") : "";
                    using (var content = ControlContent.Basic("", tooltipText)) {
                        GUILayout.Box(content, GUILayout.Width(114), GUILayout.Height(114));
                        Rect previewRect = GUILayoutUtility.GetLastRect();
                        previewRect.x      += 2;
                        previewRect.y      += 2;
                        previewRect.width  -= 4;
                        previewRect.height -= 4;
                        RotorzEditorGUI.DrawBrushPreview(previewRect, this.AliasBrush.target);

                        // Select target brush for editing upon double-clicking
                        Event e = Event.current;
                        if (e.isMouse && e.clickCount == 2 && previewRect.Contains(e.mousePosition) && !this.isTargetMasterBrush)
                        {
                            this.ShowTargetBrushInDesigner();
                            GUIUtility.ExitGUI();
                        }
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(10);

                GUILayout.BeginVertical();
                {
                    GUILayout.Space(15);

                    ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Alias Target:"), RotorzEditorStyles.Instance.BoldLabel);

                    Brush newAliasTarget = RotorzEditorGUI.BrushField(this.AliasBrush.target, false);
                    if (newAliasTarget != this.AliasBrush.target)
                    {
                        this.SetAliasTarget(newAliasTarget);
                    }

                    GUILayout.Space(5);

                    EditorGUI.BeginDisabledGroup(this.AliasBrush.target == null);
                    if (GUILayout.Button(TileLang.ParticularText("Action", "Revert To Target"), RotorzEditorStyles.Instance.ButtonWide))
                    {
                        if (EditorUtility.DisplayDialog(
                                TileLang.ParticularText("Dialog Title", "Confirmation"),
                                TileLang.Text("Revert properties of alias brush to target brush?"),
                                TileLang.ParticularText("Action", "Yes"),
                                TileLang.ParticularText("Action", "No")
                                ))
                        {
                            Undo.RecordObject(this.Brush, TileLang.ParticularText("Action", "Revert To Target"));
                            GUIUtility.keyboardControl = 0;
                            this.AliasBrush.RevertToTarget();
                        }
                        GUIUtility.ExitGUI();
                    }
                    EditorGUI.EndDisabledGroup();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            // Do not display material mapper for 'tileset' targets.
            if (!(this.AliasBrush.target is TilesetBrush))
            {
                this.Section_MaterialMapper();
            }
        }