public override void OnGUILayout()
        {
            base.OnGUILayout();

            var newTab = RadioButtonsGroup.DrawEnum(_model.ControlPanelTab, styleFunc, contentFunc);

            if (newTab != _model.ControlPanelTab)
            {
                _model.ControlPanelTab = newTab;
                _model.Repaint();
            }

            switch (newTab)
            {
            case ControlPanelTabs.ManualSlicing:
                GlobalSettingsView.OnGUILayout();

                ChunksView.OnGUILayout();
                EditorGUILayout.Space();
                GroupsView.WindowWidth = WindowWidth;
                GroupsView.OnGUILayout();

                DraggableButtonsView.OnGUI(Rect.zero);
                break;

            case ControlPanelTabs.ScriptableSclicing:
                ScriptableSlicingView.WindowWidth = WindowWidth;
                ScriptableSlicingView.OnGUILayout();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public override void OnGUILayout()
        {
            base.OnGUILayout();

            EditorGUILayout.LabelField(new GUIContent($"<b>Groups</b>", $"Here you can edit groups of chunks, end-of-lines, spaces etc."), _model.RichTextStyle);

            _groupsTopPanel.OnGUILayout();

            if (Event.current.type == EventType.Repaint)
            {
                _mainRect   = GUILayoutUtility.GetLastRect();
                _mainRect.y = _mainRect.y + _mainRect.height;
            }
            _groupsMainPanel.WindowWidth = WindowWidth;
            _groupsMainPanel.OnGUILayout();
            if (Event.current.type == EventType.Repaint)
            {
                var lastRect = GUILayoutUtility.GetLastRect();
                _mainRect.height = lastRect.y + lastRect.height - _mainRect.y;
            }
            DragableButton.AcceptDragArea = _mainRect;

            if (_model.SlicingSettings.ChunkGroups.Count(group => group.Id == _model.EditedGroupId) > 0)
            {
                _groupEditPanel.OnGUILayout();
            }

            //switch (Event.current.type) //This doesn't work, but would be great to make it somehow...
            //{
            //    case EventType.KeyDown:
            //        Debug.Log($"keyCode: {Event.current.keyCode}");
            //        if (_model.EditedGroupId > 0 && Event.current.keyCode == KeyCode.Delete && EditorUtility.DisplayDialog($"Confirmation", "Are you sure you want to delete this group?", "Yes", "No"))
            //        {
            //            _model.RemoveGroupAt(_model.SlicingSettings.GetGroupInfoById(_model.EditedGroupId).index);
            //            Event.current.Use();
            //        }
            //        break;
            //}
        }
Ejemplo n.º 3
0
        public override void OnGUILayout()
        {
            base.OnGUILayout();

            var reserve = GUILayoutUtility.GetRect(1, /*_model.SlicingSettings.HaveChunkGroups() ? 60 : 30*/ 60);

            _topPanelView.ReservedHeight = reserve.height;
            if (Event.current.type == EventType.Repaint)
            {
                _topPanelViewPosition = reserve;
            }

            if (!Extracted)
            {
                if (_windowInstanceCache != null)
                {
                    _windowInstanceCache.Close();
                }
                DrawControlPanel(SpriteEditorProWindow.MaxContolPanelWidth);
            }
            else if (_windowInstanceCache == null)
            {
                _windowInstanceCache = EditorWindow.GetWindow(typeof(ExtractedControlPanelWIndow), true, _model.ControlPanelCaption);
                _model.Focus();
            }

            if (Event.current.type == EventType.Repaint)
            {
                _topPanelViewPosition.width = GUILayoutUtility.GetLastRect().width;
            }
            if (_topPanelViewPosition == Rect.zero)
            {
                GUI.changed = true;
            }

            GUILayout.BeginArea(_topPanelViewPosition);
            _topPanelView.OnGUILayout();
            GUILayout.EndArea();
        }
Ejemplo n.º 4
0
 public static void DrawControlPanel(float windowWidth)
 {
     TabsView.WindowWidth = windowWidth;
     TabsView.OnGUILayout();
 }