private bool HandleBlueprintInput()
        {
            if (MyInput.Static.IsNewKeyPressed(MyKeys.B) && MyInput.Static.IsAnyCtrlKeyPressed() && !MyInput.Static.IsAnyMousePressed())
            {
                MyGuiAudio.PlaySound(MyGuiSounds.HudClick);

                if (!m_clipboard.IsActive)
                {
                    MySessionComponentVoxelHand.Static.Enabled = false;
                    var copiedGrid = MyCubeGrid.GetTargetGrid();

                    if (!MyInput.Static.IsAnyShiftKeyPressed())
                    {
                        m_clipboard.CopyGroup(copiedGrid, MyInput.Static.IsAnyAltKeyPressed() ? GridLinkTypeEnum.Physical : GridLinkTypeEnum.Logical);
                    }
                    else
                    {
                        m_clipboard.CopyGrid(copiedGrid);
                    }

                    UpdatePasteNotification(MyCommonTexts.CubeBuilderPasteNotification);

                    var blueprintScreen = new MyGuiBlueprintScreen(m_clipboard, MySession.Static.CreativeMode || MySession.Static.CreativeToolsEnabled(Sync.MyId));
                    if (copiedGrid != null)
                    {
                        blueprintScreen.CreateFromClipboard(true);
                    }
                    m_clipboard.Deactivate();
                    MyGuiSandbox.AddScreen(blueprintScreen);
                }
                return(true);
            }

            return(false);
        }
Example #2
0
        private bool LoadBlueprint(string path)
        {
            bool success = false;
            MyObjectBuilder_Definitions blueprint = MyGuiBlueprintScreenBase.LoadPrefab(path);

            if (blueprint != null)
            {
                success = MyGuiBlueprintScreen.CopyBlueprintPrefabToClipboard(blueprint, m_clipboard);
            }

            OnBlueprintScreen_Closed(null);
            return(success);
        }
Example #3
0
        public void SelectBlueprint()
        {
            if (MyGuiScreenTerminal.IsOpen)
            {
                MyGuiScreenTerminal.Hide();
            }

            RemoveProjection(false);
            var blueprintScreen = new MyGuiBlueprintScreen(m_clipboard);

            blueprintScreen.Closed += OnBlueprintScreen_Closed;
            MyGuiSandbox.AddScreen(blueprintScreen);
        }