예제 #1
0
        private QuickActionHudSpace() : base(HudMain.Root)
        {
            DrawBoundingBox = false;
            targetGrid      = new TerminalGrid();
            tempGrid        = new TerminalGrid();
            targetBuffer    = new List <IMySlimBlock>();
            Target          = new PropertyBlock();

            quickActionMenu = new QuickActionMenu(this);
            boundingBox     = new BoundingBoard();
            hudNotification = MyAPIGateway.Utilities.CreateNotification("", 1000, MyFontEnum.Red);

            frameTimer = new Stopwatch();
            frameTimer.Start();

            RichHudCore.LateMessageEntered += MessageHandler;
        }
예제 #2
0
            public PropertyWheelMenu(QuickActionMenu parent) : base(null)
            {
                Register(parent, true);
                this.quickActionMenu = parent;
                wheelBody            = new PropertyWheelMenuBody(this)
                {
                };

                // Selection wheel for block properties
                propertyWheel = new RadialSelectionBox <PropertyWheelEntryBase, Label>()
                {
                    Visible         = false,
                    BackgroundColor = bodyColor,
                    HighlightColor  = highlightColor,
                    SelectionColor  = highlightFocusColor,
                    ZOffset         = -1,
                };
                propertyWheel.Register(wheelBody, true);

                // Selection wheel for dupe shortcuts
                dupeWheel = new RadialSelectionBox <PropertyWheelEntryBase, Label>()
                {
                    Visible             = false,
                    BackgroundColor     = bodyColor,
                    HighlightColor      = highlightColor,
                    SelectionColor      = highlightFocusColor,
                    ZOffset             = -1,
                    CollectionContainer =
                    {
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Back",
                            ShortcutAction = quickActionMenu.StopPropertyDuplication,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Open List",
                            ShortcutAction = quickActionMenu.OpenDupeList,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Open List and Select All",
                            ShortcutAction = quickActionMenu.OpenDupeListAndSelectAll,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Clear Selection",
                            ShortcutAction = quickActionMenu.ClearSelection,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Copy Selected",
                            ShortcutAction = quickActionMenu.CopySelectedProperties,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Copy All but Name",
                            ShortcutAction = () => quickActionMenu.CopyAllProperties(false),
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Copy All",
                            ShortcutAction = () => quickActionMenu.CopyAllProperties(true),
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Paste",
                            ShortcutAction = quickActionMenu.PasteCopiedProperties,
                        },
                        new PropertyWheelShortcutEntry()
                        {
                            Text           = "Undo",
                            ShortcutAction = quickActionMenu.UndoPropertyPaste,
                        },
                    }
                };
                dupeWheel.Register(wheelBody, true);

                // Shortcuts to be added to the property wheel later
                shortcutEntries = new List <PropertyWheelShortcutEntry>()
                {
                    new PropertyWheelShortcutEntry()
                    {
                        Text           = "Copy Settings",
                        ShortcutAction = () =>
                        {
                            MenuState = QuickActionMenuState.WheelMenuControl;
                            quickActionMenu.StartPropertyDuplication();
                        },
                    }
                };

                // I'm using a generic pool because I'm using two types of entry in the same list, but only
                // one is pooled, and I can't be arsed to do this more neatly.
                propertyEntryPool = new ObjectPool <object>(
                    () => new PropertyWheelEntry(),
                    x => (x as PropertyWheelEntry).Reset()
                    );

                debugText = new Label(this)
                {
                    Visible         = false,
                    BuilderMode     = TextBuilderModes.Lined,
                    ParentAlignment = ParentAlignments.Right
                };
            }
예제 #3
0
            public PropertyListMenu(QuickActionMenu parent) : base(parent)
            {
                quickActionMenu = parent;

                header = new LabelBox()
                {
                    Format     = listHeaderFormat,
                    Text       = "Build Vision",
                    AutoResize = false,
                    Size       = new Vector2(300f, 34f),
                    Color      = headerColor,
                };

                listBody = new ScrollBox <PropertyListEntry, PropertyListEntryElement>(true)
                {
                    MemberMinSize      = new Vector2(300f, 0f),
                    SizingMode         = HudChainSizingModes.ClampChainOffAxis | HudChainSizingModes.FitChainAlignAxis,
                    Padding            = new Vector2(30f, 16f),
                    Color              = bodyColor,
                    EnableScrolling    = false,
                    UseSmoothScrolling = false,
                    MinVisibleCount    = 10,
                    Visible            = false,
                };

                listBody.ScrollBar.Padding = new Vector2(12f, 16f);
                listBody.ScrollBar.Width   = 4f;

                peekBody = new LabelBox()
                {
                    AutoResize     = false,
                    VertCenterText = false,
                    Color          = bodyColor,
                    TextPadding    = new Vector2(48f, 16f),
                    BuilderMode    = TextBuilderModes.Lined,
                };

                var border = new BorderBox(listBody)
                {
                    DimAlignment = DimAlignments.Both,
                    Color        = new Color(58, 68, 77),
                    Thickness    = 1f,
                };

                highlightBox = new HighlightBox(listBody.Background)
                {
                    Padding = new Vector2(16f, 0f)
                };

                footer = new DoubleLabelBox()
                {
                    AutoResize  = false,
                    TextPadding = new Vector2(48f, 0f),
                    Size        = new Vector2(300f, 24f),
                    Color       = headerColor,
                };

                layout = new HudChain(true, this)
                {
                    MemberMinSize       = new Vector2(300f, 0f),
                    SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                    CollectionContainer =
                    {
                        header,
                        { listBody,true      },
                        { peekBody,true      },
                        footer
                    }
                };

                debugText = new Label(layout)
                {
                    ParentAlignment = ParentAlignments.Right,
                    BuilderMode     = TextBuilderModes.Lined
                };

                peekBuilder       = new RichText();
                entryPool         = new ObjectPool <PropertyListEntry>(() => new PropertyListEntry(), x => x.Reset());
                notificationTimer = new Stopwatch();
                listWrapTimer     = new Stopwatch();
            }