/// <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 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);
        }
Exemple #3
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;
            }
        }
        private void DrawPreferredLanguageField()
        {
            EditorGUILayout.BeginHorizontal();

            // "Preferred Language (BETA)"
            using (var content = ControlContent.Basic(TileLang.Text("Preferred Language (BETA)"))) {
                EditorGUI.BeginChangeCheck();
                this.preferredCultureIndex = EditorGUILayout.Popup(content, this.preferredCultureIndex, this.availableCultureLabels);
                if (EditorGUI.EndChangeCheck())
                {
                    var selectedCulture = this.availableCultures[this.preferredCultureIndex];
                    PackageLanguageManager.SetPreferredCulture(selectedCulture);
                }
            }

            GUILayout.Space(32);

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.RefreshIcon,
                       TileLang.ParticularText("Action", "Refresh")
                       )) {
                Rect refreshButtonPosition = GUILayoutUtility.GetLastRect();
                refreshButtonPosition.x      = refreshButtonPosition.xMax - 31 + 3;
                refreshButtonPosition.y      = refreshButtonPosition.y - 1;
                refreshButtonPosition.width  = 31;
                refreshButtonPosition.height = 21;
                if (RotorzEditorGUI.HoverButton(refreshButtonPosition, content))
                {
                    PackageLanguageManager.ReloadAll();
                }
            }

            EditorGUILayout.EndHorizontal();

            string translators = TileLang.Text("__Translators__").Trim();

            if (!string.IsNullOrEmpty(translators) && translators != "-" && translators != "__Translators__")
            {
                string message = string.Format(
                    /* list of special people names */
                    TileLang.Text("Special Thanks: {0}"),
                    translators
                    );
                EditorGUILayout.HelpBox(message, MessageType.None);
            }
        }
Exemple #5
0
        /// <inheritdoc/>
        public override void DrawSecondaryMenuButton(Rect position)
        {
            EditorGUI.BeginDisabledGroup(this.TilesetBrush.Tileset == null);

            using (var content = ControlContent.Basic(
                       RotorzEditorStyles.Skin.GotoTileset,
                       TileLang.FormatActionWithShortcut(
                           TileLang.ParticularText("Action", "Goto Tileset"), "F3"
                           )
                       )) {
                if (RotorzEditorGUI.HoverButton(position, content))
                {
                    this.OnViewTileset();
                    GUIUtility.ExitGUI();
                }
            }

            EditorGUI.EndDisabledGroup();
        }
        /// <inheritdoc/>
        public override void DrawSecondaryMenuButton(Rect position)
        {
            var brushRecord = BrushDatabase.Instance.FindRecord(this.AliasBrush.target);

            EditorGUI.BeginDisabledGroup(brushRecord == null || brushRecord.IsMaster);
            {
                using (var content = ControlContent.Basic(
                           RotorzEditorStyles.Skin.GotoTarget,
                           TileLang.FormatActionWithShortcut(
                               TileLang.ParticularText("Action", "Goto Target Brush"), "F3"
                               )
                           )) {
                    if (RotorzEditorGUI.HoverButton(position, content))
                    {
                        this.ShowTargetBrushInDesigner();
                        GUIUtility.ExitGUI();
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
        }