Example #1
0
        public MyGuiScreenEditorLoadGroup(List <MyMwcObjectBuilder_ObjectGroup> groups, List <MyMwcObjectBuilder_Base> entities)
            : base(new Vector2(0.5f, 0.5f), new Vector2(0.33f, 0.85f))
        {
            m_groups   = groups;
            m_entities = entities;
            m_size     = new Vector2(0.48f, 0.85f);

            AddCaption(new StringBuilder("Load Group"), MyGuiConstants.LABEL_TEXT_COLOR, new Vector2(0, 0.005f));

            Vector2 groupListTopLeft = new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X - 0.025f, 0.1f) - m_size.Value / 2;
            Vector2 groupListSize    = m_size.Value - new Vector2(
                MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 2 - 0.05f,
                0.1f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            m_groupList = new MyGuiControlTreeView(this, groupListTopLeft + groupListSize / 2, groupListSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR, true);
            m_groupList.WholeRowHighlight = true;

            Controls.Add(m_groupList);

            AddOkAndCancelButtonControls(new Vector2(0, -0.01f));

            foreach (var group in groups)
            {
                var listItem = m_groupList.AddItem(new StringBuilder(group.Name), null, Vector2.Zero, null, null, Vector2.Zero);
                listItem.Tag = group;
            }
        }
Example #2
0
        public MyTreeView(MyGuiControlTreeView control, Vector2 position, Vector2 size)
        {
            m_control = control;

            m_position = position;
            m_size     = size;

            m_body          = new MyTreeViewBody(this, position, size);
            m_vScrollbar    = new MyVScrollbar(control);
            m_hScrollbar    = new MyHScrollbar(control);
            m_scrollbarSize = new Vector2(MyGuiConstants.TREEVIEW_VSCROLLBAR_SIZE.X, MyGuiConstants.TREEVIEW_HSCROLLBAR_SIZE.Y);

            m_vScrollbar.TopBorder  = m_vScrollbar.RightBorder = false;
            m_hScrollbar.LeftBorder = m_hScrollbar.BottomBorder = false;
        }
Example #3
0
        public MyTreeView(MyGuiControlTreeView control, Vector2 position, Vector2 size)
        {
            m_control = control;

            m_position = position;
            m_size = size;

            m_body = new MyTreeViewBody(this, position, size);
            m_vScrollbar = new MyVScrollbar(control);
            m_hScrollbar = new MyHScrollbar(control);
            m_scrollbarSize = new Vector2(MyGuiConstants.TREEVIEW_VSCROLLBAR_SIZE.X, MyGuiConstants.TREEVIEW_HSCROLLBAR_SIZE.Y);

            m_vScrollbar.TopBorder = m_vScrollbar.RightBorder = false;
            m_hScrollbar.LeftBorder = m_hScrollbar.BottomBorder = false;
        }
