internal static void DeleteBrush(Brush brush, bool selectParentTileset)
        {
            var brushRecord = BrushDatabase.Instance.FindRecord(brush);

            if (brushRecord == null)
            {
                return;
            }

            RotorzEditorGUI.ClearControlFocus();

            if (EditorUtility.DisplayDialog(
                    TileLang.ParticularText("Action", "Delete Brush"),
                    string.Format(
                        /* 0: name of brush */
                        TileLang.Text("Deleting a brush that has been previously used in a tile system may cause damage to that tile system.\n\n'{0}'\n\nDo you really want to delete this brush?"),
                        brushRecord.DisplayName
                        ),
                    TileLang.ParticularText("Action", "Yes"),
                    TileLang.ParticularText("Action", "No")
                    ))
            {
                // Determine whether tileset should be selected in designer.
                var designerWindow = RotorzWindow.GetInstance <DesignerWindow>();
                if (designerWindow != null && ReferenceEquals(brushRecord.Brush, designerWindow.SelectedObject))
                {
                    designerWindow.SelectedObject = selectParentTileset && brushRecord.Brush is TilesetBrush
                        ? (brushRecord.Brush as TilesetBrush).Tileset
                        : null;
                }

                BrushUtility.DeleteBrush(brushRecord.Brush);
            }
        }
        public virtual void GatherInputsFromCurrent()
        {
            this.tileset = this.tilesetRecord.Tileset;

            this.inputAtlasTexture = this.tileset.AtlasTexture;
            this.inputTileWidth    = this.tileset.TileWidth;
            this.inputTileHeight   = this.tileset.TileHeight;

            this.inputBorderSize = this.tileset.BorderSize;
            this.inputDelta      = this.tileset.Delta;

            if (this.inputBorderSize == 0 && this.inputDelta == 0f)
            {
                this.inputEdgeCorrectionPreset = EdgeCorrectionPreset.DoNothing;
            }
            else if (this.inputBorderSize == 0 && this.inputDelta == 0.5f)
            {
                this.inputEdgeCorrectionPreset = EdgeCorrectionPreset.InsetUVs;
            }
            else
            {
                this.inputEdgeCorrectionPreset = EdgeCorrectionPreset.Custom;
            }

            this.inputProcedural = this.tileset.procedural;

            RotorzEditorGUI.ClearControlFocus();
        }
        /// <inheritdoc/>
        protected override void DoGUI()
        {
            s_SelectedTab = Mathf.Clamp(RotorzEditorGUI.TabSelector(s_SelectedTab, this.tabContent), 0, this.tabs.Count - 1);

            GUILayout.Space(4);

            GUILayout.Label(this.tabs[s_SelectedTab].Description, EditorStyles.wordWrappedLabel);

            GUILayout.Space(5);

            EditorGUIUtility.labelWidth = 70;
            GUILayout.BeginHorizontal();

            this.DrawFlagFields(0, 7);
            GUILayout.Space(5);
            this.DrawFlagFields(8, 15);

            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            ExtraEditorGUI.Separator(marginTop: 0);

            this.OnGUI_Buttons();
            GUILayout.Space(5);
        }
        /// <inheritdoc/>
        protected override void DoGUI()
        {
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();

            GUILayout.Space(69);
            GUI.DrawTexture(new Rect(10, 10, 59, 52), RotorzEditorStyles.Skin.Caution);

            GUILayout.BeginVertical(this.paddedAreaStyle);
            {
                GUILayout.BeginVertical();
                {
                    RotorzEditorGUI.Title(TileLang.ParticularText("Action", "Cleanup Non-Procedural Meshes"));
                    GUILayout.Space(5);
                    GUILayout.Label(this.headingText, RotorzEditorStyles.Instance.BoldLabel);
                    GUILayout.Space(7);
                    GUILayout.Label(TileLang.Text("Mesh assets are generated for non-procedural tileset brushes and often not needed after brushes are deleted.\n\nMeshes not referenced by at least one tileset brush can be removed. Mesh will be missing for previously painted tiles."), EditorStyles.wordWrappedLabel);
                    GUILayout.Space(5);
                }
                GUILayout.EndVertical();

                GUILayout.FlexibleSpace();
            }
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            this.OnGUI_ButtonStrip();
        }
        /// <inheritdoc/>
        protected override void DoGUI()
        {
            this.hasDrawnGUI = true;

            if (this.tileSystem == null)
            {
                return;
            }

            GUISkin skin = GUI.skin;

            GUILayout.Space(15f);

            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Prefab Output Path:"));
            GUILayout.BeginHorizontal();
            {
                this.PrefabOutputPath = RotorzEditorGUI.RelativeAssetPathTextField(GUIContent.none, this.PrefabOutputPath, ".prefab");
                if (GUILayout.Button("...", GUILayout.Width(40)))
                {
                    GUIUtility.keyboardControl = 0;
                    this.PrefabOutputPath      = this.DoSelectPrefabPath(
                        TileLang.ParticularText("Action", "Save Prefab Output"),
                        TileLang.Text("Specify path for prefab output"),
                        this.PrefabOutputPath
                        );
                }
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Data Output Path:"));
            GUILayout.BeginHorizontal();
            {
                this.DataOutputPath = RotorzEditorGUI.RelativeAssetPathTextField(GUIContent.none, this.DataOutputPath, ".asset");
                if (GUILayout.Button("...", GUILayout.Width(40)))
                {
                    GUIUtility.keyboardControl = 0;
                    this.DataOutputPath        = this.DoSelectAssetPath(
                        TileLang.ParticularText("Action", "Save Data Output"),
                        TileLang.Text("Specify path for mesh output"),
                        this.DataOutputPath
                        );
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();
            ExtraEditorGUI.Separator(marginBottom: 10);

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                this.OnGUI_Buttons();
                GUILayout.Space(5f);
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(8f);
        }
        private void DrawTilePreviewSection()
        {
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            RotorzEditorGUI.Title(TileLang.Text("Tile Previews"));

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(TileLang.ParticularText("Action", "Refresh Previews"), RotorzEditorStyles.Instance.ButtonWide))
            {
                this.OnRefreshPreviews();
                GUIUtility.ExitGUI();
            }

            GUILayout.Space(5);
            GUILayout.EndHorizontal();
            ExtraEditorGUI.SeparatorLight();
            GUILayout.Space(-5);

            GUILayout.BeginVertical(RotorzEditorStyles.Instance.PaddedScrollView);
            this.DrawTilePreviews();
            GUILayout.EndVertical();

            GUILayout.Space(-10);
        }
Esempio n. 7
0
        /// <inheritdoc/>
        protected internal override bool DrawPreview(Rect output, BrushAssetRecord record, bool selected)
        {
            var brush = record.Brush as OrientedBrush;

            if (brush == null)
            {
                return(false);
            }

            var orientation = brush.FindClosestOrientation(0);

            if (orientation == null || orientation.VariationCount == 0)
            {
                return(false);
            }

            var firstVariation = orientation.GetVariation(0);

            var nestedRecord = BrushDatabase.Instance.FindRecord(firstVariation as Brush);

            if (nestedRecord == null)
            {
                return(false);
            }

            // Use preview from nested brush.
            return(RotorzEditorGUI.DrawBrushPreviewHelper(output, nestedRecord, selected));
        }
        public override void OnInspectorGUI()
        {
            bool  initialWideMode   = EditorGUIUtility.wideMode;
            float initialLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.wideMode = true;
            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            this.serializedObject.Update();

            this.propertyExpandTilesetCreatorSection.boolValue = RotorzEditorGUI.FoldoutSection(
                foldout: this.propertyExpandTilesetCreatorSection.boolValue,
                label: TileLang.Text("Brush and Tileset Creator"),
                callback: this.DrawCreatorSection,
                paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                );

            this.propertyExpandBrushCategoriesSection.boolValue = RotorzEditorGUI.FoldoutSection(
                foldout: this.propertyExpandBrushCategoriesSection.boolValue,
                label: TileLang.Text("Brush Categories"),
                callback: this.DrawCategoriesSections,
                paddedStyle: RotorzEditorStyles.Instance.InspectorSectionPadded
                );

            EditorGUIUtility.wideMode   = initialWideMode;
            EditorGUIUtility.labelWidth = initialLabelWidth;

            this.serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// Draw selection history navigation buttons in fixed position of designer window.
        /// </summary>
        private void DrawHistoryButtons()
        {
            Rect backButtonPosition    = new Rect(2, 4, 28, 21);
            Rect forwardButtonPosition = new Rect(backButtonPosition.xMax + 1, backButtonPosition.y, 28, 21);

            this._recentHistoryButtonPosition = new Rect(forwardButtonPosition.xMax + 1, backButtonPosition.y, 27, 21);

            EditorGUI.BeginDisabledGroup(!this.History.CanGoBack);
            if (RotorzEditorGUI.HoverButton(backButtonPosition, s_content_HistoryBackButton, RotorzEditorStyles.Instance.HistoryNavButton))
            {
                this.History.GoBack();
                GUIUtility.ExitGUI();
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(!this.History.CanGoForward);
            if (RotorzEditorGUI.HoverButton(forwardButtonPosition, s_content_HistoryForwardButton, RotorzEditorStyles.Instance.HistoryNavButton))
            {
                this.History.GoForward();
                GUIUtility.ExitGUI();
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(this.History.Recent.Count == 0);
            if (EditorInternalUtility.DropdownMenu(this._recentHistoryButtonPosition, s_content_HistoryRecentButton, RotorzEditorStyles.Instance.HistoryNavButton))
            {
                this.ShowRecentHistoryMenu();
            }
            EditorGUI.EndDisabledGroup();
        }
        private void DrawSelectedTab()
        {
            RotorzEditorGUI.UseExtendedLabelWidthForLocalization();

            GUILayout.Space(10);

            RotorzEditorGUI.Title(this.tabs[this.selectedTabIndex]);

            GUILayout.Space(10);

            switch (this.selectedTabIndex)
            {
            case 0:
                this.DrawToolsTab();
                break;

            case 1:
                this.DrawPaintingTab();
                break;

            case 2:
                this.DrawGridTab();
                break;

            case 3:
                this.DrawMiscTab();
                break;
            }
        }
Esempio n. 11
0
    void OnGUI_Welcome()
    {
        RotorzEditorGUI.Title("Step 1: Welcome");

        GUILayout.Label(_welcomeMessage, _boldWrapStyle);
        GUILayout.Space(5);
        GUILayout.Label("The latest update includes a number of new features including new and improved brushes.", EditorStyles.wordWrappedLabel);
        GUILayout.Space(5);
        GUILayout.Label("Existing brushes and tile systems can be upgraded for use with the newer version of this extension. Alternatively you are welcome to use both the newer and older versions of this extension side by side.", EditorStyles.wordWrappedLabel);

        GUILayout.Space(10);
        EditorGUILayout.HelpBox("Backup all of your files before proceeding. Upgraded brushes may differ from original brushes.", MessageType.Warning, true);
        GUILayout.Space(10);

        GUILayout.BeginHorizontal();

        if (File.Exists(Directory.GetCurrentDirectory() + "/Assets/Rotorz/Tile System/Support/Migration Guide from 1x.pdf"))
        {
            if (GUILayout.Button("Migration Guide...", GUILayout.Height(24)))
            {
                EditorUtility.OpenWithDefaultApp("Assets/Rotorz/Tile System/Support/Migration Guide from 1x.pdf");
                GUIUtility.ExitGUI();
            }

            GUILayout.Space(5);
        }

        if (GUILayout.Button("Proceed to Next Step", GUILayout.Height(24)))
        {
            _hasWelcomed = true;
            GUIUtility.ExitGUI();
        }

        GUILayout.EndHorizontal();
    }
        /// <inheritdoc/>
        protected override void DoGUI()
        {
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            {
                this.selectedTabIndex = RotorzEditorGUI.VerticalTabSelector(this.selectedTabIndex, this.tabs, GUILayout.Width(108), GUILayout.Height(Screen.height - 45));
                this.scrolling[this.selectedTabIndex] = GUILayout.BeginScrollView(this.scrolling[this.selectedTabIndex]);
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(10);
                    GUILayout.BeginVertical();
                    this.DrawSelectedTab();
                    GUILayout.EndVertical();
                    GUILayout.Space(10);
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndHorizontal();

            this.DrawButtonStrip();

            GUILayout.EndVertical();

            RotorzEditorGUI.DrawHoverTip(this);

            // Refresh all scene views?
            if (GUI.changed)
            {
                SceneView.RepaintAll();
            }
        }
Esempio n. 13
0
        private Brush DrawBrushPreviewField(Brush brush)
        {
            Rect position = GUILayoutUtility.GetRect(144, 144, 144, 144);

            int   controlID = GUIUtility.GetControlID(FocusType.Passive);
            Event e         = Event.current;

            Brush draggedBrush = DragAndDrop.objectReferences.Length > 0
                ? DragAndDrop.objectReferences[0] as Brush
                : null;

            switch (e.GetTypeForControl(controlID))
            {
            case EventType.Repaint:
                Color restore = GUI.backgroundColor;
                if (DragAndDrop.activeControlID == controlID)
                {
                    GUI.backgroundColor = new Color32(61, 128, 223, 255);
                }

                RotorzEditorStyles.Instance.TransparentBox.Draw(position, GUIContent.none, false, false, false, false);
                GUI.backgroundColor = restore;

                position.x      += 2;
                position.y      += 2;
                position.width  -= 4;
                position.height -= 4;
                RotorzEditorGUI.DrawBrushPreview(position, brush);
                break;

            case EventType.DragUpdated:
                if (draggedBrush != null && position.Contains(e.mousePosition))
                {
                    DragAndDrop.visualMode      = DragAndDropVisualMode.Link;
                    DragAndDrop.activeControlID = controlID;
                    GUIUtility.hotControl       = 0;
                    this.Repaint();
                    e.Use();
                }
                break;

            case EventType.DragExited:
                this.Repaint();
                break;

            case EventType.DragPerform:
                if (draggedBrush != null && position.Contains(e.mousePosition))
                {
                    brush = draggedBrush;

                    DragAndDrop.AcceptDrag();
                    GUIUtility.hotControl = 0;

                    e.Use();
                }
                break;
            }

            return(brush);
        }
Esempio n. 14
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();
        }
Esempio n. 15
0
        /// <inheritdoc/>
        protected override void DoGUI()
        {
            GUILayout.Space(10);

            GUILayout.BeginVertical(this.paddedArea1Style);
            RotorzEditorGUI.Title(TileLang.ParticularText("Action", "Refresh Tiles"));
            GUILayout.Space(5);
            GUILayout.Label(TileLang.Text("Tiles are replaced if obvious changes are detected. You can force refresh all tiles if necessary."), EditorStyles.wordWrappedLabel);

            ExtraEditorGUI.SeparatorLight(marginTop: 5, marginBottom: 5, thickness: 3);

            GUILayout.BeginVertical(this.paddedArea2Style);
            s_ForceRefreshTiles = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Force refresh all tiles"), s_ForceRefreshTiles);

            GUILayout.Space(2);
            EditorGUI.indentLevel += 2;
            if (!s_ForceRefreshTiles)
            {
                s_UpdateProcedural = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Update procedural tiles"), s_UpdateProcedural);
            }
            else
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Update procedural tiles"), true);
                EditorGUI.EndDisabledGroup();
            }
            EditorGUI.indentLevel -= 2;
            GUILayout.Space(2);
            s_PreserveManualOffset = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Preserve manual offsets"), s_PreserveManualOffset);
            GUILayout.Space(2);
            s_PreserveFlags = EditorGUILayout.ToggleLeft(TileLang.ParticularText("Property", "Preserve painted user flags"), s_PreserveFlags);
            GUILayout.EndVertical();
            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();

            EditorGUILayout.HelpBox(TileLang.Text("Some manual changes may be lost when refreshing tiles."), MessageType.Warning, true);

            GUILayout.Space(8);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(TileLang.ParticularText("Action", "Refresh"), ExtraEditorStyles.Instance.BigButtonPadded))
            {
                this.OnButtonRefresh();
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(3);
            if (GUILayout.Button(TileLang.ParticularText("Action", "Cancel"), ExtraEditorStyles.Instance.BigButtonPadded))
            {
                this.Close();
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(8);
        }
        private void DrawPrimarySecondaryBrushSwitcher()
        {
            Rect r;

            GUILayout.Space(5);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.Label(RotorzEditorStyles.Skin.MouseLeft);
            GUILayout.Box(GUIContent.none, RotorzEditorStyles.Instance.SelectedBrushPreviewBox);

            r = GUILayoutUtility.GetLastRect();
            if (ToolUtility.SelectedBrush != null)
            {
                RotorzEditorGUI.DrawBrushPreview(new Rect(r.x + 2, r.y + 2, r.width - 4, r.height - 4), ToolUtility.SelectedBrush);
            }
            else
            {
                GUI.Label(r, TileLang.ParticularText("Action", "Erase"), RotorzEditorStyles.Instance.MiniCenteredLabel);
            }

            GUILayout.Space(10);

            GUILayout.Label(RotorzEditorStyles.Skin.MouseRight);
            GUILayout.Box(GUIContent.none, RotorzEditorStyles.Instance.SelectedBrushPreviewBox);
            r = GUILayoutUtility.GetLastRect();
            if (ToolUtility.SelectedBrushSecondary != null)
            {
                RotorzEditorGUI.DrawBrushPreview(new Rect(r.x + 2, r.y + 2, r.width - 4, r.height - 4), ToolUtility.SelectedBrushSecondary);
            }
            else
            {
                GUI.Label(r, TileLang.ParticularText("Action", "Erase"), RotorzEditorStyles.Instance.MiniCenteredLabel);
            }

            GUILayout.Space(5);

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.SwitchPrimarySecondary,
                       TileLang.ParticularText("Action", "Switch primary and secondary brushes (X)")
                       )) {
                if (RotorzEditorGUI.HoverButton(content, GUILayout.Height(42)))
                {
                    Brush t = ToolUtility.SelectedBrush;
                    ToolUtility.SelectedBrush          = ToolUtility.SelectedBrushSecondary;
                    ToolUtility.SelectedBrushSecondary = t;

                    GUIUtility.ExitGUI();
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
        /// <inheritdoc/>
        protected internal override void EndExtendedProperties()
        {
            ShowExtendedOrientation = RotorzEditorGUI.FoldoutSection(ShowExtendedOrientation,
                                                                     label: TileLang.Text("Automatic Orientations"),
                                                                     callback: this.OnExtendedGUI_Coalescing
                                                                     );

            base.EndExtendedProperties();
        }
Esempio n. 18
0
        /// <summary>
        /// Draws the "Brush Name" input field.
        /// </summary>
        /// <remarks>
        /// <para>User input is a shared property that is stored under the key
        /// <see cref="BrushCreatorSharedPropertyKeys.BrushName"/>.</para>
        /// </remarks>
        protected void DrawBrushNameField()
        {
            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Name:"));
            GUI.SetNextControlName(this.Context.PrimaryAssetNameControlName);

            string brushName = this.Context.GetSharedProperty(BrushCreatorSharedPropertyKeys.BrushName, "");

            brushName = EditorGUILayout.TextField(brushName).Trim();
            this.Context.SetSharedProperty(BrushCreatorSharedPropertyKeys.BrushName, brushName);

            RotorzEditorGUI.MiniFieldDescription(TileLang.Text("Must start with alphanumeric character (A-Z a-z 0-9) and can contain hyphens (-), underscores (_) and spaces."));
        }
Esempio n. 19
0
    void OnGUI_UpgradeBrushes()
    {
        RotorzEditorGUI.Title("Step 2: Upgrade Brushes");

        if (RtsBrushDatabaseWrapper.Instance.records.Count == 0)
        {
            OnGUI_UpgradeNoBrushes();
            return;
        }

        if (_brushUpgrader == null)
        {
            _brushUpgrader = new RtsBrushUpgradeUtility();
        }

        GUILayout.Label("Existing brushes will not be removed automatically.", _boldWrapStyle);
        GUILayout.Space(5);
        GUILayout.Label("An asset will be generated that maps existing brushes to their upgraded counterparts which is used when upgrading tile systems. If map asset is deleted this wizard restart.", EditorStyles.wordWrappedLabel);
        GUILayout.Space(5);
        EditorGUILayout.HelpBox("Do not remove older version of extension nor existing brushes folder 'Assets/TilePrefabs' until you have upgraded all of your tile systems.", MessageType.Warning, true);

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();
        GUILayout.Space(15);
        GUILayout.BeginVertical();
        _brushUpgrader.useProceduralTilesets = GUILayout.Toggle(_brushUpgrader.useProceduralTilesets, "Use procedural tilesets / atlas brushes");
        _brushUpgrader.useNewAssets          = GUILayout.Toggle(_brushUpgrader.useNewAssets, "Use newer smooth platform brushes.");
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(5);
        GUILayout.Label("Please click 'Upgrade Brushes' to proceed.", EditorStyles.wordWrappedLabel);

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Go Back", GUILayout.Height(24)))
        {
            _hasWelcomed = false;
            GUIUtility.ExitGUI();
        }

        if (GUILayout.Button("Upgrade Brushes", GUILayout.Height(24)))
        {
            _brushUpgrader.UpgradeBrushes();

            ToolUtility.RepaintPaletteWindows();
            GUIUtility.ExitGUI();
        }

        GUILayout.EndHorizontal();
    }
        /// <inheritdoc/>
        protected internal override void EndExtendedProperties()
        {
            if (this.AliasBrush.target is OrientedBrush)
            {
                OrientedBrushDesigner.ShowExtendedOrientation = RotorzEditorGUI.FoldoutSection(OrientedBrushDesigner.ShowExtendedOrientation,
                                                                                               label: TileLang.Text("Automatic Orientations"),
                                                                                               callback: this.OnExtendedGUI_Coalescing
                                                                                               );
            }

            base.EndExtendedProperties();
        }
        private bool ToolButton(GUIContent content, bool on = false)
        {
            Rect position = GUILayoutUtility.GetRect(content, s_ToolButtonStyle);

            int controlID = RotorzEditorGUI.GetHoverControlID(position, content.image != null ? content.text : null);

            switch (Event.current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (Event.current.button == 0 && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.hotControl = controlID;
                    Event.current.Use();
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    GUIUtility.hotControl = 0;
                    Event.current.Use();
                    return(position.Contains(Event.current.mousePosition));
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    Event.current.Use();
                }
                break;

            case EventType.Repaint:
                if (content.image != null)
                {
                    using (var tempContent = ControlContent.Basic(content.image)) {
                        s_ToolButtonStyle.Draw(position, tempContent, controlID, on);
                    }
                }
                else
                {
                    using (var tempContent = ControlContent.Basic(content.text)) {
                        s_ToolButtonStyle.Draw(position, tempContent, controlID, on);
                    }
                }
                break;
            }

            return(false);
        }
        private void OnGUI_Title()
        {
            GUILayout.BeginVertical();
            {
                RotorzEditorGUI.Title(TileLang.ParticularText("Action", "Delete Tileset"));
                GUILayout.Space(5);
                GUILayout.Label(this.headingText, RotorzEditorStyles.Instance.BoldLabel);
                GUILayout.Space(7);
                GUILayout.Label(TileLang.Text("Caution, proceeding will delete tileset which will cause damage to any scenes or assets that require it.\n\nAll contained brushes will also be deleted."), EditorStyles.wordWrappedLabel);
                GUILayout.Space(5);
            }
            GUILayout.EndVertical();

            ExtraEditorGUI.SeparatorLight(thickness: 3);
        }
Esempio n. 23
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);
        }
        private void UnloadDesignerView()
        {
            if (this.designerView == null)
            {
                return;
            }

            RotorzEditorGUI.ClearHoverTip();

            this.designerView.OnDisable();
            this.designerView = null;

            this.History.Cleanup();
            this.SelectedObject = null;
        }
Esempio n. 25
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);
            }
        }
Esempio n. 26
0
        private void OnGUI()
        {
            GUILayout.Space(10);

            switch (Event.current.type)
            {
            case EventType.KeyDown:
                this.OnKeyDownEvent(Event.current.keyCode);
                break;

            case EventType.Repaint:
                if (this.ShownAsDropDown)
                {
                    RotorzEditorStyles.Instance.WindowGreyBorder.Draw(new Rect(0, 0, position.width, position.height), GUIContent.none, false, false, false, false);
                    ExtraEditorGUI.SeparatorLight(new Rect(1, 21, position.width - 2, 1));
                }
                break;
            }

            if (this.ShownAsDropDown)
            {
                GUILayout.Space(-7);
                GUILayout.Label(this.titleContent, EditorStyles.boldLabel);
                GUILayout.Space(5);
            }

            GUILayout.BeginHorizontal();

            GUILayout.Space(5);

            this.DrawOrientationButtons();

            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();
            {
                GUILayout.Space(2);
                this.DrawDialogButtons();
                GUILayout.Space(5);
            }
            GUILayout.EndVertical();

            GUILayout.Space(5);

            GUILayout.EndHorizontal();

            RotorzEditorGUI.DrawHoverTip(this);
        }
Esempio n. 27
0
        private void DrawVariationShifter()
        {
            Rect position = GUILayoutUtility.GetRect(17, 0);

            position.x     += 2;
            position.height = 27;

            Rect plusButtonPosition = new Rect(position.x, position.y - 4, 17, 17);

            using (var content = ControlContent.Basic("", this._shiftToNextVariationTooltip)) {
                if (RotorzEditorGUI.HoverButton(plusButtonPosition, content))
                {
                    ++this.VariationShiftCount;
                }
            }

            Rect minusButtonPosition = new Rect(position.x, position.yMax - 14, 17, 17);

            using (var content = ControlContent.Basic("", this._shiftToPrevVariationTooltip)) {
                if (RotorzEditorGUI.HoverButton(minusButtonPosition, content))
                {
                    --this.VariationShiftCount;
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                Color restoreColor = GUI.color;
                if (!GUI.enabled)
                {
                    GUI.color = new Color(1f, 1f, 1f, 0.4f);
                }

                plusButtonPosition.x     += 6;
                plusButtonPosition.y     += 5;
                plusButtonPosition.width  = 5;
                plusButtonPosition.height = 7;
                GUI.DrawTextureWithTexCoords(plusButtonPosition, RotorzEditorStyles.Skin.VariationOffsetSelector, new Rect(0f, 0.5f, 1f, 0.5f));

                minusButtonPosition.x     += 6;
                minusButtonPosition.y     += 5;
                minusButtonPosition.width  = 5;
                minusButtonPosition.height = 7;
                GUI.DrawTextureWithTexCoords(minusButtonPosition, RotorzEditorStyles.Skin.VariationOffsetSelector, new Rect(0f, 0f, 1f, 0.5f));

                GUI.color = restoreColor;
            }
        }
Esempio n. 28
0
        private void DrawAtlasTextureField()
        {
            EditorGUI.BeginChangeCheck();
            this.inputNewAutotileArtwork = RotorzEditorGUI.AutotileArtworkField(this.inputNewAutotileArtwork, this.autotileTileset.AutotileLayout, this.autotileTileset.HasInnerJoins);
            if (EditorGUI.EndChangeCheck())
            {
                this.LoadUncompressedAutotileArtwork(this.inputNewAutotileArtwork);

                // Recalculate tile size and expand autotile artwork.
                if (this.inputNewAutotileArtworkUncompressed != null)
                {
                    AutotileExpanderUtility.EstimateTileSize(this.autotileTileset.AutotileLayout, this.inputNewAutotileArtworkUncompressed, this.autotileTileset.HasInnerJoins, ref this.inputTileWidth, ref this.inputTileHeight);
                    this.ExpandAutotileArtwork();
                }
            }
        }
        /// <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."));
        }
        private void DrawCreatorSection()
        {
            GUILayout.Label(TileLang.Text("Brushes"), EditorStyles.boldLabel);
            {
                using (var content = ControlContent.Basic(
                           TileLang.ParticularText("Property", "Brushes Folder")
                           )) {
                    this.propertyBrushesFolderRelativePath.stringValue = RotorzEditorGUI.RelativeAssetPathTextField(content, this.propertyBrushesFolderRelativePath.stringValue, false);
                }

                GUILayout.Space(3);
                Rect totalButtonPosition = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(true, 20));

                Rect buttonPosition = totalButtonPosition;
                buttonPosition.x    += EditorGUIUtility.labelWidth;
                buttonPosition.width = (buttonPosition.width - EditorGUIUtility.labelWidth) / 2f - 2;

                if (GUI.Button(buttonPosition, TileLang.OpensWindow(TileLang.ParticularText("Action", "Browse"))))
                {
                    this.BrushesFolder_Browse_Clicked();
                }

                buttonPosition.x = buttonPosition.xMax + 4;
                if (GUI.Button(buttonPosition, TileLang.ParticularText("Action", "Reset")))
                {
                    this.BrushesFolder_Reset_Clicked();
                }
            }

            GUILayout.Label(TileLang.Text("Tilesets"), EditorStyles.boldLabel);
            {
                using (var content = ControlContent.Basic(
                           TileLang.ParticularText("Property", "Opaque Material Template")
                           )) {
                    EditorGUILayout.PropertyField(this.propertyOpaqueTilesetMaterialTemplate, content);
                }

                using (var content = ControlContent.Basic(
                           TileLang.ParticularText("Property", "Transparent Material Template")
                           )) {
                    EditorGUILayout.PropertyField(this.propertyTransparentTilesetMaterialTemplate, content);
                }

                RotorzEditorGUI.InfoBox(TileLang.Text("Default materials are created when no material templates are specified."));
            }
        }