Example #4
0
        public MyGuiScreenEditorGroups()
            : base(new Vector2(0.5f, 0.5f), new Vector2(0.6f, 0.9f))
        {
            AddCaption(MyTextsWrapperEnum.EditorGroups, MyGuiConstants.LABEL_TEXT_COLOR, new Vector2(0, 0.007f));

            Vector2 groupListTopLeft = new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 0.7f, CAPTION_OFFSET_Y) - m_size.Value / 2;
            Vector2 groupListSize    = m_size.Value - new Vector2(
                MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 3 + BUTTON_SIZE.X * 0.5f,
                CAPTION_OFFSET_Y + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            m_groupList = new MyGuiControlTreeView(this, groupListTopLeft + groupListSize / 2, groupListSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR, true);
            m_groupList.WholeRowHighlight = true;

            Controls.Add(m_groupList);

            int index = 0;

            m_addObjectsButton    = AddButton(index++, 0, MyTextsWrapperEnum.EditorGroupsAddObjects, OnAddObjects);
            m_removeObjectsButton = AddButton(index++, 0, MyTextsWrapperEnum.EditorGroupsRemoveObjects, OnRemoveObjects);

            m_selectGroupButton   = AddButton(index++, 1, MyTextsWrapperEnum.EditorGroupsSelectGroup, OnSelectGroup);
            m_unselectGroupButton = AddButton(index++, 1, MyTextsWrapperEnum.EditorGroupsUnselectGroup, OnUnselectGroup);

            m_createGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsCreateGroup, OnCreateGroup);
            m_renameGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsRenameGroup, OnRenameGroup);
            m_deleteGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsDeleteGroup, OnDeleteGroup);

            m_loadGroupButton = AddButton(index, 3, MyTextsWrapperEnum.EditorGroupsLoadGroup, OnLoadGroup, true);

            AddBackButtonControl(new Vector2(0, -0.03f));

            foreach (var group in MyEditor.Static.ObjectGroups)
            {
                AddGroup(group);
            }
        }
        protected virtual void CreateControls()
        {
            CreateButtons();
            var screenZero = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0));
            var screenMax  = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(MyMinerGame.ScreenSize.X, MyMinerGame.ScreenSize.Y));

            var textBoxSize  = MyGuiConstants.TEXTBOX_MEDIUM_SIZE + new Vector2(30f / 1600f, 0);
            var treeViewSize = new Vector2(textBoxSize.X, screenMax.Y - (MyGuiConstants.TOOLBAR_PADDING.Y * 6 + textBoxSize.Y + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y));
            var panelSize    = treeViewSize + new Vector2(MyGuiConstants.TOOLBAR_PADDING.X * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3) + new Vector2(0, textBoxSize.Y);

            var textBoxPosition  = screenZero + new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y * 2, MyGuiConstants.TOOLBAR_PADDING.Y * 3 + MyGuiConstants.TOOLBAR_BUTTON_SIZE.Y);
            var treeViewPosition = textBoxPosition + new Vector2(0, textBoxSize.Y + MyGuiConstants.TOOLBAR_PADDING.Y);
            var panelPosition    = textBoxPosition - new Vector2(MyGuiConstants.TOOLBAR_PADDING.Y, MyGuiConstants.TOOLBAR_PADDING.Y);

            // Add treeview and add button panel
            m_controlPanel = new MyGuiControlPanel(m_parentScreen,
                                                   panelPosition + panelSize / 2,
                                                   panelSize,
                                                   MyGuiConstants.TREEVIEW_BACKGROUND_COLOR,
                                                   null, null, null, null,
                                                   MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            m_editorControls.Add(m_controlPanel);

            m_addObjectTreeViewdragDrop      = new MyTreeViewItemDragAndDrop(m_parentScreen);
            m_addObjectTreeViewdragDrop.Drop = OnDragDrop;

            // Add object treeView
            m_addObjectTreeView = new MyGuiControlTreeView(
                m_parentScreen,
                treeViewPosition + treeViewSize / 2,
                treeViewSize,
                MyGuiConstants.TREEVIEW_BACKGROUND_COLOR,
                false);
            m_editorControls.Add(m_addObjectTreeView);

            // Add treeView filter textBox
            m_filterTextbox = new MyGuiControlTextbox(m_parentScreen,
                                                      textBoxPosition + textBoxSize / 2,
                                                      MyGuiControlPreDefinedSize.MEDIUM,
                                                      string.Empty, 80,
                                                      MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL, false);
            m_editorControls.Add(m_filterTextbox);
            MyGuiScreenGamePlay.Static.SetControlIndex(1);

            // Dragdrop Control must be last (draw over other controls)
            m_editorControls.Add(m_addObjectTreeViewdragDrop);

            Vector2 editVoxelHandPanelSize = new Vector2(panelSize.X * 1.4f, panelSize.Y);

            m_editVoxelHand = new MyGuiControlEditVoxelHand(m_parentScreen, panelPosition + editVoxelHandPanelSize / 2f, editVoxelHandPanelSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR);
            m_editorControls.Add(m_editVoxelHand);

            Vector2 editLightsSize = new Vector2(0.48f, 0.925f);

            m_editLights = new MyGuiControlEditLights(m_parentScreen, panelPosition + editLightsSize / 2, editLightsSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR);
            m_editorControls.Add(m_editLights);
            m_editLights.Visible = false;
            foreach (MyGuiControlBase control in m_editorControls)
            {
                control.DrawWhilePaused = false;
            }
        }